HTTP Device Status

Discussions about RaZberry - Z-Wave board for Raspberry computer
Post Reply
sc-magnus
Posts: 11
Joined: 25 Feb 2017 01:55

HTTP Device Status

Post by sc-magnus »

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"
User avatar
PoltoS
Posts: 7565
Joined: 26 Jan 2011 19:36

Re: HTTP Device Status

Post by PoltoS »

if output is on/off, no need for inlne JS code.
IgoriokLT
Posts: 87
Joined: 09 Oct 2016 15:24

Re: HTTP Device Status

Post by IgoriokLT »

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
Screenshot_2017-02-28-11-37-16-623_com.app.zwave.zway_control.png (114.66 KiB) Viewed 9583 times
sc-magnus
Posts: 11
Joined: 25 Feb 2017 01:55

Re: HTTP Device Status

Post by sc-magnus »

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)
IgoriokLT
Posts: 87
Joined: 09 Oct 2016 15:24

Re: HTTP Device Status

Post by IgoriokLT »

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
IgoriokLT
Posts: 87
Joined: 09 Oct 2016 15:24

Re: HTTP Device Status

Post by IgoriokLT »

There is the screenshot how does the request looks like. All you need is just to parse "state" value
Attachments
IMG_20170228_190246.jpg
IMG_20170228_190246.jpg (43.48 KiB) Viewed 9560 times
sc-magnus
Posts: 11
Joined: 25 Feb 2017 01:55

Re: HTTP Device Status

Post by sc-magnus »

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. :?:
Attachments
Http device config for status
Http device config for status
z-way.PNG (5.93 KiB) Viewed 9556 times
If I check status from my broswer on z-way device
If I check status from my broswer on z-way device
device.PNG (8.82 KiB) Viewed 9556 times
The respons in my web browser when i enter ESP IP
The respons in my web browser when i enter ESP IP
web.PNG (502 Bytes) Viewed 9556 times
The lua code is ESP
The lua code is ESP
lua.PNG (7.93 KiB) Viewed 9556 times
sc-magnus
Posts: 11
Joined: 25 Feb 2017 01:55

Re: HTTP Device Status

Post by sc-magnus »

WOW!! Now it is working.
Keep it simple and this is the settings that work:
Attachments
inline java.PNG
inline java.PNG (5.9 KiB) Viewed 9555 times
New Lua code.
New Lua code.
lua_new.PNG (5.22 KiB) Viewed 9555 times
Post Reply