marcsowen / homebridge-homematicip

Homematic IP plugin for homebridge
Apache License 2.0
77 stars 19 forks source link

HmIP-MOD-HO & HmIP-MOD-TM implementation #14

Closed smarthome43372 closed 3 years ago

smarthome43372 commented 3 years ago

Many thanks for the great work you've done. I would be very happy if you could implement Hörmann Garage Module HmIP-MOD-HO. I can support if you want as I have supported to implement to HmIP iobroker adapter. Please let me know if you need any logs or testing. Thanks

marcsowen commented 3 years ago

I will have a look at it. It might take a couple of days.

marcsowen commented 3 years ago

Have a look at the latest version. I did an experimental implementation. I couldn't test it, so I hope it doesn't crash on you. I need your help to figure out some weird states. Can you play around a bit and check for log outputs regarding:

When is processing state true and when is on state true?

Usually processing state is true when something moves and on state is true when a switch is on, like a light bulb. Is there maybe a light bulb attached to the garage door opener?

Thanks for your help!

thecem commented 3 years ago

I tested it on a HmIP-MOD-TM and the state is not correct: Seems targetdoorstate and currentdoorstate is not set correctly. If it close it shows nothing and when it is closed it shows opening. When it is closed and you push in hk to open, opening is not shown in the tile.

It is nessecary to have the right target door state in hk, to show the real state in HomeKit Tile.

It would be very nice if you could also address the ventilation position at 10% opened, to show the status as stopped in the Garage Door HK Tile

Door Opener Lightbulb:

  • there is a light. does the api address this lite ?
  • a additional switch would be nice.

HB Logs:

