Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove sensor from Node Red should also remove from HA #217

Closed
declanshanaghy opened this issue Feb 7, 2020 · 19 comments
Closed

Remove sensor from Node Red should also remove from HA #217

declanshanaghy opened this issue Feb 7, 2020 · 19 comments

Comments

@declanshanaghy
Copy link

Is your feature request related to a problem? Please describe.
When i deleted a sensor from Node Red it was not deleted from the integration. I created another one with the same name but now there are 2 sensors in the integration and the second one is suffixed with "_2". Hence I now seem to have lost control of the first one.
Describe the solution you'd like
Deleting the sensor from node red should delete it from the integration into HA

Describe alternatives you've considered
After HA restart the first sensor was unavailable so i was able to remove it, this is cumbersome though. HA can take a few minutes to restart

Additional context
The README doesn't provide any insight on the expected behaviour. It also shows controlling a switch, but there is no switch component in the integration only binary/sensor. It would be helpful to document how to setup a switch as shown in the README.

@zachowj
Copy link
Owner

zachowj commented Feb 12, 2020

Yes, sensors and switches should automatically be removed from HA when they are removed from NR, but only if there is a current connection from NR to HA when you deploy those changes.

Documentation is definitely lacking here most of it is in the NR package release notes or in the NR docs. The switches can be created from any of the event nodes, events:all, events:state, trigger:state, and poll state nodes, using the expose Expose to Home Assistant

https://community.home-assistant.io/t/node-red-contrib-home-assistant-websocket/71032/389?u=kermit

@declanshanaghy
Copy link
Author

declanshanaghy commented Mar 3, 2020

To verify entity deletion i made a test switch entity and deployed it. The entity shows up and I can toggle it from HA. I then deleted the entity from the node red flow. The entity then changes to unavailable state. It doesn't get removed. There was a valid connection from NR to HA when I deployed the change with the entity deleted.

See screenshot

Also, I am unable to remove the entity using the UI controls.

@zachowj zachowj transferred this issue from zachowj/hass-node-red Mar 9, 2020
@github-actions
Copy link
Contributor

github-actions bot commented Mar 9, 2020

@declanshanaghy: hello! 👋

This issue is being automatically closed because it does not follow the issue template.

@github-actions github-actions bot closed this as completed Mar 9, 2020
@zachowj
Copy link
Owner

zachowj commented Mar 9, 2020

hmm well, that wasn't supposed to happen.

@Webserve
Copy link

Just updated the plugin in node-red. I have the same problem.
Switch is created successfully. But when i delete the switch the status van de switch is Unavailable in hass.

@zachowj
Copy link
Owner

zachowj commented Mar 10, 2020

What do your HA logs show? Turn on debugging for the component.

custom_components.nodered: debug

@Webserve
Copy link

Webserve commented Mar 11, 2020

no errors from nodered component only. Only the creation of the switch is logged.

hass = 0.106.5
nodered 1.0.4 version 10

`2020-03-11 16:53:11 DEBUG (MainThread) [custom_components.nodered.discovery] Discovery message: {'type': 'nodered/discovery', 'server_id': 'jcodjco', 'node_id': 'eked', 'component': 'switch', 'state': True, 'config': {'name': 'nodetest'}, 'id': 15}

2020-03-11 16:53:11 INFO (MainThread) [custom_components.nodered.discovery] Creating switch blablabla

2020-03-11 16:53:11 INFO (MainThread) [homeassistant.components.switch] Setting up switch.nodered

2020-03-11 16:53:11 INFO (MainThread) [homeassistant.helpers.entity_registry] Registered new switch.nodered entity: switch.nodetest_2`

@zachowj
Copy link
Owner

zachowj commented Mar 13, 2020

@Webserve What is your deploy mode set to? Full, Modified Flows or Nodes

@Webserve
Copy link

Full.

Sorry for the late answer. Something with corona...

@adamoutler
Copy link

I'm having the same problem. I delete an entity and it stays around. It really sucks because my entity is named with random characters I typed on the keyboard for testing. I didn't know an entity node would be permanent. I would expect the nodered integration to automatically delete items when they are deleted in node-red container.

@enwi
Copy link

enwi commented Oct 24, 2020

Same for me on HA supervised (Home Assistant 0.116.4, Supervisor 249) and hass-node-red (v0.4.4)

@enwi
Copy link

enwi commented Oct 24, 2020

I just figured out that if you restart HA after you deleted the entities in Node-Red you can delete the now as recovered marked entities from HA

@ljmerza
Copy link

ljmerza commented Feb 28, 2021

so the solution is to restart home assistant? there's no way to delete unused entities from nodered without restart?

@enwi
Copy link

enwi commented Mar 10, 2021

I could not find a different solution so far

@Steveo94
Copy link

I am having the same issue. A restart did not work.

@twobeass
Copy link

twobeass commented Oct 2, 2024

still no solution for this ?

@zachowj
Copy link
Owner

zachowj commented Oct 3, 2024

@twobeass create a new issue

@Jhonyboy72
Copy link

Jhonyboy72 commented Oct 29, 2024

Same here. Cant delete unused entity

@declanshanaghy
Copy link
Author

And now both issues are closed. This one because a 2nd was created. And the 2nd because of no activity.

Please re-open

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants