Skip to content

Instantly share code, notes, and snippets.

@trexx
Created December 12, 2024 22:50
Show Gist options
  • Select an option

  • Save trexx/dd934ed805730c0955297c319ad78850 to your computer and use it in GitHub Desktop.

Select an option

Save trexx/dd934ed805730c0955297c319ad78850 to your computer and use it in GitHub Desktop.
Setting datetime on POPP / Danfoss Ally zigbee TRVs
alias: Set Time On TRVs
description: ""
triggers:
- trigger: time_pattern
hours: "6"
minutes: "0"
seconds: "0"
conditions:
- condition: time
weekday:
- thu
actions:
- repeat:
sequence:
- action: mqtt.publish
metadata: {}
data:
topic: zigbee2mqtt/{{ repeat.item }}/1/set
payload: |-
{"write":{"cluster":"genTime","options":{},"payload":{
"time":{{ (utcnow().timestamp()-as_timestamp('2000-01-01T00:00:00'))|int }},
"timeStatus":1,
"timeZone":{{now().utcoffset().total_seconds()|int}},
"dstStart":{{ (as_timestamp(states('sensor.daylight_savings_start'))-as_timestamp('2000-01-01T00:00:00'))|int }},
"dstEnd":{{ (as_timestamp(states('sensor.daylight_savings_end'))-as_timestamp('2000-01-01T00:00:00'))|int }},
"dstShift":{{ states('sensor.daylight_savings_offset')|int }}
}}}
for_each:
- Office TRV
- Basement TRV
mode: single
rest:
- resource_template: "https://www.timeapi.io/api/timezone/zone?timeZone={{ now().tzinfo }}"
scan_interval: 86400
sensor:
- name: "Daylight Savings: Start"
value_template: >
{{ value_json.dstInterval.dstStart | as_datetime }}
device_class: timestamp
- name: "Daylight Savings: End"
value_template: >
{{ value_json.dstInterval.dstEnd | as_datetime }}
device_class: timestamp
- name: "Daylight Savings: Offset"
value_template: >
{{ value_json.dstInterval.dstOffsetToStandardTime.seconds | int }}
unit_of_measurement: seconds
@trexx
Copy link
Author

trexx commented Jun 13, 2025

Not needed anymore since Zigbee2MQTT has timesetting functionality built in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment