I have an entity (heat pump status)

I have an entity (heat pump status) that switches "on"off"hwc"
I need to make it turn on for me only when it switches from "off to hwc" or from "off to on", not from "hwc to on" or "on to hwc".
Now I have it like this, but it switches for me depending on which variant is switched on and not what it is switched from.
Below in the attachment is what I want to achieve. This is how I do it in HA.

[{"id":"35ec9f061d204c93","type":"tab","label":"Flow 1","disabled":false,"info":"","env":[]},{"id":"13ca4d4e3b1b77d2","type":"group","z":"35ec9f061d204c93","name":"Odmrazování","style":{"fill":"#3f3f3f","label":true,"color":"#bfbfbf"},"nodes":["d38a8641b14cad79","5f2259d1e3d424b2","b1b79c95d8ba264d","db26b61e1de2762e","5438415f78a69d63","44614fcde780393f","bb5b2ab93421437c","b69ce32c1ac61c8d","a21b95738d2134d4","a223bae68e510617","3f6fc09706236aa6","e639b11297b575a5","ecd1f55c7efc0da0","3e2252e93f18ac84","a916a6e6d5b3c0f7","01d0399cab79118b","e36fd8199f9188ee"],"x":34,"y":119,"w":1012,"h":362},{"id":"d38a8641b14cad79","type":"api-current-state","z":"35ec9f061d204c93","g":"13ca4d4e3b1b77d2","name":"Teplota pod 2 st","server":"c3890858.1f2358","version":3,"outputs":2,"halt_if":"2","halt_if_type":"num","halt_if_compare":"lt","entity_id":"sensor.weather_station_outdoor_module_teplota","state_type":"num","blockInputOverrides":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":440,"y":160,"wires":[["5f2259d1e3d424b2"],[]]},{"id":"5f2259d1e3d424b2","type":"api-call-service","z":"35ec9f061d204c93","g":"13ca4d4e3b1b77d2","name":"Kouřza","server":"c3890858.1f2358","version":7,"debugenabled":false,"action":"automation.turn_on","floorId":[],"areaId":[],"deviceId":[],"entityId":["automation.kourza"],"labelId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","blockInputOverrides":true,"domain":"automation","service":"turn_on","x":620,"y":160,"wires":[["b1b79c95d8ba264d"]]},{"id":"b1b79c95d8ba264d","type":"delay","z":"35ec9f061d204c93","g":"13ca4d4e3b1b77d2","name":"","pauseType":"delay","timeout":"500","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":790,"y":160,"wires":[["db26b61e1de2762e"]]},{"id":"db26b61e1de2762e","type":"api-call-service","z":"35ec9f061d204c93","g":"13ca4d4e3b1b77d2","name":"Kouřza1","server":"c3890858.1f2358","version":7,"debugenabled":false,"action":"automation.turn_on","floorId":[],"areaId":[],"deviceId":[],"entityId":["automation.kourza1"],"labelId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","blockInputOverrides":true,"domain":"automation","service":"turn_on","x":960,"y":160,"wires":[["5438415f78a69d63"]]},{"id":"5438415f78a69d63","type":"delay","z":"35ec9f061d204c93","g":"13ca4d4e3b1b77d2","name":"","pauseType":"delay","timeout":"500","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":450,"y":240,"wires":[["44614fcde780393f"]]},{"id":"44614fcde780393f","type":"api-call-service","z":"35ec9f061d204c93","g":"13ca4d4e3b1b77d2","name":"Kouřza","server":"c3890858.1f2358","version":7,"debugenabled":false,"action":"automation.turn_off","floorId":[],"areaId":[],"deviceId":[],"entityId":["automation.kourza"],"labelId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","blockInputOverrides":true,"domain":"automation","service":"turn_off","x":620,"y":240,"wires":[["b69ce32c1ac61c8d"]]},{"id":"bb5b2ab93421437c","type":"api-call-service","z":"35ec9f061d204c93","g":"13ca4d4e3b1b77d2","name":"Kouřza1","server":"c3890858.1f2358","version":7,"debugenabled":false,"action":"automation.turn_off","floorId":[],"areaId":[],"deviceId":[],"entityId":["automation.kourza1"],"labelId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","blockInputOverrides":true,"domain":"automation","service":"turn_off","x":960,"y":240,"wires":[["a21b95738d2134d4"]]},{"id":"b69ce32c1ac61c8d","type":"delay","z":"35ec9f061d204c93","g":"13ca4d4e3b1b77d2","name":"","pauseType":"delay","timeout":"500","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":790,"y":240,"wires":[["bb5b2ab93421437c"]]},{"id":"a21b95738d2134d4","type":"delay","z":"35ec9f061d204c93","g":"13ca4d4e3b1b77d2","name":"","pauseType":"delay","timeout":"500","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":450,"y":320,"wires":[["ecd1f55c7efc0da0"]]},{"id":"a223bae68e510617","type":"api-call-service","z":"35ec9f061d204c93","g":"13ca4d4e3b1b77d2","name":"Kouřpřed","server":"c3890858.1f2358","version":7,"debugenabled":false,"action":"automation.turn_on","floorId":[],"areaId":[],"deviceId":[],"entityId":["automation.kourpred"],"labelId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","blockInputOverrides":true,"domain":"automation","service":"turn_on","x":520,"y":440,"wires":[["e639b11297b575a5"]]},{"id":"3f6fc09706236aa6","type":"api-call-service","z":"35ec9f061d204c93","g":"13ca4d4e3b1b77d2","name":"Kouřpred","server":"c3890858.1f2358","version":7,"debugenabled":false,"action":"automation.turn_off","floorId":[],"areaId":[],"deviceId":[],"entityId":["automation.kourpred"],"labelId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","blockInputOverrides":true,"domain":"automation","service":"turn_off","x":860,"y":440,"wires":[[]]},{"id":"e639b11297b575a5","type":"delay","z":"35ec9f061d204c93","g":"13ca4d4e3b1b77d2","name":"","pauseType":"delay","timeout":"10","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":700,"y":440,"wires":[["3f6fc09706236aa6"]]},{"id":"ecd1f55c7efc0da0","type":"api-current-state","z":"35ec9f061d204c93","g":"13ca4d4e3b1b77d2","name":"off","server":"c3890858.1f2358","version":3,"outputs":2,"halt_if":"off","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.ebusd_hmu_status01_pumpstate","state_type":"str","blockInputOverrides":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"","forType":"num","forUnits":"seconds","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":250,"y":160,"wires":[["d38a8641b14cad79"],[]]},{"id":"3e2252e93f18ac84","type":"api-current-state","z":"35ec9f061d204c93","g":"13ca4d4e3b1b77d2","name":"on","server":"c3890858.1f2358","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.ebusd_hmu_status01_pumpstate","state_type":"str","blockInputOverrides":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"","forType":"num","forUnits":"seconds","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":250,"y":220,"wires":[["01d0399cab79118b"],[]]},{"id":"a916a6e6d5b3c0f7","type":"api-current-state","z":"35ec9f061d204c93","g":"13ca4d4e3b1b77d2","name":"hwc","server":"c3890858.1f2358","version":3,"outputs":2,"halt_if":"hwc","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.ebusd_hmu_status01_pumpstate","state_type":"str","blockInputOverrides":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":250,"y":280,"wires":[["01d0399cab79118b"],[]]},{"id":"01d0399cab79118b","type":"api-current-state","z":"35ec9f061d204c93","g":"13ca4d4e3b1b77d2","name":"Teplota pod 2 st","server":"c3890858.1f2358","version":3,"outputs":2,"halt_if":"2","halt_if_type":"num","halt_if_compare":"lt","entity_id":"sensor.weather_station_outdoor_module_teplota","state_type":"num","blockInputOverrides":true,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":340,"y":440,"wires":[["a223bae68e510617"],[]]},{"id":"e36fd8199f9188ee","type":"server-state-changed","z":"35ec9f061d204c93","g":"13ca4d4e3b1b77d2","name":"test","server":"c3890858.1f2358","version":6,"outputs":1,"exposeAsEntityConfig":"","entities":{"entity":["sensor.ebusd_hmu_status01_pumpstate"],"substring":[],"regex":[]},"outputInitially":false,"stateType":"str","ifState":"","ifStateType":"str","ifStateOperator":"is","outputOnlyOnStateChange":true,"for":"","forType":"num","forUnits":"seconds","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":110,"y":220,"wires":[["ecd1f55c7efc0da0","a916a6e6d5b3c0f7","3e2252e93f18ac84"]]},{"id":"c3890858.1f2358","type":"server","name":"Home Assistant","addon":true}]

Welcome to the forums @Honzik1234

You're better off seeking guidance from the HA community - all your Nodes are for HA - and many here don't use it.

If, however, you want to skip using HA altogether - then please let us know what APIs your device is using (such as http APIs), as well a link to the device, and how it can be controlled.

Then, we may be able to guide you.

Alternatively show us what the incoming message looks like and tell is what outgoing message you want for the various switch sequences.

Rather than sending the event state node to current state nodes use a switch.

image

[{"id":"7963479be0ee30ce","type":"server-state-changed","z":"35ec9f061d204c93","name":"test","server":"6b1110b5.183a4","version":6,"outputs":1,"exposeAsEntityConfig":"","entities":{"entity":["sensor.ebusd_hmu_status01_pumpstate"],"substring":[],"regex":[]},"outputInitially":false,"stateType":"str","ifState":"","ifStateType":"str","ifStateOperator":"is","outputOnlyOnStateChange":true,"for":"","forType":"num","forUnits":"seconds","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":150,"y":660,"wires":[["f813368e878a82c8"]]},{"id":"f813368e878a82c8","type":"switch","z":"35ec9f061d204c93","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"on","vt":"str"},{"t":"eq","v":"off","vt":"str"},{"t":"eq","v":"hwc","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":300,"y":660,"wires":[[],[],[]]},{"id":"6b1110b5.183a4","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"id","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]

or use a trigger state node's custom outputs

The lower 3 outputs correspond to the rules in the custom output section.

[{"id":"b58780ddd8f16ba3","type":"trigger-state","z":"35ec9f061d204c93","name":"","server":"6b1110b5.183a4","version":5,"inputs":0,"outputs":5,"exposeAsEntityConfig":"","entities":{"entity":["sensor.ebusd_hmu_status01_pumpstate"],"substring":[],"regex":[]},"debugEnabled":false,"constraints":[],"customOutputs":[{"messageType":"default","messageValue":"","messageValueType":"json","comparatorPropertyType":"current_state","comparatorPropertyValue":"new_state.state","comparatorType":"is","comparatorValue":"on","comparatorValueDataType":"str"},{"messageType":"default","messageValue":"","messageValueType":"json","comparatorPropertyType":"current_state","comparatorPropertyValue":"new_state.state","comparatorType":"is","comparatorValue":"off","comparatorValueDataType":"str"},{"messageType":"default","messageValue":"","messageValueType":"json","comparatorPropertyType":"current_state","comparatorPropertyValue":"new_state.state","comparatorType":"is","comparatorValue":"hwc","comparatorValueDataType":"str"}],"outputInitially":false,"stateType":"str","enableInput":false,"x":300,"y":780,"wires":[[],[],[],[],[]]},{"id":"6b1110b5.183a4","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30","areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"id","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]