hap-homematic icon indicating copy to clipboard operation
hap-homematic copied to clipboard

HmIP-MOD-HO is in "No response" and does not reflect the actual status

Open reinisb opened this issue 3 years ago • 50 comments

Hi,

Today I finally connected the HmIP-MOD-HO adapter to my Hörmann Rotamatic swing gate as well as set it up in RaspberryMatic and hap-homematic.

So, through RaspberryMatic web interface it works perfectly fine and is 100% reliable - I can open, close, stop the gate as well as see the status of the gate. It is really good.

Unfortunately, I cannot say that about using it via hap-homematic. In the Home app, I can initiate opening or closing the gate, but then it becomes unresponsive and the gate status does not update in the Home app. If I then press the gate button in Home app again then it actually does nothing and the only way to open/close the gate again is to do it directly via RaspberryMatic web interface. Here is a video illustrating the issue. Does anyone have any ideas about how to resolve the issue? Is this an issue with hap-homematic and RaspberryMatic having trouble "talking" to each other?

Thanks, Reinis

reinisb avatar Dec 24 '20 23:12 reinisb

Ok just to make this clear: the device came unresponsive until you start an open/close action. When you open or close the gate from your browser will be then a status change in HomeKit ?

thkl avatar Dec 25 '20 09:12 thkl

If I start an open gate or close gate action via the Home app, then the action will start and finish, but the Home app will not show that it has finished and will become stuck in “No response”. It seems that the Home app does not receive updates about the gate status from the bridge.

If I open or close the gate from the browser (RaspberryMatic web interface), then in the Home app it does not update. Only if I quit and then relaunch the Home app it will show the correct gate status. It seems that when the Home app is launched, then it fetches the current status of the gate. However, when the Home app is running then it does not receive updates about the gate status from the bridge.

reinisb avatar Dec 25 '20 10:12 reinisb

Also, here are my CCU firewall settings Screen Shot 2020-12-25 at 13 15 12

reinisb avatar Dec 25 '20 11:12 reinisb

Ok thank you. Please make sure the ports listed in the instance Settings are Open at your ccu firewall so HomeKit is able to reach the instances running on your ccu.

I do not have one of these gate opener devices, but i will rebuild your scenario in the Simulator to check the issue.

thkl avatar Dec 25 '20 11:12 thkl

Ok, thanks - I have added the ports to the CCU firewall list. Do you think this should resolve the issue?

Screen Shot 2020-12-25 at 13 31 30

reinisb avatar Dec 25 '20 11:12 reinisb

Maybe ... as mentioned above, i do not have such a device to test this

thkl avatar Dec 25 '20 17:12 thkl

Gotcha! @thkl when you have time I would appreciate if you could please rebuild and test the scenario in the simulator. Thanks

reinisb avatar Dec 25 '20 18:12 reinisb

oh, i took a deep dive into the code and my latest changes for a feature request of the garage door opener. And i've found another bug which may be the root cause of your issue.

