Help merging 2 Node Red flows in 1

It happens, even to the best :slight_smile: (as we say in my home language)

Just upgraded to 0.29.0. The api call is fixed.
However (except if I messed up something) the “entity” node doesn’t seem to work any more. I am trying to create new entities. I can see the “Registered”. However, I can’t see it in the entities in HA. And I can’t (eg) toggle a newly created switch…

Here is a quick and dirty example that used to work…

[{"id":"123ae7c0.58ab28","type":"ha-entity","z":"c07c0ac5.ca6f98","name":"","server":"","version":1,"debugenabled":false,"outputs":2,"entityType":"switch","config":[{"property":"name","value":"try_me"},{"property":"device_class","value":""},{"property":"icon","value":""},{"property":"unit_of_measurement","value":""}],"state":"payload","stateType":"msg","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","x":450,"y":3000,"wires":[["e69a1437.7ee568"],["d0e0f784.4c23c8"]]},{"id":"e69a1437.7ee568","type":"debug","z":"c07c0ac5.ca6f98","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":650,"y":2980,"wires":[]},{"id":"d0e0f784.4c23c8","type":"debug","z":"c07c0ac5.ca6f98","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":650,"y":3040,"wires":[]},{"id":"6650a40f.6491dc","type":"inject","z":"c07c0ac5.ca6f98","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":440,"y":3100,"wires":[["d1ffd336.875a1"]]},{"id":"d1ffd336.875a1","type":"api-call-service","z":"c07c0ac5.ca6f98","name":"","server":"","version":1,"debugenabled":false,"service_domain":"switch","service":"toggle","entityId":"switch.try_me","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":640,"y":3100,"wires":[[]]}]

Nothing happens when I toggle the (supposedly) newly created switch.

For me it is working as intended. the switch goes from on to off. entity nodes of type switch don’t output anything on state change, change in the new future. If you want to have the node output you need to use the nodered.trigger service.

Still no luck with:

[{"id":"123ae7c0.58ab28","type":"ha-entity","z":"c07c0ac5.ca6f98","name":"","server":"","version":1,"debugenabled":false,"outputs":2,"entityType":"switch","config":[{"property":"name","value":"myswitch"},{"property":"device_class","value":""},{"property":"icon","value":""},{"property":"unit_of_measurement","value":""}],"state":"payload","stateType":"msg","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","x":450,"y":3000,"wires":[["e69a1437.7ee568"],["d0e0f784.4c23c8"]]},{"id":"e69a1437.7ee568","type":"debug","z":"c07c0ac5.ca6f98","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":650,"y":2980,"wires":[]},{"id":"d0e0f784.4c23c8","type":"debug","z":"c07c0ac5.ca6f98","name":"","active":true,"tosidebar":true,"console":false,"tostatus":true,"complete":"true","targetType":"full","statusVal":"payload","statusType":"auto","x":650,"y":3040,"wires":[]},{"id":"6650a40f.6491dc","type":"inject","z":"c07c0ac5.ca6f98","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":440,"y":3100,"wires":[["d1ffd336.875a1"]]},{"id":"d1ffd336.875a1","type":"api-call-service","z":"c07c0ac5.ca6f98","name":"","server":"","version":1,"debugenabled":false,"service_domain":"nodered","service":"trigger","entityId":"switch.myswitch","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":650,"y":3100,"wires":[[]]},{"id":"88ff17c.f14c9e8","type":"api-current-state","z":"c07c0ac5.ca6f98","name":"","server":"","version":1,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","override_topic":false,"entity_id":"switch.myswitch","state_type":"str","state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","blockInputOverrides":false,"x":650,"y":3200,"wires":[["709bbe9f.a2274"]]},{"id":"c225acb5.9700e","type":"inject","z":"c07c0ac5.ca6f98","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":410,"y":3200,"wires":[["88ff17c.f14c9e8"]]},{"id":"709bbe9f.a2274","type":"debug","z":"c07c0ac5.ca6f98","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":910,"y":3200,"wires":[]}]

The current_state (last flow) gives me:

"Entity could not be found in cache for entity_id: switch.myswitch"

check under the NR integrations dashboard in HA and see what entities have been created by NR

The switch “myswitch” (my last example) is not there…
Even if on deploy is say “Registered”.
And thanks for your replies :slight_smile:

try turning on debuggin in HA for the custom integration and see if it shows creating a sensor.

logger:
  logs:
    custom_components.nodered: debug
2021-01-02 10:02:30 DEBUG (MainThread) [custom_components.nodered.discovery] Discovery message: {'type': 'nodered/discovery', 'server_id': 'd28c9492.f419c8', 'node_id': '123ae7c0.58ab28', 'component': 'switch', 'state': True, 'config': {'name': 'myswitch'}, 'id': 22}
2021-01-02 10:02:30 INFO (MainThread) [custom_components.nodered.discovery] Updating switch d28c9492.f419c8 123ae7c0.58ab28

So “myswitch” is there… However in the entities created by nodered, it is not here.

And then if I try to toggle it:

2021-01-02 10:06:50 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities switch.myswitch

Not good either.

Thanks for providing these examples. Just found some time to deploy them and they both seem to be working right off the bat for me. What would be the benefit of one of your examples over the other?