Hi.
I am using ESP ( nodemcu wifi chip ) to controll some relays. I can make a HTTP Device to turn on and off relays.
But cant get status polling to work.
What is the expected respons?
If Http://<IP_to_ESP>/status will return on or off in my web browser depending on the replay status.
How do i bind this to the HTTP device?
Do i need to put something in "Inline Javascript to parse incoming data to 'on'/'off' strings"
HTTP Device Status
Re: HTTP Device Status
if output is on/off, no need for inlne JS code.
Re: HTTP Device Status
Hi, this is how I managed that with NodeMCU and ESP Easy firmware
- Attachments
-
- Screenshot_2017-02-28-11-37-16-623_com.app.zwave.zway_control.png (114.66 KiB) Viewed 9909 times
Re: HTTP Device Status
But how should the response look like?
Simple text or XML response?
the z-way log :
[2017-02-28 12:48:26.581] [core] Can not make request: Server returned nothing (no headers, no data)
[2017-02-28 12:48:36.592] [core] Can not make request: Server returned nothing (no headers, no data)
[2017-02-28 12:48:46.610] [core] Can not make request: Server returned nothing (no headers, no data)
[2017-02-28 12:48:56.601] [core] Can not make request: Server returned nothing (no headers, no data)
How does your ESP code looks like for sending the status?
I have a simple "Send"
conn:on("connection",function(conn, payload)
conn:send("on"..
"HTTP/1.1\r\n"..
"Host: x.x.x.x\r\n"..
"Accept: */*\r\n"..
"Authorization: Basic xxxxxxxxxxxxx\r\nAccept: */*\r\n\r\n"..
"User-Agent: Mozilla/4.0 (compatible; esp8266 Lua;)"..
"\r\n\r\n")
end)
Simple text or XML response?
the z-way log :
[2017-02-28 12:48:26.581] [core] Can not make request: Server returned nothing (no headers, no data)
[2017-02-28 12:48:36.592] [core] Can not make request: Server returned nothing (no headers, no data)
[2017-02-28 12:48:46.610] [core] Can not make request: Server returned nothing (no headers, no data)
[2017-02-28 12:48:56.601] [core] Can not make request: Server returned nothing (no headers, no data)
How does your ESP code looks like for sending the status?
I have a simple "Send"
conn:on("connection",function(conn, payload)
conn:send("on"..
"HTTP/1.1\r\n"..
"Host: x.x.x.x\r\n"..
"Accept: */*\r\n"..
"Authorization: Basic xxxxxxxxxxxxx\r\nAccept: */*\r\n\r\n"..
"User-Agent: Mozilla/4.0 (compatible; esp8266 Lua;)"..
"\r\n\r\n")
end)
Re: HTTP Device Status
I'm using ESP Easy firmware, and I've used their documentation. Request returns JSON-format responce, I can make some screenshots when I will get home later today
Re: HTTP Device Status
There is the screenshot how does the request looks like. All you need is just to parse "state" value
- Attachments
-
- IMG_20170228_190246.jpg (43.48 KiB) Viewed 9886 times
Re: HTTP Device Status
I have tried all possible command and cant get it to work.
I have now access and communication to the z-way server.
But when it check for status it always turns the switch off.
I have now access and communication to the z-way server.
But when it check for status it always turns the switch off.
- Attachments
-
- Http device config for status
- z-way.PNG (5.93 KiB) Viewed 9882 times
-
- If I check status from my broswer on z-way device
- device.PNG (8.82 KiB) Viewed 9882 times
-
- The respons in my web browser when i enter ESP IP
- web.PNG (502 Bytes) Viewed 9882 times
-
- The lua code is ESP
- lua.PNG (7.93 KiB) Viewed 9882 times
Re: HTTP Device Status
WOW!! Now it is working.
Keep it simple and this is the settings that work:
Keep it simple and this is the settings that work:
- Attachments
-
- inline java.PNG (5.9 KiB) Viewed 9881 times
-
- New Lua code.
- lua_new.PNG (5.22 KiB) Viewed 9881 times