Can switch Thermostat by rule via mqtt on but not off:(

Hello i try to switch off my thermostats off and on according to a windows contact.

if I send via MQTT.fx off or heat iam able to switch them on and off.
if i do it via rule it works fine from switching from off to on (close the window) but not the otherway round.
As you can see in the look the heat gets set fine but the off gets reset and never is set at the thermostat. The openhab.log shows no errors, the event.log show that the rules seems to work fine, any idea what could be wrong :frowning:

{"system_mode":"off"}
{"system_mode":"heat"}

Thing

Thing topic WoziThermosRight "Thermostat Wohnzimmer Rechts" @ "Wohnzimmer"
    {
        Channels:
            Type string : WoZiRiMode [stateTopic="zigbee2mqtt/WoZiRehts", commandTopic="zigbee2mqtt/WoZiRehts/set", transformationPattern="JSONPATH:$.system_mode", formatBeforePublish="{ \"system_mode\": \"%s \" }"]
    }

Item

Number ThermosRi_PIVal "PI Wert am Thermostat rechts [%.0f %%]" <temp> {channel="mqtt:topic:mosquitto:WoziThermosRight:WoZiRiIValue"}

rule

rule "test"
when
    Item WoWinCon_State changed
then
    if(WoWinCon_State.state == "true"){
        sendCommand(ThermosLiMode, "on")
        sendCommand(ThermosRiMode, "on")
    } 
    else{
        sendCommand(ThermosLiMode, "off")
        sendCommand(ThermosRiMode, "off")
    } 
end

event.log

2019-11-17 21:04:44.444 [vent.ItemStateChangedEvent] - WoWinCon_State changed from false to true
2019-11-17 21:04:44.445 [vent.ItemStateChangedEvent] - WoWinCon_SigQ changed from 49 to 68
2019-11-17 21:04:44.448 [ome.event.ItemCommandEvent] - Item 'ThermosLiMode' received command heat
2019-11-17 21:04:44.450 [nt.ItemStatePredictedEvent] - ThermosLiMode predicted to become heat
2019-11-17 21:04:44.454 [vent.ItemStateChangedEvent] - ThermosLiMode changed from off to heat
2019-11-17 21:04:44.454 [ome.event.ItemCommandEvent] - Item 'ThermosRiMode' received command heat
2019-11-17 21:04:44.455 [nt.ItemStatePredictedEvent] - ThermosRiMode predicted to become heat
2019-11-17 21:04:44.457 [vent.ItemStateChangedEvent] - ThermosRiMode changed from off to heat
2019-11-17 21:04:46.058 [vent.ItemStateChangedEvent] - ThermosRi_Setpoint changed from 5 to 24
2019-11-17 21:04:46.059 [vent.ItemStateChangedEvent] - ThermosRi_SigQ changed from 65 to 63
2019-11-17 21:04:48.409 [vent.ItemStateChangedEvent] - ThermosLi_SigQ changed from 44 to 52
2019-11-17 21:04:48.410 [vent.ItemStateChangedEvent] - ThermosLi_Setpoint changed from 5 to 24
2019-11-17 21:04:52.114 [vent.ItemStateChangedEvent] - ThermosRi_SigQ changed from 63 to 65
2019-11-17 21:04:52.116 [vent.ItemStateChangedEvent] - ThermosRi_PIVal changed from 0 to 39
2019-11-17 21:04:54.472 [vent.ItemStateChangedEvent] - ThermosLi_PIVal changed from 0 to 19
2019-11-17 21:04:54.473 [vent.ItemStateChangedEvent] - ThermosLi_SigQ changed from 52 to 47
2019-11-17 21:05:05.603 [vent.ItemStateChangedEvent] - IsttemperaturFenster changed from 24.0 °C to 24.5 °C
2019-11-17 21:06:52.574 [vent.ItemStateChangedEvent] - ThermosRi_SigQ changed from 65 to 63
2019-11-17 21:06:52.575 [vent.ItemStateChangedEvent] - ThermosRi_PIVal changed from 39 to 29
2019-11-17 21:07:52.689 [vent.ItemStateChangedEvent] - WoWinCon_State changed from true to false
2019-11-17 21:07:52.690 [vent.ItemStateChangedEvent] - WoWinCon_SigQ changed from 68 to 39
2019-11-17 21:07:52.692 [ome.event.ItemCommandEvent] - Item 'ThermosLiMode' received command off
2019-11-17 21:07:52.693 [nt.ItemStatePredictedEvent] - ThermosLiMode predicted to become off
2019-11-17 21:07:52.696 [ome.event.ItemCommandEvent] - Item 'ThermosRiMode' received command off
2019-11-17 21:07:52.696 [vent.ItemStateChangedEvent] - ThermosLiMode changed from heat to off
2019-11-17 21:07:52.697 [nt.ItemStatePredictedEvent] - ThermosRiMode predicted to become off
2019-11-17 21:07:52.697 [vent.ItemStateChangedEvent] - ThermosRiMode changed from heat to off
2019-11-17 21:07:59.805 [vent.ItemStateChangedEvent] - ThermosRiMode changed from off to heat
2019-11-17 21:07:59.805 [vent.ItemStateChangedEvent] - ThermosRi_SigQ changed from 63 to 65
2019-11-17 21:07:59.806 [vent.ItemStateChangedEvent] - ThermosRi_Temp changed from 23.72 to 23.63
2019-11-17 21:08:54.043 [vent.ItemStateChangedEvent] - ThermosRi_SigQ changed from 65 to 63
2019-11-17 21:08:54.044 [vent.ItemStateChangedEvent] - ThermosRi_PIVal changed from 29 to 34

You need to monitor the MQTT messages. Based on the logs it looks like you send the command to the device, but then the device reports that it’s still heating .

maybe iam to stupid but the mqtt.log is not very helpful because i see the event but not the payload itself

when i send off with MQTT.fx

1574183656: Received PUBLISH from 58bd1a19162a4115beaded47a421cc39 (d0, q0, r0, m0, 'zigbee2mqtt/WoZiLinks/set', ... (21 bytes))
1574183656: Sending PUBLISH to mqttjs_9b2f9ada (d0, q0, r0, m0, 'zigbee2mqtt/WoZiLinks/set', ... (21 bytes))
1574183659: Received PUBLISH from mqttjs_9b2f9ada (d0, q0, r0, m0, 'zigbee2mqtt/WoZiLinks', ... (249 bytes))
1574183659: Sending PUBLISH to 58bd1a19162a4115beaded47a421cc39 (d0, q0, r0, m0, 'zigbee2mqtt/WoZiLinks', ... (249 bytes))
1574183659: Sending PUBLISH to openHAB2Docker (d0, q0, r0, m0, 'zigbee2mqtt/WoZiLinks', ... (249 bytes))
1574183660: Received PUBLISH from 58bd1a19162a4115beaded47a421cc39 (d0, q0, r0, m0, 'zigbee2mqtt/WoZiRehts/set', ... (21 bytes))
1574183660: Sending PUBLISH to mqttjs_9b2f9ada (d0, q0, r0, m0, 'zigbee2mqtt/WoZiRehts/set', ... (21 bytes))
1574183666: Received PUBLISH from mqttjs_9b2f9ada (d0, q0, r0, m0, 'zigbee2mqtt/WoZiRehts', ... (249 bytes))

when i close the contact

1574183694: Received PINGREQ from openHAB2Docker
1574183694: Sending PINGRESP to openHAB2Docker
1574183720: Received PINGREQ from 58bd1a19162a4115beaded47a421cc39
1574183720: Sending PINGRESP to 58bd1a19162a4115beaded47a421cc39
1574183726: Received PINGREQ from mqttjs_9b2f9ada
1574183726: Sending PINGRESP to mqttjs_9b2f9ada
1574183754: Received PINGREQ from openHAB2Docker
1574183754: Sending PINGRESP to openHAB2Docker
1574183780: Received PINGREQ from 58bd1a19162a4115beaded47a421cc39
1574183780: Sending PINGRESP to 58bd1a19162a4115beaded47a421cc39
1574183786: Received PINGREQ from mqttjs_9b2f9ada
1574183786: Sending PINGRESP to mqttjs_9b2f9ada
1574183800: Received PUBLISH from mqttjs_9b2f9ada (d0, q0, r0, m0, 'zigbee2mqtt/WinContacK', ... (62 bytes))
1574183800: Sending PUBLISH to openHAB2Docker (d0, q0, r0, m0, 'zigbee2mqtt/WinContacK', ... (62 bytes))
1574183800: Received PUBLISH from openHAB2Docker (d0, q1, r0, m38, 'zigbee2mqtt/WoZiLinks/set', ... (26 bytes))
1574183800: Sending PUBACK to openHAB2Docker (m38, rc0)
1574183800: Sending PUBLISH to mqttjs_9b2f9ada (d0, q0, r0, m0, 'zigbee2mqtt/WoZiLinks/set', ... (26 bytes))
1574183800: Received PUBLISH from openHAB2Docker (d0, q1, r0, m39, 'zigbee2mqtt/WoZiRehts/set', ... (26 bytes))
1574183800: Sending PUBACK to openHAB2Docker (m39, rc0)
1574183800: Sending PUBLISH to mqttjs_9b2f9ada (d0, q0, r0, m0, 'zigbee2mqtt/WoZiRehts/set', ... (26 bytes))
1574183805: Received PUBLISH from mqttjs_9b2f9ada (d0, q0, r0, m0, 'zigbee2mqtt/WoZiLinks', ... (250 bytes))

when i reopen the contact

1574183694: Received PINGREQ from openHAB2Docker
1574183694: Sending PINGRESP to openHAB2Docker
1574183720: Received PINGREQ from 58bd1a19162a4115beaded47a421cc39
1574183720: Sending PINGRESP to 58bd1a19162a4115beaded47a421cc39
1574183726: Received PINGREQ from mqttjs_9b2f9ada
1574183726: Sending PINGRESP to mqttjs_9b2f9ada
1574183754: Received PINGREQ from openHAB2Docker
1574183754: Sending PINGRESP to openHAB2Docker
1574183780: Received PINGREQ from 58bd1a19162a4115beaded47a421cc39
1574183780: Sending PINGRESP to 58bd1a19162a4115beaded47a421cc39
1574183786: Received PINGREQ from mqttjs_9b2f9ada
1574183786: Sending PINGRESP to mqttjs_9b2f9ada
1574183800: Received PUBLISH from mqttjs_9b2f9ada (d0, q0, r0, m0, 'zigbee2mqtt/WinContacK', ... (62 bytes))
1574183800: Sending PUBLISH to openHAB2Docker (d0, q0, r0, m0, 'zigbee2mqtt/WinContacK', ... (62 bytes))
1574183800: Received PUBLISH from openHAB2Docker (d0, q1, r0, m38, 'zigbee2mqtt/WoZiLinks/set', ... (26 bytes))
1574183800: Sending PUBACK to openHAB2Docker (m38, rc0)
1574183800: Sending PUBLISH to mqttjs_9b2f9ada (d0, q0, r0, m0, 'zigbee2mqtt/WoZiLinks/set', ... (26 bytes))
1574183800: Received PUBLISH from openHAB2Docker (d0, q1, r0, m39, 'zigbee2mqtt/WoZiRehts/set', ... (26 bytes))
1574183800: Sending PUBACK to openHAB2Docker (m39, rc0)
1574183800: Sending PUBLISH to mqttjs_9b2f9ada (d0, q0, r0, m0, 'zigbee2mqtt/WoZiRehts/set', ... (26 bytes))
1574183805: Received PUBLISH from mqttjs_9b2f9ada (d0, q0, r0, m0, 'zigbee2mqtt/WoZiLinks', ... (250 bytes))

I never asked you to look at the mqtt.log. You need to use MQTT.fx or MQTTExplorer or some other tool to see what the messages are being sent and when.