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

Type Valve cannot be used from Homekit app to change status #33

Closed EjvindHald closed 4 years ago

EjvindHald commented 5 years ago

I have created this in config.json

{"type": "valve", "items": [ {"name": "Vandhaner", "activeItem": "KaelderFyrrumVandmaalerHomekitInit", "inUseItem": "KaelderFyrrumVandmaalerHomekitDelayed"} ,{"name": "Afbryd vand", "activeItem": "KaelderFyrrumMagnetventilHomekitInit", "inUseItem": "KaelderFyrrumMagnetventilHomekitDelayed", "valveType": "irrigation"} ] The last one called 'KaelderFyrrumMagnetventilHomekitInit' is defined as a Switch in openHAB.

However, I cannot turn this switch on and off using Homekit app. It just says 'Starting...'. I have tried various options including this rule: rule "Vand løber" when Item KaelderFyrrumVandmaaler received update or System started then if (KaelderFyrrumVandmaaler.state == OPEN) KaelderFyrrumVandmaalerHomekitInit.sendCommand(ON) else KaelderFyrrumVandmaalerHomekitInit.sendCommand(OFF) Thread::sleep(1000) if (KaelderFyrrumVandmaaler.state == OPEN) KaelderFyrrumVandmaalerHomekitDelayed.sendCommand(ON) else KaelderFyrrumVandmaalerHomekitDelayed.sendCommand(OFF) end

It is displayed correct in Homekit, if the switch is changed from openHAB ui.

In the native Homekit support the type 'Valve' is the same and it is working without problems, so it can be updated from both Homekit and openHAB ui.

Thanks.

EjvindHald commented 5 years ago

It seems that the valveType has no effect on the icon shown in Homekit app.

steilerDev commented 4 years ago

The last part about the valveType seems to be a limitation of either HomeKit at the moment and/or the HomeKit Accessory Protocol implementation used by homebridge.

When pressing on the item and it is showing "Starting...", is the state of the item within openHAB changed or not?

Could you please perform the action and paste your HomeBridge debug log?

EjvindHald commented 4 years ago

I am on vacation with no access to my stuff, so the log will have to come later. Meanwhile, I recall that the state of the openHAB item is not changed when using the homekit app.

If the valveType is not working then you might consider to remove that part from the documentation.

jjkrol commented 4 years ago

I have a similar problem - I am using accessory type: "valve". When I turn on the valve, the icon says "starting...", but there is no effect in openhab. When in debug mode, after turning the valve on in Home, I see the following lines in the homebridge log:

Accessory [Homebridge] Processing characteristic set: [{"aid":12,"iid":11,"value":1}] +3ms
Accessory [Homebridge] Setting Characteristic "Active" to value 1 +2ms

But in contrary to other accessories, they're not followed by any logs from the openhab plugin - like the change is somehow not picked up.

Is there any way I can make it work?

Relevant part of config:


{
      "type": "valve",
      "items": [
      {
           "name": "Sprinkler back",
           "activeItem": "vGA_SP_sprinkler_1",
           "inUseItem": "GA_SP_sprinkler_1"
       },
       ....
       ]
}
steilerDev commented 4 years ago

Good catch. I seem to have implemented only a sensor characteristic, where an actor characteristic is required. I am working on this.

BernhelmB commented 4 years ago

I ran into the same issue here.

{ "name": "Bewässerung Hecke", "type": "valve", "activeItem": "Garten_Hecke_Bewaesserung_Schalter", "inUseItem": "Garten_IC_Hecke_Bewaesserungstimer", "durationItem": "Garten_Hecke_Bewaesserung_Zeitprogramm_s" }

It is registering the characteristic

Accessory [Homebridge] Registering Characteristic "Active" for events Accessory [Homebridge] Registering Characteristic "In Use" for events Accessory [Homebridge] Registering Characteristic "Valve Type" for events Accessory [Homebridge] Registering Characteristic "Set Duration" for events Accessory [Homebridge] Registering Characteristic "Remaining Duration" for events

and when I try to turn it on (or off) with homekit, it is the same

Accessory [Homebridge] Processing characteristic set: [{"aid":13,"iid":11,"value":1}] Accessory [Homebridge] Setting Characteristic "Active" to value 1 EventedHTTPServer [::ffff:192.168.178.73] Muting event '13.11' notification for this connection since it originated here. EventedHTTPServer [::ffff:192.168.178.69] Sending HTTP event '13.11' with data: {"characteristics":[{"aid":13,"iid":11,"value":1}]} EventedHTTPServer [::ffff:192.168.178.73] HTTP Response is finished

In Openhab log, nothing occurs

In the other direction it is working (as you said, the sensor characteristic is doing well), so when I change the state in Openhab, I can see it in Homekit correctly.

The durationItem is working properly, too. The item in Openhab changes when I change the time in Homekit.

A slightly other behaviour is when I try using the irrigation instead of the valve. With that in the config.json I only get a status symbol in Homekit and no menu behind where I find the switch or the durationItem.

If I can help testing something, please comment my post.

steilerDev commented 4 years ago

This should be fixed in 0.10.3, which I will release until end of week (hopefully, sorry for the long wait!!!)

steilerDev commented 4 years ago

If you want, you can check out my latest commit 5a6fb44

steilerDev commented 4 years ago

Now works (fbe702a)