Flow State Change Check

Hi, New user here.
I have set-up my first flow to control a tuya based fan that has been flashed with tasmota.

I have a flow that checks the fan state ie if I use the buttons on the fan to change the speed, it reports back to via mqtt to node red then Home assistant.

Another flow that can adjust the fan state based on the input/outputs from home assistant sent via node red/mqtt.

The issue im having is that when I change say the fan speed with the button on the fan, it updates the status of the fan in home assistant but due to the state change in home assistant it then sends out the command back to the fan to say the new speed which is actually the current speed that I set via the button... looking for some help/advice on how I can stop this from happening.

Hello
You could save the fan state coming over mqtt to a flow context variable and than check incoming commands from home assistant in a switch node against that saved state and only let them through to be send on to the fan if they differ.
You could also think about a different approach. Connect the fan directly to home assistant over mqtt as a entity and do all the logic from nodered via home assistant. So fan -> ha -> nodered and vice versa nodered -> ha -> fan so that home assistant acts as the event bus and state keeper as this is what it was designed to do and nodered and the fan never communicate directly in that scenario.
Johannes

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.