Closed tanami20 closed 3 years ago
not sure about escaping the quotes but I think your regex would just need to be "state":true
edit: changed success to state
edit2: just checked on my plugin installation: I'm using "statusPattern": "\"value\": true",
Tried this, however it is still not picking up the status. I turned the debug flag to on.
In below example, on first load I open the home app when the light is off. I then turn the light on, and then I quit the home app.
When I next open the home app, I expect to see the Home app knows it is on, but instead it thinks it is off, even though the JSON state is showing in the code it is on.
So the pattern match must not be working.
[19/04/2021, 5:03:54 pm] Homebridge v1.3.3 (Homebridge C7A0) is running on port 51288. [19/04/2021, 5:03:55 pm] [Eve Lights] getPowerState() request returned successfully (200). Body: '{"success":true,"state":false}' [19/04/2021, 5:03:55 pm] [Eve Lights] getPowerState() power is currently OFF [19/04/2021, 5:04:21 pm] [Eve Lights] getPowerState() request returned successfully (200). Body: '{"success":true,"state":false}' [19/04/2021, 5:04:21 pm] [Eve Lights] getPowerState() power is currently OFF [19/04/2021, 5:04:43 pm] [Eve Lights] setPowerState() Successfully set power to ON. Body: '{"success":true}' [19/04/2021, 5:05:01 pm] [Eve Lights] setPowerState() Successfully set power to OFF. Body: '{"success":true}' [19/04/2021, 5:05:06 pm] [Eve Lights] setPowerState() Successfully set power to ON. Body: '{"success":true}'
// Close home app on iPhone, open again, and even though the state is TRUE, meaning on, it on the next line interpret that as the status is its turned off when it is actually on. [19/04/2021, 5:05:14 pm] [Eve Lights] getPowerState() request returned successfully (200). Body: '{"success":true,"state":true}' [19/04/2021, 5:05:14 pm] [Eve Lights] getPowerState() power is currently OFF
I currently have these two lines:
"statusPattern": "\"state\": true", "debug": "true",
The state text is escaped out with \ for the speech marks.
Can you send your entire config for this plugin?
{ "accessory": "HTTP-SWITCH", "name": "Driveway Gate", "switchType": "stateless", "timeout": 1000, "onUrl": "http://192.168.18.203/gate_gpio.php?trigger=on" }, { "accessory": "HTTP-LIGHTBULB", "name": "Eve Lights", "notificationID": "tenant-EveLight", "notificationPassword": "xxx", "statusPattern": "\"state\": true", "debug": "true", "onUrl": "http://192.168.1.1:51828/?accessoryId=switchEveStatus&state=true", "offUrl": "http://192.168.1.1:51828/?accessoryId=switchEveStatus&state=false", "statusUrl": "http://192.168.1.1:51828/?accessoryId=switchEveStatus", "auth": { "username": "admin", "password": "xxx" } }
didn't paste very well.
Image of config uploaded, easier to read.
this might be it: there's no space in the status reply. so try changing
"\"state\": true"
to
"\"state\":true"
That was it, amazing. Can't believe I didn't notice. Thanks so much!
Hi,
Thanks so much for this plugin. I have it almost working, and just wondering if you can assist.
I am using the plugin homebridge-http-webhooks for a switch control that is linked to light automation. When using the status URL of your plugin, the webhooks plugin is outputting this:
{"success":true,"state":false}
However your plugin is looking for a 1 or 0. When the light is on the state is true, and off it is false.
I am unsure as I don't know regex very well, but what should the statusPattern rule be to replace the output to work with your plugin? Any help greatly appreciated.