Hi @herbalizer404
Here is what I use for hysteresis management on the Bitron device
The method I’ve used may be a bit clunky but I’m fairly new to coding in HA and this was the first approach I found that works so I’ve stuck with it. There may be obvious cleanups but I’ll leave that to the experts
First off you will need to install HACS and then install ZHA Toolkit. The documentation for ZHA Toolkit states that it is available in the default HACS repository list but just in case it isn’t the project URL is GitHub - mdeweerd/zha-toolkit: 🧰 Zigbee Home Assistant Toolkit - service for "rare" Zigbee operations using ZHA on Home Assistant
I’m providing the script actions exactly as I have them to avoid any copy/paste/edit errors so you might need to change some IDs, in particular for the thermostat device. My Bitron device is called “Central Thermostat” in HA so the entity ID of its thermostat component used in the scripts is climate.central_thermostat_thermostat
, and if you’ve installed your device as e.g. Bitron Heating Control you would need to change this to climate.bitron_heating_control_thermostat
. The rest of the identifiers can probably be used as they are unless you already have items with these names.
I have two input number helpers for use in the UI with names “Thermostat High Hysteresis” and “Thermostat Low Hysteresis” whose names correspond to the state attributes below (see attr_val). The device interprets the values supplied in units of hundredths of a degree so 10 = 0.1 degree. After updating the values in the UI it’s necessary to call a “Set” script to push the values to the device
The “Set” script actions are as follows (YAML must be used).
service: zha_toolkit.attr_write
data:
ieee: climate.central_thermostat_thermostat
endpoint: 1
cluster: 513
attribute: 257
attr_type: 33
attr_val: "{{states.input_number.thermostat_high_hysteresis.state}}"
manf: 4209
service: zha_toolkit.attr_write
data:
ieee: climate.central_thermostat_thermostat
endpoint: 1
cluster: 513
attribute: 258
attr_type: 33
attr_val: "{{states.input_number.thermostat_low_hysteresis.state}}"
manf: 4209
To retrieve the current settings I found that intermediary sensor values created by the ZHA toolkit on first read must be used (I chose thermostat_current_hysteresis_high
and thermostat_current_hysteresis_low
which you can see below), after which the Set Input Number action can be used to update the UI input helpers
The “Retrieve” script actions are as follows:
service: zha_toolkit.attr_read
data:
cluster: 513
state_id: sensor.thermostat_current_hysteresis_high
attribute: 257
attr_type: 33
manf: 4209
ieee: climate.central_thermostat_thermostat
endpoint: 1
tries: 1
allow_create: true
service: input_number.set_value
data:
value: "{{ states.sensor.thermostat_current_hysteresis_high.state | float }}"
target:
entity_id: input_number.thermostat_high_hysteresis
service: zha_toolkit.attr_read
data:
cluster: 513
state_id: sensor.thermostat_current_hysteresis_low
attribute: 258
attr_type: 33
manf: 4209
ieee: climate.central_thermostat_thermostat
endpoint: 1
tries: 1
allow_create: true
service: input_number.set_value
data:
value: "{{ states.sensor.thermostat_current_hysteresis_low.state | float }}"
target:
entity_id: input_number.thermostat_low_hysteresis
I should add that to check the values are actually updated the “Set” script has an action to call the “Retrieve” script after running its own items to refresh the UI with the (hopefully) updated values
I’ve found that high hysteresis and low hysteresis values both set to 5 (= 0.05 degrees) work well for me in terms of the resulting temperature range and rate of boiler cycling but you should play around a bit to find out what works best for you.
If you want to know more about where the “magic” numbers come from you can find the manual for the device at http://media.bitronvideo.eu/bitronhome/download/LBT90374.pdf. The identifier numbers in the manual are in hexadecimal so you’ll need to convert the decimal values above to hex to find them in the manual e.g. 257 above → 101 in hex
I hope this helps!