steilerDev / homebridge-openhab2-complete

A homebridge plugin for openHAB, that has the expectation to fully support all Services offered by Apple's Homekit Accessory Protocol (HAP)
GNU General Public License v3.0
52 stars 16 forks source link

Implementation of a numeric battery-state #9

Closed apfelflo89 closed 4 years ago

apfelflo89 commented 5 years ago

It would be great to see a numeric battery-state in sensors, I have a couple of Number-Items that represent the level in % . homebridge-hue gets this done very well.

steilerDev commented 5 years ago

Could you please elaborate a bit more on [homebridge-hue ](https://www.npmjs.com/package/homebridge-hue) gets this done very well.?

It is not obvious to me how Homebridge-hue's behavior is.

I can only imagine accepting Number items and a batteryLevelThreshold for the warning to be triggered?

apfelflo89 commented 5 years ago

Sure I can, within the hue accessories I can see the actual Battery-Status like "46%" , it warns if it gets under a certain threshold, but my request would be to see that numeric state in % aswell in the openhab items.

Homekit Screenshot

What I have is a Number item what represents that state.

steilerDev commented 5 years ago

I see. This seems to add a BatteryService to the accessory. I am currently looking into this.

Thank you,

Frank

steilerDev commented 4 years ago

Hey @apfelflo89, sorry it took so long, but I finally got around looking into this.

I now have everything in place, but the Battery Level is not shown in the HomeKit App (For some reason). Feel free to check out my latest commit and test this (9c001ed9228e3a18a2a8726cb8727b94451a42c8)

apfelflo89 commented 4 years ago

Hi @steilerDev, I updated my installation and configuration, so far homebridge runs without errors, but with no new functionality - I tried warnings by underpassing the threshold. There is no BatteryService that is exposed to the device.

steilerDev commented 4 years ago

The BatteryService should be exposed, it can be added to every accessory if there is a batteryItem inside the configuration (See this). Thresholding and battery warnings work for every item, but as you mentioned it is not shown like your screenshot in your earlier post (is that the official Home.app??). I guess I missed something within the implementation, but I can't figure out what I am doing wrong :/ Any ideas?

apfelflo89 commented 4 years ago

I see that you already contacted ebaauw/homebridge-hue , i really can not help with your developing . My screenshot shows the Apple Home app.

My config with a number item looks like : { "name": "Wohnungstüre", "type": "contact", "batteryItem": "WohnungsTuereBatterieNumber", "batteryItemThreshold": "10", "item": "WohnungsTuereKontakt" },

But log and homekit device aren't showing any Battery Services, but maybe I did something wrong, I replaced my current plugin files with a git clone of your repository, since the version is still the same. Is that the correct way?

steilerDev commented 4 years ago

I finally figured it out, not quite sure what I did wrong previously. My latest commit has all the details also consult the README. Feel free to provide feedback.

apfelflo89 commented 4 years ago

Hey, it´s working now and even showing up in the Apple Home App (you may delete that note in the readme.de)

It also seems that I made a mistake with getting the git files into my installation, I now updated with: sudo npm install --unsafe-perm -g git+https://github.com/steilerDev/homebridge-openhab2-complete.git#master --save

For everyone else running into that kind of problems.

Thank you very much!

IMG_4B915B6C52B1-1

steilerDev commented 4 years ago

Great! I just want to get rid of all open issues and then there'll be an official release :)