gluap / pyduofern-hacs

Repository managing hacs-integration for pyduofern
MIT License
27 stars 8 forks source link

Service "clean_config" not documented #34

Closed bcutter closed 1 year ago

bcutter commented 1 year ago

I am wondering what the service clean_config actually does. It calls stick.clean_config but no idea what that function actually does.

Let's just put it in https://github.com/gluap/pyduofern-hacs#usage as the other services are too.

I started to see some "ghost covers/devices" after using service: duofern.sync_devices at 2023-03-24 (and corresponding new entities and devices as updated to 0.5.3 today) and was wondering if that service could remove them.

gluap commented 1 year ago

I added documentation with 0.5.5. (in the service description) It should do what you think:

the duofern python module keeps a list of devices that are paired. clean_config throws that list away.

In normal operation, the list should rebuild itself - whenever a message is received from a device that was previously paired it should appear in the list.

Warning You should absolutely NOT use it if you have been running duofern for a long time and your covers have "human" names in the .duofern.json file. That option hasn't been used for a long time though - it is still from the time when homeassistant had no UI way of renaming entities/devices.

It's not very well tested because it's not a common situation. I ran it, restarted homeassistant, and my devices became available again after a few seconds.

bcutter commented 1 year ago

OK, that warning is helpful. Indeed I gave all my covers (entities and now also devices) custom names... I'm not happy having to rename all of them again. But as a last option if 0.5.5 does not work around the ask_for_update with all: true issue or other things appear, I now know this service can be used - so it does exactly what it's name says 😃

Update: read it twice. I was talking about the entity registry, the warning aims at duofern.json. In that file I never changed anything. Still wondering, why it has almost 400 lines with soooooooo many devices actually not existing.

I tend to close this issue for the initial documentation cause, but still not confident enough using that service... -.-

bcutter commented 1 year ago

Update: ran the service. The only thing it changed (prior to restarting HA) was:

it wiped the "system_code" section at the EOF out of it, the curious long "devices" array/list is unchanged.


Update after HA restart (before that I put the system_code section back in, just to be safe): nothing changed. The crazy long devices list is created by duoFERN (stick or software?). Still can not get rid of my ghost devices, at least not by using the duofern.clean_config service.

bcutter commented 1 year ago

See https://github.com/gluap/pyduofern-hacs/issues/36 for following up on the ghost devices issue.

This issue is "fixed" as the docs have been updated regarding the clean_config service so let's close this one.