I have repeated a pattern like the above because I want to trigger a message with latest value of a Sensor either when the state of the sensor changes or, because of some other trigger.
It would be nice if there were a combined node that could be used instead to this two.
What other trigger?
It looks like the other trigger does not change the “Temp Wohnzimmer” then.
If the other trigger is actually changing the “Temp Wohnzimmer” then the first node should catch it. Put a debug node on it and make sure that it is set to catch the entire message to see if you do not actually get the wanted info already from that node.
The other trigger won’t change the temp but the following flow should get triggered with the current temperature either if the sensor’s state has changed or if the other trigger sends a message.
|in|--------\__
|in|-|get|-/
or align the first in with the end of the get
or:
|in|-\_|get|
|in|-/
if your flow is really long, you can have “link out” and “link in” nodes to loop back at the left side of the screen if you don’t want to do a normal connection loopback.
I thought it may be nice if the Event State node had an external input trigger for such situations
Both nodes get the current state into payload, so it’s not clear to me why you want to get it again for a state change. The “events: state” node just needs to link to the node after the “current state”. Then you use msg.payload
regardless of whether it came from one or the other node. If you’re wanting to pick up other attributes in subsequent nodes, you can just use msg.data.new_state
if it exists, or msg.data
if not.