#Restore removed entity or allow correct removal.

1 messages · Page 1 of 1 (latest)

echo ether
#

I'm using HAOS and zigbee2mqtt. I added a light strip which worked great. Unfortunately I accidentally deleted the 'state' which is exposed to HA. I can turn off and on the light from zigbee2mqtt no problem.
I have tried to delete the device, restart HA entirely, and then re-add the device, but the 'state' never gets added.
Does some one know how to achieve this, it seems a bit silly that it doesn't seem possible to resolve this simply, perhaps I should report it as a bug.
The only two options I have unless someone comes up with a solution, are to completely wipe HA and start again, or purchase another light (different mac address).
My last backup was before I added a lot of items and I'm reluctant (and to be frank I shouldn't have to resort for such a simple task).
Thanks in advance.

median gust
#

What exactly do you mean by "deleted the state"?

rare aspen
#

You deleted it within z2m?

echo ether
#

No I deleted the entity within HA

#

I have tried removing it from Z2M and re-adding to no avail

#

Here should have the state, but now even after adding the device it does not add the state.

rare aspen
#

What happens if you click on "+1 entity not shown"?

echo ether
#

I've checked through .storage/core.device_registry to see if I can see it in the deleted section but I cant find it.

rare aspen
#

That's... Very strange

#

Can you see it in mqtt explorer?

echo ether
#

ahh I see it in .storage/core.entity_registry under deleted
Yes I see it's state being published there

#

I've amended the entry in core.entity_registry, removed it from z2m, and rebooting HA now. Hopefully it comes back up!
Then I'll try adding again.

rare aspen
#

Good luck!

echo ether
#

Nope. I'm out of ideas. There should be something in HomeAssistant where you can purge deleted items. It isn't right that once you delete something you can never ever use that device again.

median gust
#

I mean what you're describing is not really the way HA is supposed to work.

#

I'm not quite sure I understand how you got here because you cannot delete an entity that is being provided by an integration, the delete should be disabled.

#

Make sure you also try restarting z2m, it may need to resend the discovery packets.

tender copper
#

if the device is visible in z2m, what happens if you change its name? does that maybe trigger something in the integration?

echo ether
#

I've restarted the entire server along with everything on it 🙂
I've tried many times changing it's name too, hoping that would trigger it to re-add.

#

I renamed it via the integration (zigbee2mqtt)

#

When I re-add in z2m it adds the device with all the other entities, like power-on-behaviour etc

median gust
#

If it doesn't work you can try open an MQTT issue. Try to get debug logs including what discovery packets are sent when z2m starts up.
The discovery packets should tell HA what entities need to be created.

echo ether
#

I think it is creating it, but it's like it's on it's "ignore list" or something.

median gust
#

I'm not sure there is such a thing.

#

Could just be a bug

echo ether
#

I didn't think so until I discovered a deleted-items section within the config/.storage files

median gust
#

So it keeps the same unique_id

echo ether
#

I would like it not to do that, as that is probably the issue here

median gust
#

Well you said even without that record it still doesn't work.

echo ether
#

I can't edit those files while HAOS is not running, as I then can't get to them 🙂

median gust
#

Well I suggest that an MQTT integration issue in HA core is the best chance you have to get connected to somebody who can deep dive and figure this out.

#

But you'll have to do some of the work to get the appropriate logs and such.

echo ether
#

I'll try to get a log of zigbee starting up, I have a lot of devices

#

Yeah z2m publishes the required entities:
z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/0x90ab96fffe2853ba', payload '{"color_mode":"xy","color_options":null,"linkquality":144,"power_on_behavior":null,"state":"ON","update":{"installed_version":16842768,"latest_version":16842768,"state":"idle"},"update_available":false}'
I should post on the Home Assistant forum?