[1/23/2021, 1:15:08 AM] [Homebridge UI] [homebridge-homematicip] Failed to check registry.npmjs.org for updates: "timeout of 5000ms exceeded" - see https://git.io/JJSz6 for help.
[1/23/2021, 5:22:56 PM] [Homebridge UI] Running Command: npm install --save homebridge-homematicip@latest
[1/23/2021, 5:23:42 PM] [HomematicIP] HmIP websocket shutdown...
[1/23/2021, 5:23:42 PM] [HomematicIP] HmIP websocket disconnected.
[1/23/2021, 5:23:53 PM] Loaded plugin: homebridge-homematicip@0.0.16
[1/23/2021, 5:23:53 PM] Registering platform 'homebridge-homematicip.HomematicIP'
[1/23/2021, 5:23:54 PM] [HomematicIP] Initializing HomematicIP platform...
[1/23/2021, 5:23:54 PM] [HomematicIP] homebridge-homematicip v0.0.16
[1/23/2021, 5:23:55 PM] [HomematicIP] Register accessory: Garage Door 1 (xx) -> uuid xx
[1/23/2021, 5:23:55 PM] [HomematicIP] Unreach of Garage Door 2 changed to null
[1/23/2021, 5:23:55 PM] [HomematicIP] Register accessory: Garage Door 2 (xx) -> uuid xx
[1/23/2021, 5:23:55 PM] [HomematicIP] Device not implemented: HmIP-STHO - Sens Out STHO via type TEMPERATURE_HUMIDITY_SENSOR_OUTDOOR
[1/23/2021, 5:23:55 PM] [HomematicIP] HmIP websocket connected.
[1/23/2021, 5:25:05 PM] [HomematicIP] Setting garage door Garage Door 1 to open
[1/23/2021, 5:25:05 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to true
[1/23/2021, 5:25:06 PM] [HomematicIP] Garage door state of Garage Door 1 changed to POSITION_UNKNOWN
[1/23/2021, 5:25:06 PM] [HomematicIP] Garage door on state of Garage Door 1 changed to true
[1/23/2021, 5:25:28 PM] [HomematicIP] Garage door state of Garage Door 1 changed to OPEN
[1/23/2021, 5:25:28 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to false
[1/23/2021, 5:25:37 PM] [HomematicIP] Garage door state of Garage Door 1 changed to POSITION_UNKNOWN
[1/23/2021, 5:25:37 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to true
[1/23/2021, 5:25:55 PM] [HomematicIP] Garage door state of Garage Door 1 changed to CLOSED
[1/23/2021, 5:25:55 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to false
[1/23/2021, 5:26:54 PM] [HomematicIP] Garage door on state of Garage Door 1 changed to false

Thanks a lot, If you need more logs or testing let me know.

marcsowen commented 3 years ago

Based on your logs I tried to optimized the behavior a bit. Try version >= 0.0.17. The on state was actually logging the wrong values as well, so maybe watch that state whether it corresponds to any door movement or light.

thecem commented 3 years ago

WOW! Thanks a lot, I tested it and it shows right now (o;O;c;C) the right status, and works as expected.

Is it possible to have a switch for the integrated light? This modul is able to control the integrated light of the opener.

Thanks a lot!

thecem commented 3 years ago

Additional here the complete log:

[1/23/2021, 1:15:08 AM] [Homebridge UI] [homebridge-homematicip] Failed to check registry.npmjs.org for updates: "timeout of 5000ms exceeded" - see https://git.io/JJSz6 for help.
[1/23/2021, 5:22:56 PM] [Homebridge UI] Running Command: npm install --save homebridge-homematicip@latest
[1/23/2021, 5:23:42 PM] [HomematicIP] HmIP websocket shutdown...
[1/23/2021, 5:23:42 PM] [HomematicIP] HmIP websocket disconnected.
[1/23/2021, 5:23:53 PM] Loaded plugin: homebridge-homematicip@0.0.16
[1/23/2021, 5:23:53 PM] Registering platform 'homebridge-homematicip.HomematicIP'
[1/23/2021, 5:23:54 PM] [HomematicIP] Initializing HomematicIP platform...
[1/23/2021, 5:23:54 PM] [HomematicIP] homebridge-homematicip v0.0.16
[1/23/2021, 5:23:55 PM] [HomematicIP] Register accessory: Garage Door 1 (xx) -> uuid xx
[1/23/2021, 5:23:55 PM] [HomematicIP] Unreach of Garage Door 2 changed to null
[1/23/2021, 5:23:55 PM] [HomematicIP] Register accessory: Garage Door 2 (xx) -> uuid xx
[1/23/2021, 5:23:55 PM] [HomematicIP] Device not implemented: HmIP-STHO - Sens Out STHO via type TEMPERATURE_HUMIDITY_SENSOR_OUTDOOR
[1/23/2021, 5:23:55 PM] [HomematicIP] HmIP websocket connected.
[1/23/2021, 5:25:05 PM] [HomematicIP] Setting garage door Garage Door 1 to open
[1/23/2021, 5:25:05 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to true
[1/23/2021, 5:25:06 PM] [HomematicIP] Garage door state of Garage Door 1 changed to POSITION_UNKNOWN
[1/23/2021, 5:25:06 PM] [HomematicIP] Garage door on state of Garage Door 1 changed to true
[1/23/2021, 5:25:28 PM] [HomematicIP] Garage door state of Garage Door 1 changed to OPEN
[1/23/2021, 5:25:28 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to false
[1/23/2021, 5:25:37 PM] [HomematicIP] Garage door state of Garage Door 1 changed to POSITION_UNKNOWN
[1/23/2021, 5:25:37 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to true
[1/23/2021, 5:25:55 PM] [HomematicIP] Garage door state of Garage Door 1 changed to CLOSED
[1/23/2021, 5:25:55 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to false
[1/23/2021, 5:26:54 PM] [HomematicIP] Garage door on state of Garage Door 1 changed to false
[1/23/2021, 6:36:52 PM] [HomematicIP] Garage door on state of Garage Door 1 changed to false
[1/23/2021, 6:36:53 PM] [HomematicIP] Unreach of Garage Door 2 changed to true
[1/23/2021, 6:37:35 PM] [HomematicIP] Garage door on state of Garage Door 1 changed to false
[1/23/2021, 6:37:39 PM] [HomematicIP] Garage door on state of Garage Door 1 changed to false
[1/23/2021, 6:37:45 PM] [HomematicIP] Garage door on state of Garage Door 1 changed to false
[1/23/2021, 6:42:37 PM] [HomematicIP] Garage door on state of Garage Door 1 changed to false
[1/23/2021, 6:43:59 PM] [HomematicIP] Garage door on state of Garage Door 1 changed to false
[1/23/2021, 6:44:56 PM] [HomematicIP] Garage door on state of Garage Door 1 changed to false
[1/23/2021, 6:45:11 PM] [HomematicIP] Garage door on state of Garage Door 1 changed to false
[1/23/2021, 6:46:37 PM] [HomematicIP] Garage door on state of Garage Door 1 changed to false
[1/23/2021, 6:46:45 PM] [HomematicIP] Garage door on state of Garage Door 1 changed to false
[1/24/2021, 7:32:18 AM] [Homebridge UI] Running Command: npm install --save homebridge-homematicip@latest
[1/24/2021, 2:16:12 PM] [HomematicIP] Garage door state of Garage Door 1 changed to POSITION_UNKNOWN
[1/24/2021, 2:16:12 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to true
[1/24/2021, 2:16:12 PM] [HomematicIP] Garage door on state of Garage Door 1 changed to true
[1/24/2021, 2:16:32 PM] [HomematicIP] Garage door state of Garage Door 1 changed to OPEN
[1/24/2021, 2:16:32 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to false
[1/24/2021, 2:17:31 PM] [HomematicIP] Garage door on state of Garage Door 1 changed to false
[1/24/2021, 2:20:46 PM] [HomematicIP] Garage door state of Garage Door 1 changed to POSITION_UNKNOWN
[1/24/2021, 2:20:46 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to true
[1/24/2021, 2:20:46 PM] [HomematicIP] Garage door on state of Garage Door 1 changed to true
[1/24/2021, 2:21:04 PM] [HomematicIP] Garage door state of Garage Door 1 changed to CLOSED
[1/24/2021, 2:21:04 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to false
[1/24/2021, 2:22:04 PM] [HomematicIP] Garage door on state of Garage Door 1 changed to false
[1/24/2021, 4:02:50 PM] [HomematicIP] Garage door on state of Garage Door 1 changed to false
[1/24/2021, 4:03:24 PM] [HomematicIP] Garage door on state of Garage Door 1 changed to false
[1/24/2021, 4:49:11 PM] [HomematicIP] HmIP websocket shutdown...
[1/24/2021, 4:49:11 PM] [HomematicIP] HmIP websocket disconnected.
[1/24/2021, 4:49:22 PM] Loaded plugin: homebridge-homematicip@0.0.17
[1/24/2021, 4:49:22 PM] Registering platform 'homebridge-homematicip.HomematicIP'
[1/24/2021, 4:49:23 PM] [HomematicIP] Initializing HomematicIP platform...
[1/24/2021, 4:49:23 PM] [HomematicIP] homebridge-homematicip v0.0.17
[1/24/2021, 4:49:23 PM] [HomematicIP] Loading accessory from cache: Garage Door 1
[1/24/2021, 4:49:23 PM] [HomematicIP] Loading accessory from cache: Garage Door 2
[1/24/2021, 4:49:24 PM] [HomematicIP] Unreach of Garage Door 2 changed to true
[1/24/2021, 4:49:24 PM] [HomematicIP] Device not implemented: HmIP-STHO - Sens Out STHO via type TEMPERATURE_HUMIDITY_SENSOR_OUTDOOR
[1/24/2021, 4:49:24 PM] [HomematicIP] HmIP websocket connected.
[1/24/2021, 4:51:10 PM] [HomematicIP] Setting garage door Garage Door 1 to open
[1/24/2021, 4:51:11 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to true
[1/24/2021, 4:51:12 PM] [HomematicIP] Garage door state of Garage Door 1 changed to POSITION_UNKNOWN
[1/24/2021, 4:51:12 PM] [HomematicIP] Garage door on state of Garage Door 1 changed to true
[1/24/2021, 4:51:34 PM] [HomematicIP] Garage door state of Garage Door 1 changed to OPEN
[1/24/2021, 4:51:34 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to false
[1/24/2021, 4:51:42 PM] [HomematicIP] Setting garage door Garage Door 1 to closed
[1/24/2021, 4:51:42 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to true
[1/24/2021, 4:51:43 PM] [HomematicIP] Garage door state of Garage Door 1 changed to POSITION_UNKNOWN
[1/24/2021, 4:52:03 PM] [HomematicIP] Garage door state of Garage Door 1 changed to CLOSED
[1/24/2021, 4:52:03 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to false
[1/24/2021, 4:53:03 PM] [HomematicIP] Garage door on state of Garage Door 1 changed to false
[1/24/2021, 5:01:25 PM] [HomematicIP] Garage door on state of Garage Door 1 changed to true
[1/24/2021, 5:05:26 PM] [HomematicIP] Garage door on state of Garage Door 1 changed to false
[1/24/2021, 5:05:36 PM] [HomematicIP] Garage door on state of Garage Door 1 changed to true

last four lines are setting the off/on/off/on --> true is light on.

Setting in hmip app position to ventilation brings following lines in log:

[1/24/2021, 5:08:31 PM] [HomematicIP] Garage door state of Garage Door 1 changed to POSITION_UNKNOWN
[1/24/2021, 5:08:35 PM] [HomematicIP] Garage door state of Garage Door 1 changed to VENTILATION_POSITION
[1/24/2021, 5:08:35 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to false

HK shows a Garage Door 1 tile with closed garage door pic and status "Open":

thecem commented 3 years ago

After automatic closing (60 min) from ventilation:

[1/24/2021, 6:09:26 PM] [HomematicIP] Garage door state of Garage Door 1 changed to POSITION_UNKNOWN
[1/24/2021, 6:09:26 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to true
[1/24/2021, 6:09:26 PM] [HomematicIP] Garage door on state of Garage Door 1 changed to true
[1/24/2021, 6:09:29 PM] [HomematicIP] Garage door state of Garage Door 1 changed to CLOSED
[1/24/2021, 6:09:29 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to false
[1/24/2021, 6:09:37 PM] [HomematicIP] Garage door on state of Garage Door 1 changed to false
marcsowen commented 3 years ago

Great to hear! Unfortunately the HomeKit garage door opener doesn't have any sense of a ventilation position. The best way to implement it was to set it to a STOPPED state somewhere between OPEN and CLOSED.

Also the HomeKit garage door opener doesn't know anything about lights. I will probably need to introduce a second device with a lightbulb/switch service in HomeKit that acts as a light switch. I will look into it...

thecem commented 3 years ago

Yes, I think the combination of closed door icon and state open is the best compromise. thx! If you could introduce the door light in a separate switch as second device this would be ingenious!

thecem commented 3 years ago

@smarthome43372: May You change the issue name to "HmIP-MOD-HO & HmIP-MOD-TM implementation", because the implementation also includes the HmIP-MOD-TM and leads other people in the right direction. Thx!

smarthome43372 commented 3 years ago

Sure, I wasn't aware that there is a similar module available for Novoferm drives. Sorry, for giving no further feedback and support to the development so far, as I haven't had an opportunity to test currently. Hope to do so tonight

thecem commented 3 years ago

Thanks! Right know the drive should work, with >=0.0.17...

thecem commented 3 years ago

In homebridge-nb (nuki lock) there is a possibility to slide from unlock to unlock, may it could be a solution to get the ventilation position also in the garage door tile. This would correspond to slide from open to open or from close to close (sliding from close to open to close again, whitout loosing your finger).

In the lock tile mechanism there is value for, may it is the same in garage door tile.

For a lock: With DEBUG=* homebridge -D

HomeKit sends a single update with value 0 (unlocked) when moving the slider really quickly from Unlocked to Locked back to Unlocked. If I take a just a little bit more time, HomeKit sends two updates, one for 1 (locked) and one for 0. I cannot seem to press the tile twice quickly enough for HomeKit to send a single update.

So this could be a genius (and truly the first implementation of this) for a garage door ventilation position.

Is it possible to implement this?

smarthome43372 commented 3 years ago

As promised my log. Nothing really new except for two additional not implemented devices.

[1/25/2021, 8:53:59 PM] [HomematicIP] Device not implemented: HmIP-SWD - Wassersensor via type WATER_SENSOR [1/25/2021, 8:53:59 PM] [HomematicIP] Register accessory: Garagentor (xxxxxxx) -> uuid xxxxx [1/25/2021, 8:54:00 PM] [HomematicIP] Device not implemented: HmIP-SLO - Lichtsensor außen via type LIGHT_SENSOR [1/25/2021, 8:54:00 PM] [HomematicIP] HmIP websocket connected. [1/25/2021, 8:54:01 PM] [HomematicIP] HmIP websocket disconnected. [1/25/2021, 8:56:14 PM] [HomematicIP] Current temperature of Heizkörperthermostat EZ changed to 23.1 [1/25/2021, 8:56:23 PM] [HomematicIP] Setting garage door Garagentor to open [1/25/2021, 8:56:23 PM] [HomematicIP] Garage door processing state of Garagentor changed to true [1/25/2021, 8:56:23 PM] [HomematicIP] Garage door processing state of Garagentor changed to false [1/25/2021, 8:56:25 PM] [HomematicIP] Garage door state of Garagentor changed to POSITION_UNKNOWN [1/25/2021, 8:56:25 PM] [HomematicIP] Garage door processing state of Garagentor changed to true [1/25/2021, 8:56:25 PM] [HomematicIP] Garage door on state of Garagentor changed to true [1/25/2021, 8:56:27 PM] [HomematicIP] Setting garage door Garagentor to closed [1/25/2021, 8:56:30 PM] [HomematicIP] Garage door processing state of Garagentor changed to false [1/25/2021, 8:56:33 PM] [HomematicIP] Setting garage door Garagentor to open [1/25/2021, 8:56:33 PM] [HomematicIP] Garage door processing state of Garagentor changed to true [1/25/2021, 8:56:33 PM] [HomematicIP] Garage door processing state of Garagentor changed to false [1/25/2021, 8:56:35 PM] [HomematicIP] Garage door processing state of Garagentor changed to true [1/25/2021, 8:56:47 PM] [HomematicIP] Garage door state of Garagentor changed to OPEN [1/25/2021, 8:56:47 PM] [HomematicIP] Garage door processing state of Garagentor changed to false [1/25/2021, 8:57:02 PM] [HomematicIP] Garage door processing state of Garagentor changed to true [1/25/2021, 8:57:03 PM] [HomematicIP] Garage door processing state of Garagentor changed to false [1/25/2021, 8:57:05 PM] [HomematicIP] Garage door state of Garagentor changed to POSITION_UNKNOWN [1/25/2021, 8:57:05 PM] [HomematicIP] Garage door processing state of Garagentor changed to true [1/25/2021, 8:57:27 PM] [HomematicIP] Garage door state of Garagentor changed to CLOSED [1/25/2021, 8:57:27 PM] [HomematicIP] Garage door processing state of Garagentor changed to false [1/25/2021, 8:58:01 PM] [HomematicIP] Garage door on state of Garagentor changed to false [1/25/2021, 8:58:02 PM] [HomematicIP] Garage door on state of Garagentor changed to true [1/25/2021, 8:58:03 PM] [HomematicIP] Garage door on state of Garagentor changed to false [1/25/2021, 8:58:04 PM] [HomematicIP] Garage door on state of Garagentor changed to true [1/25/2021, 8:58:09 PM] [HomematicIP] Garage door on state of Garagentor changed to false [1/25/2021, 8:58:09 PM] [HomematicIP] Garage door on state of Garagentor changed to true [1/25/2021, 8:58:11 PM] [HomematicIP] Garage door on state of Garagentor changed to false [1/25/2021, 8:58:14 PM] [HomematicIP] Garage door processing state of Garagentor changed to true [1/25/2021, 8:58:15 PM] [HomematicIP] Garage door processing state of Garagentor changed to false [1/25/2021, 8:58:16 PM] [HomematicIP] Garage door state of Garagentor changed to POSITION_UNKNOWN [1/25/2021, 8:58:16 PM] [HomematicIP] Garage door processing state of Garagentor changed to true [1/25/2021, 8:58:16 PM] [HomematicIP] Garage door on state of Garagentor changed to true [1/25/2021, 8:58:20 PM] [HomematicIP] Garage door state of Garagentor changed to VENTILATION_POSITION [1/25/2021, 8:58:20 PM] [HomematicIP] Garage door processing state of Garagentor changed to false [1/25/2021, 8:58:35 PM] [HomematicIP] Garage door processing state of Garagentor changed to true [1/25/2021, 8:58:35 PM] [HomematicIP] Garage door processing state of Garagentor changed to false [1/25/2021, 8:58:42 PM] [HomematicIP] Garage door processing state of Garagentor changed to true [1/25/2021, 8:58:42 PM] [HomematicIP] Garage door processing state of Garagentor changed to false [1/25/2021, 8:58:42 PM] [HomematicIP] Current temperature of Büro Thermostat changed to 22.9 [1/25/2021, 8:58:49 PM] [HomematicIP] Garage door processing state of Garagentor changed to true [1/25/2021, 8:58:49 PM] [HomematicIP] Garage door processing state of Garagentor changed to false [1/25/2021, 8:58:51 PM] [HomematicIP] Garage door state of Garagentor changed to POSITION_UNKNOWN [1/25/2021, 8:58:51 PM] [HomematicIP] Garage door processing state of Garagentor changed to true

This is how it looks like in the Homematic IP App

IMG_2079

This is the HB log when I press the light on button in the HMIP APP:

1/25/2021, 9:23:39 PM] [HomematicIP] Garage door on state of Garagentor changed to true [1/25/2021, 9:23:39 PM] [HomematicIP] Garage door on state of Garagentor changed to false [1/25/2021, 9:23:41 PM] [HomematicIP] Garage door on state of Garagentor changed to true

and this is the log when I switch off:

[1/25/2021, 9:24:53 PM] [HomematicIP] Garage door on state of Garagentor changed to false [1/25/2021, 9:24:54 PM] [HomematicIP] Garage door on state of Garagentor changed to true [1/25/2021, 9:24:55 PM] [HomematicIP] Garage door on state of Garagentor changed to false

This is the log when pressing the ventilation symbol in the middle:

[1/25/2021, 9:24:55 PM] [HomematicIP] Garage door on state of Garagentor changed to false [1/25/2021, 9:26:17 PM] [HomematicIP] Garage door processing state of Garagentor changed to true [1/25/2021, 9:26:17 PM] [HomematicIP] Garage door processing state of Garagentor changed to false [1/25/2021, 9:26:23 PM] [HomematicIP] Garage door state of Garagentor changed to VENTILATION_POSITION [1/25/2021, 9:26:23 PM] [HomematicIP] Garage door on state of Garagentor changed to true

marcsowen commented 3 years ago

Wow, thanks for all the logs. Due to limited time I will probably need a couple of days for the next version to be released. But I'm on it...

By the way, if you want a new device to be implemented next, don't hesitate to open up an issue for each device individually. In this way, I can better track what's needed most.

marcsowen commented 3 years ago

I added an experimental "light" service to the garage door in version >0.0.18. Since it's not really documented, I'm not sure if the switch actually does switch the light. I hope I didn't break anything. Can you tell me:

Thanks a lot!

thecem commented 3 years ago

OMG, how nice is this!!! Please leave this how it is now!!! Light: works! The room tile is a normal Garage Door. If you open the tile:

marcsowen commented 3 years ago

Very cool! Enjoy! :)

thecem commented 3 years ago

There is a little bug, if you switch the light with homematic ip on or off there is no update in homekit. The switch in homekit itself works, but if there is a homekit external setting to the light the switch will not show the real state. The hb logs show the change for the light, if it externally triggered (eg. hmip app).

thecem commented 3 years ago

Additional remark, if you repeatedly open the garage door tile, the light switch and the door switch changes there position vice versa. I tested to give the light a different name „ Garage Light 1“ and this fixed the change over. May It could be better to give the light out of the integration a „Light“ name and a bulb. If not this is configurable in Home by your own.

marcsowen commented 3 years ago

Oops... fixed update of light state in version >=0.0.20. I'm not yet sure about the naming. You could give each service a different name but I don't know whether this might confuse people if you have more than one device of the same type. I think about it.

thecem commented 3 years ago

Thx, tested the light and now it shows the real state! Naming: yes you are right this could be complicated. Right it works out of the box and everyone is able to change it there own needs:

thanks a lot, don’t forget the donate function....😎

marcsowen commented 3 years ago

Perfect!

thecem commented 3 years ago

There is some strange behaviour. If you set via HmIP App the door to ventilation and close it after a while HmIP App shows following:

Above is only shown if the door is closed and it is closed!

And HomeKit say in status opening...

this State remains even you drive the door fully open and close. I think this has to do with the target door state, that should set to right direction. Or should be overwritten when the door have reached the endpoint of close or open.

additional info: If the door is in ventilation mode, the tile shows as described earlier with a closed garage door icon and state open. If you drive the door to ventilation and back to close, it shows closed.

marcsowen commented 3 years ago

Strange... can you have a look at the logs when this happens? What does "Garage door state" and "Garage door processing state" say? When the garage door is closed the door state should switch to CLOSED and the processing state switch to false at almost the same time. Both should send a "CLOSED" state to HomeKit as well. When the processing state switch to false comes first, the state "STOPPED" will be send to HomeKit first with an immediate update to "CLOSED" when the door state update from HmIP-Cloud arrives.

VENTILATION_POSITION corresponds to STOPPED in the HomeKit world.

thecem commented 3 years ago

All settings made with the HmIP app. From close to full open and full close: Start State: App: close Home: close Door: close Log:

[1/28/2021, 2:05:53 PM] [HomematicIP] Garage door state of Garage Door 1 changed to POSITION_UNKNOWN
[1/28/2021, 2:05:53 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to true
[1/28/2021, 2:05:53 PM] [HomematicIP] Garage door light of Garage Door 1 changed to true
[1/28/2021, 2:06:13 PM] [HomematicIP] Garage door state of Garage Door 1 changed to OPEN

to State: App: open Home: open Door: open log:

[1/28/2021, 2:05:53 PM] [HomematicIP] Garage door state of Garage Door 1 changed to POSITION_UNKNOWN
[1/28/2021, 2:05:53 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to true
[1/28/2021, 2:05:53 PM] [HomematicIP] Garage door light of Garage Door 1 changed to true
[1/28/2021, 2:06:13 PM] [HomematicIP] Garage door state of Garage Door 1 changed to OPEN

to State: App: close Home: close Door: close

thecem commented 3 years ago

from close to ventilation: App: ventilation sign Home: open (with closed icon) Door: 10% open // ventilation log:

[1/28/2021, 2:41:07 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to true
[1/28/2021, 2:41:08 PM] [HomematicIP] Garage door state of Garage Door 1 changed to POSITION_UNKNOWN
[1/28/2021, 2:41:08 PM] [HomematicIP] Garage door light of Garage Door 1 changed to true
[1/28/2021, 2:41:11 PM] [HomematicIP] Garage door state of Garage Door 1 changed to VENTILATION_POSITION
[1/28/2021, 2:41:11 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to false
[1/28/2021, 2:42:11 PM] [HomematicIP] Garage door light of Garage Door 1 changed to false

from ventilation to close: App: closed Home: closed Door: closed log:

[1/28/2021, 2:42:11 PM] [HomematicIP] Garage door light of Garage Door 1 changed to false
[1/28/2021, 2:44:32 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to true
[1/28/2021, 2:44:34 PM] [HomematicIP] Garage door state of Garage Door 1 changed to POSITION_UNKNOWN
[1/28/2021, 2:44:34 PM] [HomematicIP] Garage door light of Garage Door 1 changed to true
[1/28/2021, 2:44:37 PM] [HomematicIP] Garage door state of Garage Door 1 changed to CLOSED
[1/28/2021, 2:44:37 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to false
[1/28/2021, 2:45:37 PM] [HomematicIP] Garage door light of Garage Door 1 changed to false
thecem commented 3 years ago

from closed to open (after ventilation to close) above:

[1/28/2021, 2:45:37 PM] [HomematicIP] Garage door light of Garage Door 1 changed to false
[1/28/2021, 2:48:33 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to true
[1/28/2021, 2:48:34 PM] [HomematicIP] Garage door state of Garage Door 1 changed to POSITION_UNKNOWN
[1/28/2021, 2:48:34 PM] [HomematicIP] Garage door light of Garage Door 1 changed to true
[1/28/2021, 2:48:48 PM] [HomematicIP] Current temperature of Sens Out STHO changed to 5.7
[1/28/2021, 2:48:56 PM] [HomematicIP] Garage door state of Garage Door 1 changed to OPEN
[1/28/2021, 2:48:56 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to false

App: in opening state , closed icon Home: open Door: open 100%

thecem commented 3 years ago

from open to closed: log:

[1/28/2021, 2:49:55 PM] [HomematicIP] Garage door light of Garage Door 1 changed to false
[1/28/2021, 2:52:25 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to true
[1/28/2021, 2:52:26 PM] [HomematicIP] Garage door state of Garage Door 1 changed to POSITION_UNKNOWN
[1/28/2021, 2:52:26 PM] [HomematicIP] Garage door light of Garage Door 1 changed to true
[1/28/2021, 2:52:46 PM] [HomematicIP] Garage door state of Garage Door 1 changed to CLOSED
[1/28/2021, 2:52:46 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to false

App: closed Home: closed Door: closed

thecem commented 3 years ago

from close to ventilation to open back to ventilation and close:

to ventilation tile: shows open and closed icon

[1/28/2021, 2:58:02 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to true
[1/28/2021, 2:58:03 PM] [HomematicIP] Garage door state of Garage Door 1 changed to POSITION_UNKNOWN
[1/28/2021, 2:58:03 PM] [HomematicIP] Garage door light of Garage Door 1 changed to true
[1/28/2021, 2:58:07 PM] [HomematicIP] Garage door state of Garage Door 1 changed to VENTILATION_POSITION
[1/28/2021, 2:58:07 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to false
[1/28/2021, 2:58:26 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to true
[1/28/2021, 2:58:27 PM] [HomematicIP] Garage door state of Garage Door 1 changed to POSITION_UNKNOWN

to open tile: show closing (even the door is not moving and in end open position!) and closed icon

[1/28/2021, 2:58:49 PM] [HomematicIP] Garage door state of Garage Door 1 changed to OPEN
[1/28/2021, 2:58:49 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to false
[1/28/2021, 2:59:36 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to true
[1/28/2021, 2:59:37 PM] [HomematicIP] Garage door state of Garage Door 1 changed to POSITION_UNKNOWN

to ventilation: show closing (when the door drives), then it shows openend with closed icon (like it should)

[1/28/2021, 2:59:56 PM] [HomematicIP] Garage door state of Garage Door 1 changed to VENTILATION_POSITION
[1/28/2021, 2:59:56 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to false
[1/28/2021, 3:00:15 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to true

to closed show closed with closed icon.

[1/28/2021, 3:00:16 PM] [HomematicIP] Garage door state of Garage Door 1 changed to POSITION_UNKNOWN
[1/28/2021, 3:00:19 PM] [HomematicIP] Garage door state of Garage Door 1 changed to CLOSED
[1/28/2021, 3:00:19 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to false
thecem commented 3 years ago

After this when you set in HmIP app to open, homekit shows closing with closed icon like above, even the door is fully open. log:

[1/28/2021, 4:32:04 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to true
[1/28/2021, 4:32:05 PM] [HomematicIP] Garage door state of Garage Door 1 changed to POSITION_UNKNOWN
[1/28/2021, 4:32:05 PM] [HomematicIP] Garage door light of Garage Door 1 changed to true
[1/28/2021, 4:32:27 PM] [HomematicIP] Garage door state of Garage Door 1 changed to OPEN
[1/28/2021, 4:32:27 PM] [HomematicIP] Garage door processing state of Garage Door 1 changed to false
thecem commented 3 years ago
thecem commented 3 years ago

Above icon was right now shown although the door was opened and in homebrigde log the OPEN and processing state false was in. After I pushed close I get the notify that the is opened, just in the second I pushed the button. After door stoped in close, I get the notify for closed. In this second I pushed the button close and get the notify open, log says door state changed to position_unknown...

thecem commented 3 years ago

Seems to me the state close and open is under some conditions not send to HK.

thecem commented 3 years ago

Tested 0.1.0: opening and closing is swapped. When the door is driving to open it show closing and vice versa... And Update only if you close the home app and reopen again. Removed the config to be sure the devices are reconfigured in HomeKit.

smarthome43372 commented 3 years ago

Tested 0.1.0 as well and got massive crash of HB when opening HomeKit App on mobile phone. Went back to 0.0.20 again.

[1/28/2021, 8:37:52 PM] Error: This callback function has already been called by someone else; it can only be called one time. at /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/util/once.ts:6:13 at HmIPWaterSensor.handleWaterLevelDetectedGet (/homebridge/node_modules/homebridge-homematicip/src/devices/HmIPWaterSensor.ts:55:9) at Characteristic.emit (events.js:327:22) at Characteristic.EventEmitter.emit (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/EventEmitter.ts:42:22) at Characteristic._this.getValue (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:489:12) at /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:1239:22 at Array.forEach () at Bridge.Accessory._this._handleGetCharacteristics (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:1167:10) at HAPServer.emit (events.js:315:20) at HAPServer.EventEmitter.emit (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/EventEmitter.ts:42:22) [1/28/2021, 8:37:52 PM] Got SIGTERM, shutting down Homebridge... [1/28/2021, 8:37:52 PM] [HomematicIP] HmIP websocket shutdown... [1/28/2021, 8:37:52 PM] [HomematicIP] HmIP websocket disconnected.

marcsowen commented 3 years ago

The error is actually the new water sensor (HmIP-SWD) device support. I hopefully fixed it in 0.1.1.

I also optimized the target state behavior. It should immediately update now. I still don't know what it is used for. Currently the target will be set to the current position if the door is in the open or closed position. Otherwise it will be the target position you set in the home app. If you move the garage door using the HomematicIP-App, the target is actually unknown.

Please let me know if the behavior is worse than in version 0.0.20.

smarthome43372 commented 3 years ago

First of all many thanks for your immediate fixing and the great work you're doing here.
The problem is fixed and HB isn't crashing any longer.

thecem commented 3 years ago

Many thanks even from my side! unfortunately, it didn’t work for me. The states of closing and opening are swapped and It seems home app have to poll for the end state of close and open. When you have the tile in Home for the garage door open, you see it starts moving (in the wrong direction) and never reaches the end state. If you close then the tile view and or switch to another room and back again, the end state including the notification will be shown in home. Is there no information from HmIP to HomeKit to the state, that you know to where the door is moving?

thecem commented 3 years ago

Even if not, the last state is every time known by hb. May after a restart of hb the last state is unknown....

thecem commented 3 years ago

close to ventilation moving state: opening... Ventilation to open: openening... close to open: opening... open to close: closing... open to ventilation: closing... ventilation to close: closing... with a last state variable and target state you should be able to present hk the right direction.

May Hk expects some special, so if the door is in opening (driving to open) it could not set to close (i don´t know)...??

marcsowen commented 3 years ago

Yes, the HomematicIP cloud only sends a "processing"-flag without telling me in what direction the garage door is moving. Currently the "processing"-flag is mapped to OPENING, even though it might be in fact CLOSING. The problem is that you could move from one intermediate STOPPED position to another intermediate STOPPED position. I couldn't tell if the garage door is more open or more closed after the second STOPPED position.

HomeKit expects some kind of target position as well which might be used to get the states in the Home App right. The target is also not known unless it is set via the Home App itself. The target can be OPEN or CLOSED and nothing in between. Right now I set the target every time it is set via the Home App and when the garage door finally reaches the OPEN or CLOSED position. In the latter case the target and the current position are identical. If the garage door is stopped in between (e.g. VENTILATION_POSITION), the target doesn't change which might confuse the Home App. Unfortunately the target is a required property so I'm a little puzzled how to use it right.

thecem commented 3 years ago

OK this makes it more clear to me. You say the "processing"-flag is mapped to OPENING, the home app shows CLOSING if you trigger via HmIP. Normal I would expect the HmIP sends the "processing"-flag to true and the plugin send to hk opening... but what I see is closing, so there must be something mixed up.

thecem commented 3 years ago

When I think about so there could only two "master" state that are every time fully identified if the door is in end state (if the hb is not rebooted or the cloud connect ist lost in between):

close to ventilation moving state: OPENING
close to open: OPENING
open to close: CLOSING
open to ventilation: CLOSING

So starting from the last close / open state the moving could only one way (close:opening // open:closing). From the ventilation position or other stop state there are 2 possible ways, so there could be the wrong directing show or assumed, because there is no direction given from drive. So at least the moving from close -> opening and open -> closing should be correct.

Could I help any further, to try some states I won´t load all the work n to you?

marcsowen commented 3 years ago

close to ventilation moving state: OPENING

I have no way of knowing whether the target state is ventilation. Can't you stop the door somewhere in the middle as well?

I have looked what the CCU-owners do. Their accessory just know the states OPEN and CLOSED. Everything in-between is ignored:

https://github.com/thkl/homebridge-homematic/blob/master/ChannelServices/HomeMaticHomeKitGarageDoorOpenerService.js

Maybe this would be a much more stable solution instead of guessing what's going on. The drawback is you wouldn't see a "moving garage door" in the Home App.

thecem commented 3 years ago

I did some researches on HK Garage Door to show the right states, i hope this helps to set it right:

View of hk garage door tile:

close: T1 and C1 open: T0 and C0 closing: T1 and C3 opening: T0 and C2 stopped/ventilation: T1 and C4 (to show open with the closed icon)

HMCharacteristicTypeTargetDoorState == T HMCharacteristicTypeCurrentDoorState == C open = 0 close = 1 opening = 2 closing = 3 stopped =4

If you map both values to the corresponding states of the HmIP, it will present in every case the right position to hk, except starting from stopped. I would (even I know this is a unknown bet, in which direction from ventilation the door drives) assume most times when somebody set ventilation the next moving state will be closing (t1 and c3), because this is the standard behavior in the drive to close the door after 60 min. Worth to try?

Thank you at all, but I think your implementation could be the better one for a garage door, since every one I saw ! Lights/States etc. so I will try to help to make it better.

thecem commented 3 years ago

I had a closer look in your code HmIPGarageDoor and If I try to rebuild the function to see the states in Home. I get the same results in Home.

I think if you could change to above where the update of both values for the characteristic of traget AND current are necessary, it would work (convention is clearly wrong and has to be adapted):

        case DoorState.CLOSED:
            return this.platform.Characteristic.CurrentDoorState.CLOSED
            return this.platform.Characteristic.TargetDoorState.CLOSED;
        case DoorState.OPEN:
            return this.platform.Characteristic.CurrentDoorState.OPEN;
            return this.platform.Characteristic.TargetDoorState.OPEN;
        case DoorState.VENTILATION_POSITION:
            return this.platform.Characteristic.CurrentDoorState.STOPPED;
            return this.platform.Characteristic.TargetDoorState.CLOSED;
        case DoorState.POSITION_UNKNOWN:
        if (lastDoorState.CLOSED && PROCESSING true) DoorState.OPENING
            return this.platform.Characteristic.CurrentDoorState.OPENING;
            return this.platform.Characteristic.TargetDoorState.OPEN;
        else if (lastDoorState.OPEN && PROCESSING true) DoorState.CLOSING
             return this.platform.Characteristic.CurrentDoorState.CLOSING;
             return this.platform.Characteristic.TargetDoorState.CLOSED;
marcsowen commented 3 years ago

Thanks for your work. I will try and see what happens.

I played around with my window shutters and there seem to be a similar problem. There is also only one processing and the HomematicIP-Cloud won't tell you in which direction the shutter moves. I only have two values:

HomeKit on the other hand wants to know three things:

I think you can see the first two values quite well in the Eve-App:

Eve-App Current/Target

The current position is easy. Those values just need to be recalculated from HomematicIP to HomeKit. (0.0 -> 100, 0.5 -> 50, 1.0 -> 0).

Target position is hard: There is no clue from the HomematicIP cloud what the target is. But by looking at the Eve app I think this is not really necessary at all. A target position would only change the green value and maybe even move the blue slider. It would be a nice feature to see the slider move while someone else moves the shutter in the HomematicIP app. But this value is not transmitted through the cloud. You might be able to see the slider move if you store the value in Homebridge and just show it to other HomeKit users. But nothing would move in the HomematicIP app. But is this really used to show a movement in the Home-App? My guess would be: Just change it when you move the slider yourself and forget about changing it based on guessing.

Position state is the same problem as with the Garage Door. We only know that the shutter/garage door moves but we don't know in which direction. I think this value might be used to show animation.

To sum up: I don't think the problem is the target position. But I will investigate further.

marcsowen commented 3 years ago

Regarding the animation for the garage door, I would guess the following:

The moving animation of the garage door is active, when the current and the target position are not the same.

So your suggestion

return this.platform.Characteristic.CurrentDoorState.STOPPED; return this.platform.Characteristic.TargetDoorState.CLOSED;

might result in a closing animation sind the door has not reached is final (target) destination. But I'm just guessing. Right now I'm a bit puzzled why the target is not updated in my trials. Current position is always visible but the target seem to only be updated when HomeKit asks for it.

thecem commented 3 years ago

Is the current shutter position a poll or a push? And when do you get the value? If it change to processing true?

May it could be a solution to poll the shutter position when u get a processing, so you are able to calculate the last value to the actual and able to set the directions.

Guessing is only in one case: starting from stopped. In all other cases hk needs above target and current states combined than you have in every case the right tile status. This should also work for the target and current position characteristics.