moroen / IKEA-Tradfri-plugin

A Python plugin for Domoticz to controll IKEA Gateway
68 stars 23 forks source link

Battery levels #64

Closed basrieter closed 4 years ago

basrieter commented 5 years ago

Would it be possible to show the battery level of switches that are connected to the lights?

moroen commented 5 years ago

I'll take a look at the API and see if it's doable... Not quite sure how to represent the info in domoticz as well, but we'll see what can be done! :)

basrieter commented 5 years ago

I see you are working on the battery levels? Is 5eddbe5 the only thing that is required or do is it not yet stable?

moroen commented 5 years ago

Yes... Battery-levels are more or less working on the adapter side, but yet not implemented on the plugin side, so it's not finished.

I'll post a comment here as soon as it's ready for testing, I hope to finish inital support in a couple of days, a bit occupied with other matters at the moment.

basrieter commented 5 years ago

Great! Let me know if you need some testing at some point. Easy to spin up a new Docker container here. But no hurry! I know the pressure of working on open source projects. Don't forget to spend time on other (personal) things too!

moroen commented 5 years ago

Intitial support for monitoring battery-levels has been added. It's rather crude at the moment, using the default percentage-type, but I guess it can be made more "elegant" somewhere along the road.

Battery-status is updated on domoticz startup, and once every 60 minutes. This interval is hard-coded, due to limitations in the plugin framework,

Please test the development branch and bring feedback!

basrieter commented 5 years ago

Running it as we speak. Will let you know how it goes.

basrieter commented 5 years ago

I checked the battery levels for the past 5 days, but they don't seem to change at all. One battery is still at 100% while I have to replace it, because it has a low voltage. So something seems odd here.

moroen commented 5 years ago

Hm, strange... Does the updated time on the domoticz controlls change once an hour?

moroen commented 5 years ago

I just checked on my own system, the levels reported from the gateway appears to not be changing on my system at all... Two remotes still on 100 and one on 74, and has been for at least a week...

I dont't know if this is due to some error in pytradfri or something wrong with the reporting from the gateway...

basrieter commented 5 years ago

Really, those are the same values I have:

image

moroen commented 5 years ago

I've checked the raw data from the gateway, and the values reported via pytradfri looks to be correct, so the problem probably lies with the gateway... Keeping this issue open for now, pending further research.

basrieter commented 5 years ago

Ok. Seems that Home Assistant does have it working. Perhaps there is an option to peek there?

moroen commented 5 years ago

Ok, so HA on your system reports a correct battery status?

I just launched HA in a docker and added IKEA Tradfri, the battery status in HA is exactly the same as in Domoticz, 100, 100 and 74...

basrieter commented 5 years ago

No, I did not try that. Just read in their forums. I am a 100% Domoticz person.

moroen commented 5 years ago

I've been running an instance of HA for a couple of days, the battery levels are the same in HA as in Domoticz, and haven't changed a bit, still 74, 100 and 100 for my three remotes. So my initial conclusion is that the gateway somehow doesn't report the battery status correctly. This MIGHT be a problem with pytradfri, which is the basis for tradfri-support in both my plugin and HA.

Keeping the issue open pending further observations.

wvdweerd commented 4 years ago

Any updates on this? Are you still trying to get this working?

I have had already two remotes where the battery was completely empty before I noticed. Then I had to remove and register the remote and lights again in the Ikea hub. And they then appear as new lights in Domoticz, so I had to add the timers again and add them to the dashboard...

Very annoying, so I would be great to get battery level updates in Domoticz :-)

moroen commented 4 years ago

Support for monitoring battery levels have been added to latest version!

basrieter commented 4 years ago

Nice! Will give it a try asap

basrieter commented 4 years ago

Working like a charm!