Skip to content

Bug: Invalid timezone values silently accepted while valid POSIX strings are not Summary #23

@WillemAnchor

Description

@WillemAnchor

When configuring the timezone via the timezone NVS key, the firmware silently accepts arbitrary or invalid strings (e.g., foobar, CET, or even the IP address 192.168.0.84). However, valid POSIX-compliant timezone strings such as:

CET-1CEST-2,M3.5.0/02,M10.5.0/03

...are not stored correctly. Instead, the key is silently erased or replaced with a blank value. This results in incorrect or missing time synchronization, especially when accurate local timestamps are required for Home Assistant or MQTT integration.
Observed behavior

Setting timezone CET-1CEST-2,M3.5.0/02,M10.5.0/03 results in the timezone key being erased (blank in nvs dump).

Setting timezone CET- or any invalid string like foobar is accepted and saved without error.

In one case, after attempting to set the timezone, the sntp_server key was unintentionally overwritten with the same string.

Until SNTP sync is successful, HA receives timestamps like 1970-01-01.

Expected behavior

Valid POSIX timezone strings should be accepted and correctly parsed.

Invalid timezone strings should not be accepted silently.

The sntp_server key should not be overwritten by timezone inputs.

Clear logging should indicate if timezone parsing fails.

Suggested fix

Validate the timezone string against the POSIX format (or document accepted alternatives).

Prevent silent failure when setting timezone.

Log any parsing errors or fallbacks explicitly.

Ensure sntp_server and timezone are handled independently.

Environment

Device: Ramses ESP (latest stable from Indalo Tech shop)

Firmware: 0.4.9

MQTT broker: LAN (Home Assistant container on Synology NAS)

Timezone: Europe/Amsterdam (should resolve to CET/CEST)

Related config in NVS:

[network]: key 'sntp_server' <str> 192.168.0.84
[network]: key 'timezone'    <str> CET-1CEST-2,M3.5.0/02,M10.5.0/03

Impact

Incorrect or missing timestamps on MQTT/Home Assistant events and logs. This causes confusion and makes automation/diagnostics difficult.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions