I have four complex node red flows and four basic node red flows working OK. I have node red companion installed and use three switch entities I created in lovelace UI. These have been working well for months. I now want to us entities to store battery levels and avoid them reporting “Unavailable”. I have created a flow to do this with two batteries so far, going into settings/entities to view them they need enabling. After this they work when selected as the source in a lovelace tab with battery status entity in.
My problems start at the enabling, as the previous node red companion entities now duplicate with a suffix 2 in the entity ID and corrupt the originals, so that they report as not have a unique ID any more. This stops the previous switch entities working and they appear greyed out in lovelace UI.
Each time this happens I have to restore a backup and start again, but the same thing occurs each time. I have screen shots of the entities as below, the first is the original entity listing, and the second the result after enabling the lounge on off switch battery entity.
I have seen this behavior before, that is why an unused entity is seen at the top, that I can’t manage to delete. This entity ID behaviour occurs each time I restore and try again to get the battery function working again. This also happened before I updated the hardware and software and so this type of corruption is not new.
The behavior you experience with new sensors I believe is not the default. On the companion integration page, 3 dot menu on right, system options. Is enable new entities switched on?
Enable new Entities was switched off in the integration, so I have switched it on to retest the addition of these Node Red Companion Entities. Will advise if it works shortly.
In order to get everything working OK, I backed up several flows in Node Red that used Node Red Companion entities, deleted these flows, then deleted all the Node Red Companion entities. Following this I removed the Node Red Companion integration, restarted HA, then re-installed Node Red Companion. I then made sure to check in system settings that the integration was set to enable new created entities.
Next I imported the four Node Red flows without the HA element. Bingo it all works well after this and there is no corruption of the Node Red Companion entities any more.
It strikes me that there should not be an option to not enable new entities in the Node Red Companion system settings, as it appears to lead to potential corruption problems as outlined at the begining of this post.
I hope this helps anyone who uses entities in Node Red Companion.
My creation of battery level sensors in a Node Red flow, using an event state node and sensor node for each battery in question, has now allowed for me to eliminate reporting of Unavailable in the UI for battery powered switches and sensors where the battery level update only happens every four hours. The event state node is set to only pass numerical values <= 100 to the sensor node, which is then used in place of the original device battery entityID for the Entity Card in Lovelace UI.
Those settings are HA boiler plate requirements for any integration that provides entities. I’m sure it’s a bug that needs to be squashed. Since it is on by default, it’s probably on the back burner. Unfortunately yours got switched off for some reason.