Automation does not work - switch changes the value back immediately

Hello,

I have a Zigbee stick and use Zigbee2MQTT. I have heating thermostats from Rolley (TuYa TV02-Zigbee control via MQTT | Zigbee2MQTT) and window contacts from Sonoff (SONOFF SNZB-04 control via MQTT | Zigbee2MQTT).
I have configured an automation that activates “window open” on the thermostat when the window contact is open.

Unfortunately, this does not work properly. The thermostat is switched to “window open”, but also immediately switched back “window closed”

here the MQTT Log:

debug 2024-02-10 20:19:16Received Zigbee message from 'Testkontakt', type 'commandStatusChangeNotification', cluster 'ssIasZone', data '{"extendedstatus":0,"zonestatus":1}' from endpoint 1 with groupID 0
info 2024-02-10 20:19:16MQTT publish: topic 'zigbee2mqtt/Testkontakt', payload '{"battery":100,"battery_low":false,"contact":false,"last_seen":"2024-02-10T20:19:16+01:00","linkquality":145,"tamper":false,"voltage":3300}'
debug 2024-02-10 20:19:21Received MQTT message on 'zigbee2mqtt/Heizung Arbeitszimmer Martin/set/open_window' with data 'ON'
debug 2024-02-10 20:19:21Publishing 'set' 'open_window' to 'Heizung Arbeitszimmer Martin'
info 2024-02-10 20:19:21MQTT publish: topic 'zigbee2mqtt/Heizung Arbeitszimmer Martin', payload '{"battery_low":false,"boost_timeset_countdown":0,"child_lock":"UNLOCK","comfort_temperature":22,"current_heating_setpoint":30,"eco_temperature":18,"error_status":0,"frost_protection":"OFF","heating_stop":"OFF","holiday_start_stop":"2021/01/01 01:01 | 2021/01/01 01:01","holiday_temperature":17,"last_seen":"2024-02-10T20:10:10+01:00","linkquality":123,"local_temperature":21.9,"local_temperature_calibration":0,"online":"ON","open_window":"ON","open_window_temperature":5,"preset":"manual","schedule_friday":"06:00/17 12:00/21 14:00/17 17:00/21 24:00/17","schedule_monday":"06:00/17 12:00/21 14:00/17 17:00/21 24:00/17","schedule_saturday":"06:00/17 12:00/21 14:00/17 17:00/21 24:00/17","schedule_sunday":"06:00/17 12:00/21 14:00/17 17:00/21 24:00/17","schedule_thursday":"06:00/17 12:00/21 14:00/17 17:00/21 24:00/17","schedule_tuesday":"06:00/17 12:00/21 14:00/17 17:00/21 24:00/17","schedule_wednesday":"06:00/17 12:00/21 14:00/17 17:00/21 24:00/17","system_mode":"heat","update":{"installed_version":69,"latest_version":-1,"state":"idle"},"update_available":false,"working_day":"mon_sun"}'
debug 2024-02-10 20:19:22Received Zigbee message from 'Heizung Arbeitszimmer Martin', type 'commandDataResponse', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[1],"type":"Buffer"},"datatype":1,"dp":8}],"seq":1}' from endpoint 1 with groupID 0
info 2024-02-10 20:19:22MQTT publish: topic 'zigbee2mqtt/Heizung Arbeitszimmer Martin', payload '{"battery_low":false,"boost_timeset_countdown":0,"child_lock":"UNLOCK","comfort_temperature":22,"current_heating_setpoint":30,"eco_temperature":18,"error_status":0,"frost_protection":"OFF","heating_stop":"OFF","holiday_start_stop":"2021/01/01 01:01 | 2021/01/01 01:01","holiday_temperature":17,"last_seen":"2024-02-10T20:19:22+01:00","linkquality":138,"local_temperature":21.9,"local_temperature_calibration":0,"online":"ON","open_window":"ON","open_window_temperature":5,"preset":"manual","schedule_friday":"06:00/17 12:00/21 14:00/17 17:00/21 24:00/17","schedule_monday":"06:00/17 12:00/21 14:00/17 17:00/21 24:00/17","schedule_saturday":"06:00/17 12:00/21 14:00/17 17:00/21 24:00/17","schedule_sunday":"06:00/17 12:00/21 14:00/17 17:00/21 24:00/17","schedule_thursday":"06:00/17 12:00/21 14:00/17 17:00/21 24:00/17","schedule_tuesday":"06:00/17 12:00/21 14:00/17 17:00/21 24:00/17","schedule_wednesday":"06:00/17 12:00/21 14:00/17 17:00/21 24:00/17","system_mode":"heat","update":{"installed_version":69,"latest_version":-1,"state":"idle"},"update_available":false,"working_day":"mon_sun"}'
debug 2024-02-10 20:19:22Received Zigbee message from 'Heizung Arbeitszimmer Martin', type 'commandDataResponse', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[1],"type":"Buffer"},"datatype":1,"dp":8}],"seq":257}' from endpoint 1 with groupID 0
info 2024-02-10 20:19:22MQTT publish: topic 'zigbee2mqtt/Heizung Arbeitszimmer Martin', payload '{"battery_low":false,"boost_timeset_countdown":0,"child_lock":"UNLOCK","comfort_temperature":22,"current_heating_setpoint":30,"eco_temperature":18,"error_status":0,"frost_protection":"OFF","heating_stop":"OFF","holiday_start_stop":"2021/01/01 01:01 | 2021/01/01 01:01","holiday_temperature":17,"last_seen":"2024-02-10T20:19:22+01:00","linkquality":138,"local_temperature":21.9,"local_temperature_calibration":0,"online":"ON","open_window":"ON","open_window_temperature":5,"preset":"manual","schedule_friday":"06:00/17 12:00/21 14:00/17 17:00/21 24:00/17","schedule_monday":"06:00/17 12:00/21 14:00/17 17:00/21 24:00/17","schedule_saturday":"06:00/17 12:00/21 14:00/17 17:00/21 24:00/17","schedule_sunday":"06:00/17 12:00/21 14:00/17 17:00/21 24:00/17","schedule_thursday":"06:00/17 12:00/21 14:00/17 17:00/21 24:00/17","schedule_tuesday":"06:00/17 12:00/21 14:00/17 17:00/21 24:00/17","schedule_wednesday":"06:00/17 12:00/21 14:00/17 17:00/21 24:00/17","system_mode":"heat","update":{"installed_version":69,"latest_version":-1,"state":"idle"},"update_available":false,"working_day":"mon_sun"}'
debug 2024-02-10 20:19:22Received Zigbee message from 'Heizung Arbeitszimmer Martin', type 'commandDataResponse', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[0],"type":"Buffer"},"datatype":1,"dp":8}],"seq":513}' from endpoint 1 with groupID 0
info 2024-02-10 20:19:22MQTT publish: topic 'zigbee2mqtt/Heizung Arbeitszimmer Martin', payload '{"battery_low":false,"boost_timeset_countdown":0,"child_lock":"UNLOCK","comfort_temperature":22,"current_heating_setpoint":30,"eco_temperature":18,"error_status":0,"frost_protection":"OFF","heating_stop":"OFF","holiday_start_stop":"2021/01/01 01:01 | 2021/01/01 01:01","holiday_temperature":17,"last_seen":"2024-02-10T20:19:22+01:00","linkquality":138,"local_temperature":21.9,"local_temperature_calibration":0,"online":"ON","open_window":"OFF","open_window_temperature":5,"preset":"manual","schedule_friday":"06:00/17 12:00/21 14:00/17 17:00/21 24:00/17","schedule_monday":"06:00/17 12:00/21 14:00/17 17:00/21 24:00/17","schedule_saturday":"06:00/17 12:00/21 14:00/17 17:00/21 24:00/17","schedule_sunday":"06:00/17 12:00/21 14:00/17 17:00/21 24:00/17","schedule_thursday":"06:00/17 12:00/21 14:00/17 17:00/21 24:00/17","schedule_tuesday":"06:00/17 12:00/21 14:00/17 17:00/21 24:00/17","schedule_wednesday":"06:00/17 12:00/21 14:00/17 17:00/21 24:00/17","system_mode":"heat","update":{"installed_version":69,"latest_version":-1,"state":"idle"},"update_available":false,"working_day":"mon_sun"}'
debug 2024-02-10 20:19:22Received Zigbee message from 'Heizung Arbeitszimmer Martin', type 'commandDataResponse', cluster 'manuSpecificTuya', data '{"dpValues":[{"data":{"data":[1],"type":"Buffer"},"datatype":4,"dp":2}],"seq":769}' from endpoint 1 with groupID 0
info 2024-02-10 20:19:22MQTT publish: topic 'zigbee2mqtt/Heizung Arbeitszimmer Martin', payload '{"battery_low":false,"boost_timeset_countdown":0,"child_lock":"UNLOCK","comfort_temperature":22,"current_heating_setpoint":30,"eco_temperature":18,"error_status":0,"frost_protection":"OFF","heating_stop":"OFF","holiday_start_stop":"2021/01/01 01:01 | 2021/01/01 01:01","holiday_temperature":17,"last_seen":"2024-02-10T20:19:22+01:00","linkquality":134,"local_temperature":21.9,"local_temperature_calibration":0,"online":"ON","open_window":"OFF","open_window_temperature":5,"preset":"manual","schedule_friday":"06:00/17 12:00/21 14:00/17 17:00/21 24:00/17","schedule_monday":"06:00/17 12:00/21 14:00/17 17:00/21 24:00/17","schedule_saturday":"06:00/17 12:00/21 14:00/17 17:00/21 24:00/17","schedule_sunday":"06:00/17 12:00/21 14:00/17 17:00/21 24:00/17","schedule_thursday":"06:00/17 12:00/21 14:00/17 17:00/21 24:00/17","schedule_tuesday":"06:00/17 12:00/21 14:00/17 17:00/21 24:00/17","schedule_wednesday":"06:00/17 12:00/21 14:00/17 17:00/21 24:00/17","system_mode":"heat","update":{"installed_version":69,"latest_version":-1,"state":"idle"},"update_available":false,"working_day":"mon_sun"}'

what am I doing wrong?

Hard to say without seeing the automation…

It seems to be a problem with the firmware of the Thermostat. Once I take the batteries out of the thermostat, it works again.
There are also reports on the net about problems with the “Windows open” function of the thermostat.