The part of the code, which is responsible to return ~~the current state of the gate~~ a message after proceeding the set target command back to homekit did not return any value .. so homekit will trigger the no response message. (https://github.com/thkl/hap-homematic/commit/691d58fd613481adf6dbf5e04ea2dbe07ed95434#comments)

if you are using the latest build (0.0.56) you can copy the file from here https://github.com/thkl/hap-homematic/blob/master/lib/services/HomeMaticGarageDoorOpenerAccessory.js to /usr/local/addons/hap-homematic/node_modules/hap-homematic/lib/services on your ccu and override the existing HomeMaticGarageDoorOpenerAccessory.js file. After a restart of the addon via the webui this will fix the issue.

From this time on, there will be a second button to trigger the ventilation feature. (this was the original feature request)

thkl avatar Dec 25 '20 19:12 thkl

Awesome - thanks! I will give this a try tomorrow and report back. Yes, I am on version 0.0.56 - I will try to ssh into my raspberry pi running raspberrymatic and copy over the file. I hope there will not be any issues with permissions. Is there any other way to update the addon?

reinisb avatar Dec 25 '20 20:12 reinisb

I ve got the same problem.

https://youtu.be/BFItuvlHdV4

I think its the same issue like #231.

gerd2005 avatar Dec 26 '20 13:12 gerd2005

Yes the problem was a missing callback for one of the Characteristics. I've fixed that with the commit above.

thkl avatar Dec 26 '20 14:12 thkl

Good news - I replaced the HomeMaticGarageDoorOpenerAccessory.js file and I can confirm that now it works and the status updates! Awesome - thanks a lot @thkl ! Here is a video of how it works now: https://www.youtube.com/watch?v=LuOw4yJiMuM

There are two things which would make it even more perfect:

  1. ~~Since I don't have any lights for the gate, it would be awesome if I could only have the switch for the gate in the Home app (I don't need the second switch for lights).~~ The device in the Home app currently has two buttons. The one on the left is the main switch for the gate. The other button on the right currently opens only half the gate (I guess it is called "ventilation mode" or similar). I would prefer to not have the second switch since it is not needed for the territory gate (it would make sense to have it for garage doors to ventilate the garage, but not in my case). Can you please let me know which lines of code I need to remove so that I would only have the main switch in the Home app? 50percent

  2. Right now the gate in the Home app only shows either status Open or Closed. It would be fantastic if it would also show the transitioning statuses Opening... and Closing.... For example, if the gate is in status Closedand I press the switch in the Home app, then it would show status Opening... and once it is done opening then it would show status Open. Is there any way to make it work this way?

reinisb avatar Dec 26 '20 14:12 reinisb

The second switch is for ventilation. I will make this switch optional.

And I will take a look into the "Opening" and "Closing". HomeKit has two values to set. The target state and the current state. When target!=current the app will show the corresponding "...ing" message until both states are equal.

thkl avatar Dec 26 '20 17:12 thkl

Ok i will need a little bit of help for the open'ing' and clos'ing' stuff. There is a "PROCESS" Datapoint which will indicate the movement of the gate. Can you please navigate to your ccu and the program list. There is a button at the footer section named "Test Script". The Script to get the value is

