zachowj / hass-node-red

Companion Component for node-red-contrib-home-assistant-websocket to help integrate Node-RED with Home Assistant Core
MIT License
443 stars 180 forks source link

Entity customised areas setting is not retained. #199

Closed sotatech closed 9 months ago

sotatech commented 11 months ago

Version of the custom_component

2.0.0

Home Assistant 2023.7.2

Configuration

Add your logs here.

Describe the bug

I have a Cytech alarm system connect to HA via the Node-RED companion. One device is configured for the zones, so it contains binary sensors for every zone. In HA settings for each entity I turn off the option for the entity to use the device area, and set each one according to their location. If I make a change to the flow and deploy it, the area setting for the entity is reset to the default. I have used this feature with other integrations, and the setting is retained.

Debug log


Logs attached.
[home-assistant_nodered_2023-07-17T08-26-38.078Z.log](https://github.com/zachowj/hass-node-red/files/12067417/home-assistant_nodered_2023-07-17T08-26-38.078Z.log)
sotatech commented 11 months ago

home-assistant_nodered_2023-07-17T08-26-38.078Z.log

zachowj commented 11 months ago

2023-07-17 09:26:10.884 INFO (MainThread) [custom_components.nodered] Entity removed: switch.comfort_output_001

At this point in the log, do recall what action is being taken in NR? The entity should only be removed from HA if you deleted the entity config and deployed.

zachowj commented 11 months ago

Did you remove the custom component, then re-add it?

sotatech commented 11 months ago

I think I did a deploy in NR and a reload of the integration at that point, after setting the custom area on some of the entities in HA as a test. This was to check if the changed setting would survive. I didn't remove anything.

sotatech commented 11 months ago

I notice that when I do a reload of the integration, I get a lot of errors about the platform not generating unique IDs:

2023-07-19 10:40:02.585 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform nodered does not generate unique IDs. ID nodered-77e1e680.210de8-041bf28f19b9896a already exists - ignoring binary_sensor.shed_smoke_detector 2023-07-19 10:40:02.586 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform nodered does not generate unique IDs. ID nodered-77e1e680.210de8-041bf28f19b9896a already exists - ignoring binary_sensor.shed_smoke_detector 2023-07-19 10:40:02.587 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform nodered does not generate unique IDs. ID nodered-77e1e680.210de8-041bf28f19b9896a already exists - ignoring binary_sensor.shed_smoke_detector 2023-07-19 10:40:02.587 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform nodered does not generate unique IDs. ID nodered-77e1e680.210de8-4198d5c696950595 already exists - ignoring binary_sensor.utility_room_pir_sensor

sotatech commented 11 months ago

I did some more testing and I found that by clearing the area setting for the device, I could then customise the area for each entity and it would be retained through a reload or restart of HA. So it would appear that the integration is assuming that all entites associated with a device will have the same area.

github-actions[bot] commented 9 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.