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?