Write(dom.GetObject('HmIP.12345:1.PROCESS).Value());

where 12345 indicates the serial number of your homematic device. Please replace it with the correct number.

The output should be 1 or 0 .. i need the value once for "gate is static" (should be 0) and "gate is moving" (should be 1) - but i am not 100% sure.

thkl avatar Dec 26 '20 18:12 thkl

I exectued Write(dom.GetObject('HmIP.00241BE989E476:1.PROCESS').Value()); when it was static (open/close) as well as when it was transitioning and it always returned the value zero.

Screen Shot 2020-12-26 at 21 37 51

That being said, it seems that there is a way for CCU to know the status of the gate because in the RaspberryMatic web interface it does show when the gate is in status Open,Closed as well as Unknown (which means that the gate is either opening or closing). For example, in the screen recording below - the gate is in status Open, then I press the button that initiates closing the gate (the status changes to Unknown) and once the gate is fully closed then the status changes to Closed.

https://user-images.githubusercontent.com/6346595/103158186-e28cb880-47c3-11eb-8e90-5147eb873ae8.mov

reinisb avatar Dec 26 '20 19:12 reinisb

oh sorry my fault .. the interface is HmIP-RF .. so

Write(dom.GetObject('HmIP-RF.00241BE989E476:1.PROCESS').Value());

thkl avatar Dec 26 '20 19:12 thkl

Ok, now it worked!

Closed = 0 Screen Shot 2020-12-26 at 22 09 37

Opening = 1 Screen Shot 2020-12-26 at 22 10 03

Open = 0 Screen Shot 2020-12-26 at 22 10 30

Closing = 1 Screen Shot 2020-12-26 at 22 10 42

reinisb avatar Dec 26 '20 20:12 reinisb

Ok, thank you very much for investigating in this. PROCESS is 1 while the gate is operating and 0 when the gate stops or is in a stable position. I will put this into the simulator for HmIP-MOD-HO and change the Accessory Clazz ..

thkl avatar Dec 26 '20 20:12 thkl

ok @gerd2005, since i will put an option for the ventilation feature in, i can also add an option for the integrated light switch. Pro : All Buttons are centralized in one device .. Con: Tapping on the garage Item will not operate the door just pop up the detail view with the buttons and u have to tap a second button ...

thkl avatar Dec 26 '20 20:12 thkl

Thanks a lot @thkl - this is really great! Looking forward to the changes!

reinisb avatar Dec 26 '20 22:12 reinisb

this should work now

https://user-images.githubusercontent.com/884355/103168325-5b2a5e00-4832-11eb-9e77-d6f8c982820e.mov

thkl avatar Dec 27 '20 09:12 thkl

Thanks! I replaced the file HomeMaticGarageDoorOpenerAccessory.js, it works a bit better, but unfortunately, the Opening and Closing statuses show for too short. Here is a video with audio commentary: https://www.youtube.com/watch?v=qMoOiPtwQnU

reinisb avatar Dec 27 '20 10:12 reinisb

Hmm that looks weird.

I do wait for a process=0 event and then set the current state of the gate in homekit to the new value.

Can you please call the webui of hap ... go to menu internal .. switch on the debug log run the open close cycle again and than download the log from the webui/internal menu . This log will contain the events sent by the ccu. So I can take a look into the messages from ccu while the gate is operating.

thkl avatar Dec 27 '20 11:12 thkl

Alright, I enabled the debug mode. After that, the gate was Closed so I pressed the button in Homekit to open it (I assume it is Sun Dec 27 2020 12:44:29 GMT+0100 (CET)] debug - [HAP Server] [GOA] Homekit Door Command 0). Once the gate was fully Open, I waited a few seconds and then pressed the button in Homekit to close it (I assume it is [Sun Dec 27 2020 12:45:04 GMT+0100 (CET)] debug - [HAP Server] [GOA] Homekit Door Command 1). I waited for it to fully close and then I downloaded the log. Here's the log:

hap-homematic-log.txt

reinisb avatar Dec 27 '20 11:12 reinisb

it looks like the CCU will not send a Process=1 (gate is running) event right after a door_command was sent.

here is the homekit "open the gate" command:

[Sun Dec 27 2020 12:44:29 GMT+0100 (CET)] debug - [HAP Server] [GOA]  Homekit Door Command 0

here the command to the ccu:

[Sun Dec 27 2020 12:44:29 GMT+0100 (CET)] debug - [HAP Server] [Rega] RegaScript object o = dom.GetObject('HmIP-RF.00241BE989E476:1.DOOR_COMMAND');if (o){o.State(1);}

the ccu comes with a correct status event (the gate is closed)

[Sun Dec 27 2020 12:44:29 GMT+0100 (CET)] debug - [HAP Server] [RPC] event for HmIP-RF.00241BE989E476:1.DOOR_STATE with value 0

then comes a "no movement" event from ccu:

[Sun Dec 27 2020 12:44:29 GMT+0100 (CET)] debug - [HAP Server] [RPC] event for HmIP-RF.00241BE989E476:1.PROCESS with value 0

this event will cancel out the hap internal working indicator ...

but 2 seconds later the ccu reports a open gate

[Sun Dec 27 2020 12:44:31 GMT+0100 (CET)] debug - [HAP Server] [RPC] event for HmIP-RF.00241BE989E476:1.DOOR_STATE with value 3

unless the working indicator was set to false from the process=0 event 2 seconds before this event will set the homekit status to "gate is open"

and after that the process datapoint was set to 1 (the indicator that the gate is now moving)

[Sun Dec 27 2020 12:44:31 GMT+0100 (CET)] debug - [HAP Server] [RPC] event for HmIP-RF.00241BE989E476:1.PROCESS with value 1

So that will explain the current behaviour that 3 seconds after the button in homekit was push'd the moving indicator in homekit turns off cause of the process=0 event ...

Maybe i can deal with that by ignoring the process=0 event until it was not set to 1 ... i will test this one

thkl avatar Dec 27 '20 12:12 thkl

so now it should work with one exception: when the gate was triggered by the ccu (webui or a button or so) Homekit will not show the opening/closing state but just change the state to the new one cause i have no initial indicator that the gate is moving due to the weird event flow i've describd above. But i think thats ok.

thkl avatar Dec 27 '20 13:12 thkl

Thanks! I replaced the file HomeMaticGarageDoorOpenerAccessory.js, but now the gate button is simply stuck in Updating... and then No response. In other words, I cannot initiate any action from Home app. It does work perfectly fine via RaspberryMatic web interface.

I tried removing the device in hap-homematic and adding it again, cleared CCU cache, restarted hap-homematic, restarted ccu, nothing helped. Any ideas? I now put back the old file HomeMaticGarageDoorOpenerAccessory.jsand it is also simply showing Updating and then No response. I guess this issue is not related to the newest changes.

Here's log:

log.txt

IMG_7468 IMG_7469

reinisb avatar Dec 27 '20 15:12 reinisb

can you please get a debug log with the new file. i mean i've made a typo and there is a new one.

thkl avatar Dec 27 '20 16:12 thkl

Good news - the new file with the fixed typo works! Thanks a lot for your work!

I tested two cases: (A) Gate is in status Closed. I press the button in the Home app, the status changes to Opening.. and unfortunately stays in this status forever, while in reality, the gate has fully opened after ~30 seconds. If I relaunch the Home app, then the correct status Open shows. (B) Gate is in status Open. I press the button in the Home app, the status changes to Closing... and then after ~30 seconds it correctly changes to status Closed - perfectly time with reality as the gate has fully closed. Perfect!

So the only remaining issue is the first one. I am now away from home and I cannot provide a log file. If needed, I could provide a log file tomorrow. Let me know. Thanks!

reinisb avatar Dec 27 '20 18:12 reinisb

OK maybe you can test tomorrow the following scenario: A) B) and then A) again. Only to make sure that the issue in A) is permanent or only appears once after booting hap and one "initial run".

