Cant execute bash script from dzvents
Posted: Thursday 18 October 2018 22:39
First of all i'm begginer =) I have Xiaomi Humidifier 2(air washer) and want to read information from Humidifier Sensors(t, %hum and water level), as base i used viewtopic.php?t=17498
I have corrected humidifier.js to recieve separated readings and make bash-script that send it to user variables in domoticz
then i try to execute this .sh form dzVents by this script
but nothing happenes, btw if i use this command from putty it update readings.
what i'm doing wrong?
I have corrected humidifier.js to recieve separated readings and make bash-script that send it to user variables in domoticz
Code: Select all
#!/bin/bash
(cd /home/pi/domoticz/scripts/Xiaomi
# Main Bedroom Humidifier
# Get the data
data_w=$(node humidifier.js 192.168.0.19 status_water)
data_t=$(node humidifier.js 192.168.0.19 status_t)
data_h=$(node humidifier.js 192.168.0.19 status_h)
# Sort it
w=$(echo "$data_w" | grep -o -E '[0-9]+')
t=$(echo "$data_t" | grep -o -E '[0-9]+')
h=$(echo "$data_h" | grep -o -E '[0-9]+')
# Load it into Domoticz
curl -s "http://192.168.0.2:8080/json.htm?type=command¶m=updateuservariable&vname=hum_water_lvl&vtype=0&vvalue=${w}"
curl -s "http://192.168.0.2:8080/json.htm?type=command¶m=updateuservariable&vname=hum_t&vtype=0&vvalue=${t}"
curl -s "http://192.168.0.2:8080/json.htm?type=command¶m=updateuservariable&vname=hum_h&vtype=0&vvalue=${h}"
)&
Code: Select all
local command = '/home/pi/domoticz/scripts/Xiaomi/humidifier_uv_update.sh'
os.execute(command)
what i'm doing wrong?