Comments (9)
Iโm gonna look into it. Please have some patience, since I got very little time at the moment.
from homebridge-http-switch.
Okay, thanks, then I'll wait for an answer from you.
from homebridge-http-switch.
So I tried testing your configuration and couldn't find mistakes. So you get a clear 'works on my machine' ๐
However I published an update v0.5.13 which prints some more debug information. Would be great if you could update your homebridge-http-switch
plugin and poste the log output. A snippet from everything printed when the plugin is loaded as well when a status requests is performed would be great.
Maybe you could also double check (with curl or something) if your pattern exactly matches the response from the shelly device. Every space or new line is relevant there.
Also the relevant json property from the response is 'ison' (isn't it?). Do the other properties change in runtime?
I noticed that this is some sort of Shelly Switch? I ordered some for me some weeks ago, they should get to me hopefully soon. Maybe I could help you more. However they need to arrive first ๐
Greets
from homebridge-http-switch.
so first I updatet the homebridge-http-switch
plugin to version 0.5.13
When I start homebridge
this is the output I get for homebridge-http-switch
:
as soon as homebridge is started, I open the "home" app on my smartphone, switch on the "shelly" ๐
and get the following output:
if I close the "Home" app now and open it again I get the following output
When I use curl (I hope I'm doing it right) I get the following message...
That's right. Itยดs a "shelly2".
Oh, that's great. I hope you get it soon ๐
Thanks for the great support.
I really appreciate that. ๐ฅ
from homebridge-http-switch.
Also the relevant json property from the response is 'ison' (isn't it?). Do the other properties change in runtime?
Thats right, "ison" is the relevant property..
I don't think the other parameters would change that way.
https://shelly-api-docs.shelly.cloud/#shelly-switch-relay-index
from homebridge-http-switch.
Okay as I assumed there is probably some sort of character encoding problem in the config. I could be wrong what the exact cause is. Could also be confusion about the config file on your side.
When you look closely into the logs where it prints the statusPattern which is configured you can read: '..."iseon":true....'
So please double check your config, maybe retype the specific part.
from homebridge-http-switch.
Thatยดs it ! ๐
Now everything is working ๐
But why didn't it work with this configuration before ?
Can you please help me ?
I dont know what I am doing wrong...[2018-11-22 09:06:42] [shelly2 2] Body of status response is: '{"ison":true,"has_timer":false,"overpower":false,"is_valid":true}'
[2018-11-22 09:06:42] [shelly2 2] Switch is currently OFFCan you please help me to find the right statusPattern?
My config now for the 2 Switches:
{
"accessory": "HTTP-SWITCH",
"name": "shelly2 1",
"switchType": "stateful",
"onUrl": {
"url": "http://192.168.1.207/relay/0?turn=on",
"method": "POST"
},
"offUrl": {
"url": "http://192.168.1.207/relay/0?turn=off",
"method": "POST"
},
"statusUrl": {
"url": "http://192.168.1.207/relay/0",
"method": "GET"
},
"statusPattern": "{\"ison\":true,\"has_timer\":false,\"overpower\":false,\"is_valid\":true}"
},
{
"accessory": "HTTP-SWITCH",
"name": "shelly2 2",
"switchType": "stateful",
"onUrl": {
"url": "http://192.168.1.207/relay/1?turn=on",
"method": "POST"
},
"offUrl": {
"url": "http://192.168.1.207/relay/1?turn=off",
"method": "POST"
},
"statusUrl": {
"url": "http://192.168.1.207/relay/1",
"method": "GET"
},
"statusPattern": "{\"ison\":true,\"has_timer\":false,\"overpower\":false,\"is_valid\":true}"
}
from homebridge-http-switch.
But why didn't it work with this configuration before ?
I have absolutely no idea ๐ But happy to hear, that it works now.
A little 'pro' tip, I don't know how well you know regex pattern. But in your case it would be enough to set the statusPattern to "\"ison\":true"
. This would ensure that the pattern matching is unaffected when the other values of the json changes somehow.
The pattern is matched if the pattern is contained in the text you want to test. Otherwise if you want to be sure that the complete response matches your body you can prepend ^
and append $
to your pattern wich match to the beginning or the end of a string.
Don't know if I explained it well enough, what I mean with that is that the pattern true
matches the text 'true' as well as 'asdtrue asdkw'. However the pattern ^true$
only matches the first one.
from homebridge-http-switch.
Just for reference:
This worked for me (Shelly Dimmer):
{
"accessory": "HTTP-SWITCH",
"name": "NAME",
"switchType": "stateful",
"onUrl": {
"url": "http://192.168.X.X/light/0?turn=on",
"method": "POST"
},
"offUrl": {
"url": "http://192.168.X.X/light/0?turn=off",
"method": "POST"
},
"statusUrl": {
"url": "http://192.168.X.X/light/0",
"method": "GET"
},
"statusPattern": "\"ison\":true"
}
from homebridge-http-switch.
Related Issues (20)
- Authentication Problem HOT 1
- Another StatusPattern help request HOT 1
- Error on Stateful switch. HOT 1
- Sending JSON body HOT 2
- Regex or Statuspattern bug? Full details and tests inside. Please help. HOT 1
- statusPattern not working as expected HOT 1
- Allow service type declarations in the accessory definition stubs
- Support custom HTTP method on `statusUrl`
- HowTo: Sending JSON via ntfy.sh HOT 2
- HowTo: to send a Curl API Request HOT 2
- Request for Help with POST HOT 5
- Homebridge UI support
- WWW-authentication issue HOT 6
- Turning on one switch change status of another HOT 1
- Add Multi-Switch Device HOT 2
- StatusPattern Help for Reolink Camera
- Keep getting `Error 422` upon setting switch state HOT 3
- Toggle Switch Auto-OFF
- URL in Series of URL is triggered twice
- Please implement a โFire and return quicklyโ option HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from homebridge-http-switch.