If thats the case a can query the gate for the initial values at launch (query not operate) so all values are correct.

thkl avatar Dec 27 '20 18:12 thkl

Hey! I've been using the gate for the past few days and wanted to share my experience.

  1. About the issue mentioned in my previous comment. I cannot reproduce it consistently and it seems to happen randomly. I restarted hap and after the "initial run," it actually worked fine. Overall, this issue has happened only a few times so for now, I can live with that. If I will manage to reproduce it consistently, then I will let you know.
  2. There is actually one more issue. So, in about 50% of cases when I open the Home app on my phone, the gate device will query for a few seconds and instead of showing the status (Open or Closed), it will simply show No response (see the screenshot). If I then tap on the device in the Home app, then the gate will open/close correctly. So for some reason, there seems to be an issue with querying the status of the device (?). I must add that I have additional homekit devices that are not run through hap and they always query correctly. This makes me think that the issue lies within hap. Also, worth mentioning that the raspberry pi running raspberrymatic+ hap is connected to my router via ethernet (overall, the network at my home is rock solid). Do you have any ideas what might be causing this? Is there perhaps some additional logging I could run to track these "No response" cases? IMG_7469 2

reinisb avatar Jan 01 '21 20:01 reinisb

are there any .crash files in /etc/config/addons/hap-homematic maybe related to a recent "no response" event

thkl avatar Jan 01 '21 20:01 thkl

Unfortunately, there seem to be no .crash files. Is there anything else I can do to log the cases? Screen Shot 2021-01-01 at 23 45 35

reinisb avatar Jan 01 '21 21:01 reinisb

Hello,

Now Ive got the same problem. But the problem is not the PlugIn. Its the CCU. Do you have the same issue?

CABFDEBA-03CD-46EF-8E18-B5E055674DDD

gerd2005 avatar Jan 05 '21 12:01 gerd2005

Do you have the same issue?

No, I do not have this issue. The only issue I have is that ~every second time I open the Home app, the gate shows No response.

reinisb avatar Jan 05 '21 12:01 reinisb

#218 #314 Ich had this issues that are fixed by thkl.

My garagedoor is working very well! Siri / CCU / HomeKit everything korrekt.

CCU is Running on raspberrymatic 3.53.30.20201024

does one of you run the new 3.55.5.20201226

meistermolli avatar Jan 05 '21 22:01 meistermolli

@thkl I wanted to let you know that still to this day in the vast majority of cases the garage door is Home app is not responding and overall it totally unreliable. As a result, I am only using the original Horman physical remote to open/close gates, which is dissapointing.

