Hi,
I'm using ESP Easy R48 on a Nodemcu 0.9, programmed with Arduino IDE, to get readings from a lipo powered soil moisture sensor into Domoticz. At first this was a problem, because despite my dummy humidity device was updated every minute, the value in Domoticz remained 0 even though the webinterface of the esp easy showed the sensor was working and making measurements. Following this topic http://www.esp8266.nu/forum/viewtopic.php?t=190 and changing &svalue to &nvalue did the trick. Sensor is working and sending the right info to Domoticz.
Now my problem is that I can't use the value of the sensor in LUA or Blocky because it sees the sensorvalue as a string with a nill value. Does anyone has a clue on how to fix this? All suggestions are much apreciated!
How to use analog sensor value in LUA Domoticz
Moderators: grovkillen, Stuntteam, TD-er
SOLVED: How to use analog sensor value in LUA Domoticz
For those who might be interested, I've finaly found a workaround.
By running this .php script in crontab every 10 mins, the value of my virtual sensor is extracted from a json output in which the nvalue of the sensor is visible. Then that value is written to a uservariable in Domoticz, which can be used in events.
Just name it something like variables.php, put the script in your domoticz/script folder and make it executable using chmod +x
By running this .php script in crontab every 10 mins, the value of my virtual sensor is extracted from a json output in which the nvalue of the sensor is visible. Then that value is written to a uservariable in Domoticz, which can be used in events.
Code: Select all
#!/usr/bin/php
<?php
$todomoticz = "http://192.168.2.1:8080/json.htm?type=command¶m=updateuservariable&idx=25&vname=Kruiden&vtype=0&vvalue=";
$json_string = file_get_contents("http://192.168.2.1:8080/json.htm?type=devices&rid=138");
$parsed_json = json_decode($json_string, true);
$parsed_json = $parsed_json['result'][0];
$parsed_json = json_decode($json_string, true);
$parsed_json = $parsed_json['result'][0];
$hum = $parsed_json['Humidity'];
$todomoticz .= $hum;
$todomoticz = str_replace(' ', '_', $todomoticz);
$json = file_get_contents($todomoticz); // send json command to domoticz, and store the reply from domoticz
$parsed = json_decode($json); // process the reply
echo("result of script: " . $parsed->status . "\n"); // report to user
?>
Just name it something like variables.php, put the script in your domoticz/script folder and make it executable using chmod +x
Who is online
Users browsing this forum: No registered users and 16 guests