Page 1 of 1
Virtual device over api from esp8266
Posted: 23 Oct 2022 09:58
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 ?
Re: Virtual device over api from esp8266
Posted: 23 Oct 2022 19:38
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");
}
}
//-----------------------------------------------------
Re: Virtual device over api from esp8266
Posted: 24 Oct 2022 12:31
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 ?
Re: Virtual device over api from esp8266
Posted: 24 Oct 2022 14:17
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 !
Re: Virtual device over api from esp8266
Posted: 24 Oct 2022 16:53
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...