Moreover, if try to control the garage door via raspberrymatic web interface, then it works perfectly fine in 100% of the cases. Also, other homekit devices that are not using hap-homematic work perfectly fine as well. Hence I am certain that the problem is with how hap-homematic interfaces with the garage door device.

I am determined to help you solve this. Could you please let me know what logs/info you need? Thanks!

reinisb avatar Jul 21 '21 14:07 reinisb

Are u able to ssh into the pi and run the hap daemon via command line : https://github.com/thkl/hap-homematic/wiki/Troubleshooting#running-the-daemon-from-the-commandline

if there are any exceptions the will show up at the console

thkl avatar Jul 21 '21 14:07 thkl

Are u able to ssh into the pi and run the hap daemon via command line : https://github.com/thkl/hap-homematic/wiki/Troubleshooting#running-the-daemon-from-the-commandline

if there are any exceptions the will show up at the console

Alright, I did exactly that. I've attached the full log and below I've pasted the lines where I did some specific action. I hope you will be able to spot the issue. hap-homematic.log

  1. The gate was closed.

  2. I initiated gate opening from RaspberryMatic web interface. Gate opened. In Home app it showed Not responding and the icon never changed to Open in Home app. [Wed Jul 21 2021 18:21:38 GMT+0200 (CEST)] [HAP Server] [RPC] event for HmIP-RF.00241BE989E476:0.CONFIG_PENDING with value false

  3. I initiated gate closing from RaspberryMatic web interface. Gate closed. In Home app it still showed as Not responding and the icon never changed to Closed in Home app. [Wed Jul 21 2021 18:22:52 GMT+0200 (CEST)] [HAP Server] [RPC] event for HmIP-RF.00241BE989E476:0.CONFIG_PENDING with value false

  4. I relaunched the Home app on my iPhone, it fetched the gate's status and now correctly showed that the gate is Closed in Home app. [Wed Jul 21 2021 18:25:02 GMT+0200 (CEST)] [HAP Server] [HomeMaticGarageDoorOpenerAccessory] 00241BE989E476 buildAddress DOOR_STATE

  5. I now pressed the gate icon inside the Home app hoping that it would start opening the gate, but nothing happened - the gate did not start opening, and also there were no entries recorded in the log. The Home app simply showed No response.

  6. I relaunched the Home app 3 times, and tried the previous step and now with the 4th try the gate suddenly started opening. The gate opened, but the Home app showed Not responding. I relaunched the app, it fetched gate's status, and now it correctly showed Open in the Home app.

[Wed Jul 21 2021 18:29:04 GMT+0200 (CEST)] [HAP Server] [HomeMaticGarageDoorOpenerAccessory] 00241BE989E476 buildAddress DOOR_STATE

  1. I then pressed the Open gate icon in the Home app and it started closing the gate and was showing Closing... during that time. At the end it correctly showed Closed. This step was correct! End of log!

[Wed Jul 21 2021 18:31:20 GMT+0200 (CEST)] [HAP Server] [HomeMaticGarageDoorOpenerAccessory] 00241BE989E476 Homekit Door Command 1; also set internal working to true

reinisb avatar Jul 21 '21 16:07 reinisb

Hi, thanks for the log. Since I do not own such a device all here is guessing. I've found a interesting thing at launch:

[Wed Jul 21 2021 18:20:26 GMT+0200 (CEST)] [HAP Server] [CCU] event HmIP-RF.00241BE989E476:1.PROCESS will be handled by 1 registered callback
[Wed Jul 21 2021 18:20:26 GMT+0200 (CEST)] [HAP Server] [HomeMaticGarageDoorOpenerAccessory] 00241BE989E476 working status is false update current door status to undefined
[Wed Jul 21 2021 18:20:26 GMT+0200 (CEST)] [HAP Server] [HomeMaticGarageDoorOpenerAccessory] 00241BE989E476 updating Current Door State to undefined (false)

I do register two datapoints, PROCESS and DOOR_STATE for any event notification. During this process hap is querying these datapoints. The first DP is PROCESS but as there is no information about the current door state hap sends a undefined back to HomeKit. Maybe this will confuse HK cause this is an invalid value.

I've done 2 things :

  • I've changed the sequence for the DP registration to register DOOR_STATE first
  • and if there is no current door state hap will not report an invalid value back to HK

