Closed rezizter closed 4 years ago
The following pattern should work:
"statusPattern": "@456gtr(.|\n)*value\": 1(.|\n)*@123df5"
Note the structure. We check that the response somewhere should contain @456gtr
then there can be any possible character ((.|\n)*
, including line break) followed by value": 1
. If you would leave out the rest it would also match when @456gtr is off and @123df5 is on. So we also include the fact that after the matching value field there still needs to be the @123df5 in the response.
This is one way of doing it. And it assumes that the order of the above entires does not change (meaning @123df5 will always come after @456gtr). You could also try to match the opening and closing brackets, will probably be more error prone but will also require a much more complex pattern I guess.
Thank you for the reply.
"statusPattern": "@456gtr(.|\n)*value\":
1(.|\n)*@123df5`
Should I add quotes or anything at the back?
quotes yes 😅 corrected it
Seems to still be struggling with seeing on and off. If I turn a light on, then reboot homebridge, it shows the status as off.
I have run the server in debug, but dont see the error. IS there a way to debug statusPattern?
You can enable the debug option in the config of the plugin, this will show detailed information what the http server responds with and what if the pattern matches or doesn't.
Works like a charm, I had a typo on my side, your regex is perfect. Thank you soo much for this plugin and the assistance!
Hi I have a status that is very unstructured
The entries @678ftp , @456gtr and @123df5 are the relay devices. "value": 0 is the status of on or off (shows 1 when on)
what is the correct way to search for a device and then it's status using statusPattern?
On and off works perfectly it is the status that is not working. I have the following: