Virtual device over api from esp8266

Discussions about Z-Way software and Z-Wave technology in general
Post Reply
J.nissen
Posts: 111
Joined: 02 Sep 2016 22:12

Virtual device over api from esp8266

Post by J.nissen »

Hello,
I have an wlan Temperature Sensor wich an esp8266.
How can i Show the value in zwave ?
Can i send an api request to an virtual device ? , to transmit value ?
Greetings from germany
Jörg

Raspi 4(Buster), Zwave Version 4.1.1 Raz 7 Pro, Serial API Version:07.38(SDK 7.20)
micky1500
Posts: 298
Joined: 07 Feb 2016 16:29
Location: England

Re: Virtual device over api from esp8266

Post by micky1500 »

This command works from my Arduino device. Similar or same as esp8266.
----ZAutomation/api/v1/devices/HTTP_Device_switchMultilevel_276/command/exact?level=50

Have you already sorted out the password, login details.
You need to setup z-way virtual device as a Switch. You can't update a Sensor. (They look the same in GUI anyway).


See below how I build the string to send.
Hope it helps.

-----------------------------------------------------------------
void zwtemperature() //Tell zway the new temperature setting.
{
zwaydevice=(F("HTTP_Device_switchMultilevel_276"));
zwaycommand=(F("exact?level="));
zwaycommand=zwaycommand+thermostat+'"';
zwayset();
}
//-----------------------------------------------

void zwayset()
{
if (client.connect(server_zway, 8083)) //connect to zway
{
client.print(F("GET /ZAutomation/api/v1/devices/"));
client.print(zwaydevice);
client.print(F("/command/"));
client.print(zwaycommand); // "on" or "off" or "update"
client.println(F(" HTTP/1.0"));
client.println(F("Authorization: Basic YourBase64password")); //arduino BASE64 of 'username:password' (with unix eol converted using notepad++)
client.println();
getresponse();
}
else
{
//Serial.println("connection to z-way failed");
}
}
//-----------------------------------------------------
Raspi 4 - (Buster - 32 Bit) Zwave Version 4.1.1, Raz 7 Pro, Serial API Version: 07.38
J.nissen
Posts: 111
Joined: 02 Sep 2016 22:12

Re: Virtual device over api from esp8266

Post by J.nissen »

Hello Mickey,
thanks for your answer...
I want to update an Sensor device :-)


Is there any way do show an Value for an External Sensor ?
Greetings from germany
Jörg

Raspi 4(Buster), Zwave Version 4.1.1 Raz 7 Pro, Serial API Version:07.38(SDK 7.20)
micky1500
Posts: 298
Joined: 07 Feb 2016 16:29
Location: England

Re: Virtual device over api from esp8266

Post by micky1500 »

by PoltoS » 18 Mar 2020 21:03
you can change a switch, but not a sensor. Sensor is a read-only feature. switch is an actor and you can modify it's state.

I just tried sending the same command to a sensorMultilevel device.
The command is accepted ! but the sensor data is not updated.

As a work around, set your virtual device up as a Switch, it still shows the correct Temperature.

A harder alternative is to setup z-way as a Http sensorMultilevel
And get z-way to send the http request to your esp8266
Your esp8266 will need to be waiting for http commands, then your esp8266 will respond back to z-way with the Temperature reading.
This relies on z-way requesting the update. (you can get the esp8266 to tell z-way to request it updates the sensor)

It's been 2 years since I set this up.
Maybe someone else has found a better way since then !
Raspi 4 - (Buster - 32 Bit) Zwave Version 4.1.1, Raz 7 Pro, Serial API Version: 07.38
J.nissen
Posts: 111
Joined: 02 Sep 2016 22:12

Re: Virtual device over api from esp8266

Post by J.nissen »

Hello,
A harder alternative is to setup z-way as a Http sensorMultilevel
And get z-way to send the http request to your esp8266
Your esp8266 will need to be waiting for http commands, then your esp8266 will respond back to z-way with the Temperature reading.
This relies on z-way requesting the update. (you can get the esp8266 to tell z-way to request it updates the sensor)
That ist my way, so far ...

Thanks a lot...
Greetings from germany
Jörg

Raspi 4(Buster), Zwave Version 4.1.1 Raz 7 Pro, Serial API Version:07.38(SDK 7.20)
Post Reply