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

Status not working? #92

Open
jcalmeida opened this issue Nov 2, 2018 · 4 comments
Open

Status not working? #92

jcalmeida opened this issue Nov 2, 2018 · 4 comments

Comments

@jcalmeida
Copy link

Hi,

I have my RaspberryPi 3 B+ with the homebridge and homebridge-http plugin to control my lights.

The On and Off features work perfectly, but I noticed that if I turned on the lights in the switch, the Home app didn't sync, saying the lights are off when they're on, so I created a new endpoint for the status_url.

This is my homebridge config.json file:
{
"bridge": {
"name": "Pi Homebridge",
"username": "CC:22:3D:E3:CE:30",
"port": 51826,
"pin": "123-45-678"
},
"platforms": [
],
"accessories": [
{
"accessory": "Http",
"name": "Hall Lamp",
"on_url": "http://raspberrypi.local:3000/home-api/lights/hall?state=on",
"off_url": "http://raspberrypi.local:3000/home-api/lights/hall?state=off",
"status_url": "http://raspberrypi.local:3000/home-api/lights/hall/state",
"status_on": {
"status":"1"
},
"status_off": {
"status":"0"
},
"http_method": "GET"
}
]
}

My http://raspberrypi.local:3000/home-api/lights/hall/state endpoint returns a json response like this: {"device":"lights","division":"hall","status":"0","message":"00010001 00000010"}, where status is "0" or "1".

My API logs are not detecting this endpoint being called. I assumed it was called when I opened the Home App, am I wrong? I can't seem to find the logs for the plug-in, only for the homebridge. Is there a different place rather than the homebridge.err and homebridge.log?

I'm running version 0.0.9 of the plugin, or at least is what sudo npm install -g homebridge-http gives me. However, index.js doesn't seem to be fully updated. It contains "this.status_url = config["status_url"];" but it doesn't contain " this.status_on = config["status_on"];"... weird.

Can anyone share any knowledge about this issue?
Thank you.

@jcalmeida
Copy link
Author

Update: I've updated manually my index.js to match the newest one. Can't figure out how to get it updated with npm install.

I've been looking through the code, and for what I've seen, I have to set "switchHandling": "yes", for it to call my status api everytime it opens the app.

So, now I'm a little bit closer to the solution, because my system is returning the correct state (on), but the home app is still showing the wrong state (off).

I'll keep you posted.

@jcalmeida
Copy link
Author

Ok, there seems to be an issue with the custom json response. I think I had it configured correctly, but it wasn't working. As soon as I changed my response to just "1" or "0", and set the config file accordingly, it started to work.

I'll keep the issue open, waiting for your comments, because I would like to have the json response instead of the simple 1 or 0.

Thanks.

@vesley
Copy link

vesley commented Jul 31, 2020

I have the same issue. My status URL responds with a JSON string. I configured the config.json with the correct filter. I see this on the log:

[beleuchtung] Power state is currently NaN

Is there anyway to debug the plugin?

@jcalmeida
Copy link
Author

fixed on the latest version. Note: when install, use the git version, not the repository one. It still hasn't been released

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

2 participants