Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessory reachability #48

Closed
radionoise opened this issue Mar 3, 2019 · 17 comments
Closed

Accessory reachability #48

radionoise opened this issue Mar 3, 2019 · 17 comments

Comments

@radionoise
Copy link
Member

Can we have reachability feature implemented like in this homebridge mqtt plugin?
cflurin/homebridge-mqtt#9

@Shaquu
Copy link
Member

Shaquu commented Mar 3, 2019

We could if it’s cool :)
What is it really about?

@radionoise
Copy link
Member Author

radionoise commented Mar 3, 2019

It's about triggering "No Response" message manually and not only just when bridge is unavailable. Let's say, I have some sensor or switch. Node-RED is subscribed to MQTT topics to get updates (current temperature or switch status). I have trigger node which sends device availability status (true) and if it is not getting new data within 1 minute, it will send false as availability status which leads to "No response" message in Home.app on iOS. Here's a screenshot from Home.app from that thread: screenshot

And here is the example flow screenshot: example

I was using homebridge with mqtt plugin for that configuration, but it's too complicated compared to this nodered plugin, so it would be great to see this feature here :)

@NorthernMan54
Copy link
Contributor

NorthernMan54 commented Mar 3, 2019 via email

@radionoise
Copy link
Member Author

Maybe this will help? https://github.com/KhaosT/HAP-NodeJS/pull/556

@NorthernMan54
Copy link
Contributor

NorthernMan54 commented Mar 5, 2019 via email

@radionoise
Copy link
Member Author

radionoise commented Mar 5, 2019

Figured out how to trigger this event from code and submitted PR
#51

@crxporter
Copy link
Member

This sounds like a cool idea - how do I use it?!

For example I have an MQTT switch that is "not responding" - what do I send into homekit?

Reading the PR it seems like {"On":"NO_RESPONSE"} would work?

@radionoise
Copy link
Member Author

Exactly. You send "NO_RESPONSE" as a value for any valid characteristic and when you reopen Home.app or push the accessory icon and hold it for a while (it will open in fullscreen) its status will change to "not responding". As soon as any other valid value will be sent to Homekit, "not responding" status will go away.

For example, I use Trigger node which emits a message when there were no updates through MQTT within 1 minute.

@Shaquu
Copy link
Member

Shaquu commented Mar 5, 2019

#51 got merged to dev branch.
@radionoise as you are the author I assume it fits your needs.

@crxporter could you test it yourself and provide me some info here?

@crxporter
Copy link
Member

I’m not actually running a dev version anywhere right now - I’ll load it up at work tomorrow and try it!

@crxporter
Copy link
Member

I went ahead and installed the dev branch on one of my pi's at home and tested this - with mixed results.

Using switches - it works when sending {"On":"NO_RESPONSE"}

Using dimmers (light bulb service) - it works when sending {"On":"NO_RESPONSE"} but not {"Brightness":"NO_RESPONSE"}

  • Which characteristics will this work with?

Using occupancy detector - it works when sending {"OccupancyDetected":"NO_RESPONSE"}

Additionally I can only get the "NO_RESPONSE" to appear when reopening the home app, not when long-pressing the item in homekit as stated above. When keeping the Home app open and sending NO_RESPONSE causes my switch or dimmer to show "Off" and still be controllable in Home.

The "recovery" from "no response" status back to a functioning item is pretty good, I can get it back by long-pressing, swiping to another room then back, or closing and reopening the app.

Conclusion - this looks like it works with SOME characteristics (I tested with "on" for both switch and dimmer services also tested with "OccupancyDetected" for occupancy sensor) and it will show an error when opening the Home app (tested on iphone and computer). It doesn't update while inside of the app (have to quit and reopen) and it doesn't "automatically" update back to good status - (have to long press or change screens).

I like it!

I'll use this to sort through my startup statuses, they always return "NULL" between boot of my pi and the first poll event (up to 10 minutes). During boot I will be able to see whether any item has been polled yet. This looks like it will work really well for long-lasting errors like boot-up or offline devices as @radionoise described as MQTT offline for over 1 minute.

@radionoise
Copy link
Member Author

It seems that NO_RESPONSE value will take effect only with required characteristics but not optional ones.

@radionoise
Copy link
Member Author

radionoise commented Mar 6, 2019

@crxporter You're right about controlling device after NO_RESPONSE was set and Home.app was not restarted. Perhaps we should keep some state in the service that NO_RESPONSE was triggered. I did some research and right now here is the problem after triggering NO_RESPONSE and not reopening Home.app:

  • Turning switch OF does not fire "characteristic-change" event.
  • Turning switch ON fires two events simultaneously (one for previous OFF and one for ON).
  • We can preserve NO_RESPONSE state and send it to Homekit again if it was not recovered properly, but we'll see the result after we open Home.app when Light was ON.

I'll try to investigate further.

@NorthernMan54
Copy link
Contributor

NorthernMan54 commented Mar 6, 2019 via email

@crxporter
Copy link
Member

It seems that NO_RESPONSE value will take effect only with required characteristics but not optional ones.
After thinking about it more that was my guess as well.

Like I said - I like this idea. Once it's "figured out" it'll be pretty cool. It seems like you're headed in the right direction.

@radionoise
Copy link
Member Author

radionoise commented Mar 9, 2019

I'm glad to say that NO_RESPONSE feature was improved in this PR: #58.

@Shaquu
Copy link
Member

Shaquu commented Mar 11, 2019

I am closing this Issue.

Improvement merged into dev. Made by @radionoise and confirmed by @crxporter - thanks guys!

If you have a problem then first head to this section in README.
If it didn't help then feel free to open new Issue.

@Shaquu Shaquu closed this as completed Mar 11, 2019
@Shaquu Shaquu mentioned this issue Mar 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants