Two turn-ons, one worked, one didn't, just vanished (repeatedly)

I’m drawing a real blank on this. I have a fairly complicated set of logic to control a fan based on humidity and such, and it works perfectly. I added a second fan to it directly driven after turning on the first.

The first turn on works, the second does not.

Not only have I checked the name and service, I put an inject into the second, and when I click the inject, it works fine also.

But consistently, time after time, when node red is running by itself, the first fan (left) turns on, then the second does not. And note – the caption says it did. There’s no error that I can find in any log I have looked at (maybe not looking in the right place). The Logbook in HA does show the first coming on, but does NOT show the second on or off, just nothing. So it looks like it’s getting lost between node red and HA. In particular it’s not just that the fan does not turn on (e.g. wifi issues), but HA does not THINK it turned on either.

The first fan is a Lutron Caseta Pro integration, the second is a wifi MQTT; but again, the second works alone (e.g. from HA) and also from Node Red with an inject. Further, in a separate sequence, the MQTT fan also works to turn off (after a timer expires).

Any thoughts as to what could be going on?

Or more to the point perhaps – how would you go about finding out what is going on, since it THINKS it worked.

Linwood

PS. Latest released, Node Red 9.1.4, HA 2021.06.6

Is there there a service call fan.turn_on it does not show in my dev tools. Perhaps it’s particular to the lutron integration.

Never the less the if a fans control is mqtt, then you should be publishing the on/off command for that particular fan. Using mqtt.publish and not a turn_on service call.

You should export and post your flows as it makes it much harder to understand what is happening.

If you turn on debugging for the second call-service node you’ll probably find that it is actually turning on the first fan again.

In the first call-service node remove the output to msg.payload

Yes, and the fan.turn_on service does work for the MQTT fan through home assistant.

I did this again, putting an inject on the “Turn on fan” and an inject on the “Also turn on toilet fan”, with debug on. Please see this diagram.

If I use the left/bottom inject, the “Turn fan on” fires, and works, and I see the debug output (top right) for “Fan turned auto-on”. I do NOT see the “Toilet fan turned on” debug, despite the caption on the associated serivice call showing it was called – it is as though it never marks out thru it.

On the other hand, if I use the second inject directly into the “Also turn on toilet fan”, the fan does turn on, and the “Toilet fan turned on” does appear.

There are no associated errors in the HA log or the Node Red log, and no error indication in the debug pane. It’s as though it enters the “Also turn on toilet fan” but dies in there somehow.

I did find that I could fix this by splitting the output of “Set auto-on” to go to the two service calls simultaneously rather than sequentially. In that case, both fans turn on fine. So I have a workable solution, I simply do not understand it.

I think I know how to export the flow, but since (I think) it has credentials in it for home assistant, I am unsure how to safely do so. Are there instructions somewhere?

But… at this point what I know is the node works in isolation (from inject) or fed from the edit node “Set auto_on”, it only fails (silently) when fed from the “Turn on fan”… does that give any clues as to how I can debug it?

I really don’t think this is a Node Red logic error in the flow – this part of it is just too simple. I think something is broken. But I don’t know how to confirm that.

Here’s the working section. Note no changes are being made to the service nodes other than where they flow from, and the payload is not used at all, everything is just hard coded with a blank “data” item, otherwise I would suspect it is an issue in the payload. but I’m ignoring it.

What content is shown by the top-right debug node (the one connected to output of “turn on fan”).
It’s interesting what it outputs in case “toilet”node is not activated.
Then you can copy this whole message and inject it to “toilet” node trying to see what happens

This, I’m with Kermit

Read the documentation of the call service node

Dang, I sure failed to read the documentation well. That explains it. I set the output of the first to “none” and it started working correctly.

I assumed (obviously wrongly) that config values overrode payload. Sigh.

Thank you very much @obaldius you hit it perfectly. Wish there was a prize. :slight_smile:

1 Like