So maybe this will fix your issue ... (commit above) It all corresponds to your steps above. HomeKit will show an error until you do an active query of the states (force quit the app or pull to refresh or so). At this point hap will query the ccu for the DOOR_STATE and report the correct value back.

If not I have to dive again into your log file ....

thkl avatar Jul 21 '21 19:07 thkl

and there was another bug, introduced by the lates code change ;/

thkl avatar Jul 21 '21 19:07 thkl

Thanks - I updated the file and at first glance, it seems to be working properly. Thank you!! I will use it for some days and report back if there will be any issues.

reinisb avatar Jul 22 '21 07:07 reinisb

A quick update. Whenever I launch the Home app, it will first show that my accessories are Updating... which makes sense as it is actively querying. However, after a few seconds it will almost always state the garage door has No Response. If I relaunch the app several times, then on average on the third try it will finally correctly state that the garage door is Closed or Open. In the attached video it happened on the second try, but normally it takes more tries than that. Worth mentioning that with the other accessory I have (it is not run through RaspberyMatic+hap-homematic), it shows the correct state every time I launch the app.

Do you have any idea of why this is happening with the garage door?

https://user-images.githubusercontent.com/6346595/126625109-7880f270-8b0b-4e8c-8946-2c1461cfdbd6.MP4

reinisb avatar Jul 22 '21 10:07 reinisb

Launching the app will query all characteristics for the current active view in Home. So in such a Case hap will ask the ccu for actual data and report that back to HK. Are you able to generate a log for this ?

thkl avatar Jul 22 '21 11:07 thkl

Hey @thkl ! I wanted to let you know that the issue described/shown in my Jul 22 comment is still happening every day. It is pretty frustrating.

I noticed that there is a different project that has built a logic for the same HmIP-MOD-HO accessory, but in homebridge. I was thinking if maybe you could please have a look at their logic and perhaps spot any notable differences that you could implement into hap-homematic? It seems that their logic is very solid and according to their users they never experience the "No response" issue.

Code here. Discussion here.

reinisb avatar Dec 02 '21 12:12 reinisb

My Garage door is still working very well!

Open / Closed / Ventilation With a Little lag of the Ventilation Button. -20sec.

You CanbSee the closing Status on the Pictures „Schließt“ means „ actualy closing „

F469EC23-4B85-4E6D-86AC-6606A3094C80

A39FF9F0-1D1F-49B8-B14E-16B04348C4BF

91A5F738-F93F-4052-99E6-2F0BD15248E1 EB3B18C4-6912-490A-88A8-4FD56428B61B

meistermolli avatar Dec 02 '21 14:12 meistermolli

@meistermolli Thanks for sharing! Are you using RaspberryMatic or a CCU3? Also, can you confirm that you never see the "No response" error (like in the video below)?

https://user-images.githubusercontent.com/6346595/126625109-7880f270-8b0b-4e8c-8946-2c1461cfdbd6.MP4

reinisb avatar Dec 02 '21 14:12 reinisb

To check this behavior I will need a debug log. Can u please enable the debugging log; force kill the home app and relaunch it. So I am able to check which request from HomeKit is unanswered by the hap daemon.

thkl avatar Dec 02 '21 14:12 thkl

I use the newest raspberrymatic and dont have your issues.

https://www.icloud.com/sharedalbum/#B0yGgZLKuGmabT3

meistermolli avatar Dec 02 '21 15:12 meistermolli

@thkl I started over with a clean install of RaspberryMatic in docker on myraspberry pi and also just now installed hap-homematic. The problem is that I cannot access the hap-homematic settings page. In the URL it shows #blocked. I tried also in incognito without browser extensions, the same issue. Any ideas?

Update: I guess docker container is causing this, I'll try to figure that out. Update 2: I opened the ports on docker, now I can access hap-homematic web UI by entering the URL in the browser directly (http://raspberrypi.local:9874/?sid=@VX9hG4odu6@), but when I try to access from those links below then it still shows #blocked in the URL.

https://user-images.githubusercontent.com/6346595/144599412-6e3866c8-9351-4235-8faa-c94cab57432e.mov

reinisb avatar Dec 03 '21 12:12 reinisb