HTTP Device Status

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

HTTP Device Status

Post by sc-magnus » 25 Feb 2017 02:05

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: 4676
Joined: 26 Jan 2011 19:36

Re: HTTP Device Status

Post by PoltoS » 27 Feb 2017 23:42

if output is on/off, no need for inlne JS code.

IgoriokLT
Posts: 69
Joined: 09 Oct 2016 15:24

Re: HTTP Device Status

Post by IgoriokLT » 28 Feb 2017 14:40

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 4175 times

sc-magnus
Posts: 5
Joined: 25 Feb 2017 01:55

Re: HTTP Device Status

Post by sc-magnus » 28 Feb 2017 14:56

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: 69
Joined: 09 Oct 2016 15:24

Re: HTTP Device Status

Post by IgoriokLT » 28 Feb 2017 14:59

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: 69
Joined: 09 Oct 2016 15:24

Re: HTTP Device Status

Post by IgoriokLT » 28 Feb 2017 22:04

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 4152 times

sc-magnus
Posts: 5
Joined: 25 Feb 2017 01:55

Re: HTTP Device Status

Post by sc-magnus » 01 Mar 2017 00:40

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
z-way.PNG
Http device config for status
z-way.PNG (5.93 KiB) Viewed 4148 times
device.PNG
If I check status from my broswer on z-way device
device.PNG (8.82 KiB) Viewed 4148 times
web.PNG
The respons in my web browser when i enter ESP IP
web.PNG (502 Bytes) Viewed 4148 times
lua.PNG
The lua code is ESP
lua.PNG (7.93 KiB) Viewed 4148 times

sc-magnus
Posts: 5
Joined: 25 Feb 2017 01:55

Re: HTTP Device Status

Post by sc-magnus » 01 Mar 2017 01:07

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 4147 times
lua_new.PNG
New Lua code.
lua_new.PNG (5.22 KiB) Viewed 4147 times

Post Reply