Odianosen25 / Monitor-App

Appdaemon App for Andrew's Monitor Presence Detection System
74 stars 9 forks source link

Error 405 with remove_known_device #62

Open tongaimaramba opened 3 years ago

tongaimaramba commented 3 years ago

Hi there, I'd appreciate some guidance on troubleshooting the following: I'm calling the service self.call_service("monitor/remove_known_device", device="xx:xx:xx:xx:xx:xx", namespace=mqtt) and see in logs: DEBUG home_presence_app: call_service: mqtt/publish, {'topic': 'monitor/setup/DELETE STATIC DEVICE', 'payload': 'my mac address'} DEBUG home_presence_app: monitor/setup/DELETE STATIC DEVICE payload: my mac address

But the entities are not deleted in Hass and in the Appdaemon log I see: WARNING HASS: Error Removing Home Assistant entity sensor.monitor_xyz_conf WARNING HASS: Code: 405, error: 405: Method Not Allowed

Appreciate any tips for how to solve this.

Thanks!

Odianosen25 commented 3 years ago

Hello @tongaimaramba,

What version of HA are you using, and is it a new error?

Regards

tongaimaramba commented 3 years ago

Hi! This is the first time I was trying out the remove device service.

Note: i've been able to successfully call "add static device" to create new entities, its just removing them that is a problem.

System versions are as below: Hass v0.115.2 HassOS v4.12 Supervisor v245 Appdaemon 4 v0.3.0 Python v3.8.5

Thanks again!

Odianosen25 commented 3 years ago

Hello @tongaimaramba,

Hmmm in the latest version, once you remove the device from the config, it should auto delete the device. Now if its not working, possible something had changed in the latest HA, which unfortunately I don't use.

Remove the device, see if it goes out. And if it doesn't well until I upgrade which I honestly wouldn't do anytime soon, am afraid I will have to attend to it later.

Regards

tongaimaramba commented 3 years ago

OK no problem @Odianosen25, thanks for looking into it.

If you think of any logging or tracing I could try, please let me know, otherwise I'll wait to hear how things look when you upgrade.

By the way I've also found that the entities do disappear after I do a system restart (reboot of the host system, not just a Hass restart). Any clues there?

Thanks

omayhemo commented 3 years ago

I have this same problem, old entities from a previously renamed monitor 'location' are not getting deleted and I get the 405 error. Latest version of Supervised on Linux.

arch x86_64
chassis desktop
dev false
docker true
docker_version 19.03.8
hassio true
host_os Ubuntu 18.04.4 LTS
installation_type Home Assistant Supervised
os_name Linux
os_version 4.15.0-118-generic
python_version 3.8.5
supervisor 245
timezone America/Chicago
version 0.115.2
virtualenv false
Odianosen25 commented 3 years ago

@omayhemo,

Hmmm I don't know if I allowed for the cleaning of old devices based on the fact a node's location was changed. Will need to add that to my todo list.

Regards

omayhemo commented 3 years ago

It's definitely trying to clean them out. It's just failing with the 405 error. I'm less familiar with the appdaemon api (ad.ADBase) work than I am directly working with the HASS API.

omayhemo commented 3 years ago

Is there a manual way to remove them, I can't find them in known devices or in the entities config

Odianosen25 commented 3 years ago

Then most likely something has changed in the latest HA, and I am not so keen on upgrading, still on like over 20 versions behind.

Will see what I can do in the mean time to test this for a fix.

Regards

tongaimaramba commented 3 years ago

Is there a manual way to remove them, I can't find them in known devices or in the entities config

Have you tried rebooting the HA host? After I get the 405 error for an entity I tried to remove, if I reboot (not just restart the Hass server) then the entities are gone when everything is back up.

BTW I think I've narrowed this down to the "remove_entity()" function for the HASS API.

omayhemo commented 3 years ago

Excellent, yes a full reboot got rid of them. Thanks!

tongaimaramba commented 3 years ago

Then most likely something has changed in the latest HA, and I am not so keen on upgrading, still on like over 20 versions behind.

Will see what I can do in the mean time to test this for a fix.

Regards

Let me know if there's anything I can do/test as I'm already on the latest version. Happy to help.

Odianosen25 commented 3 years ago

Ok @tongaimaramba thanks. Will look for a possible solution and have you test it.

Regards

omayhemo commented 3 years ago

Still getting this error with every start up. I'm unsure if it affects perf of the system. It seems to stop working after a period of time and has to be restarted at all the satellite devices.