ciao fabio
io sto smanettando un pochino con domoticz e per l'importazione dei dati di metern e 123solar uso questo script (modificato da altro script di gianfranco)
i meternxx e produzionexx sono i file creati in shm
e il 192.168.0.52:8080 è l'indirizzo ip del server domoticz
ciao
io sto smanettando un pochino con domoticz e per l'importazione dei dati di metern e 123solar uso questo script (modificato da altro script di gianfranco)
Codice PHP:
#!/bin/sh
V=`cat /run/shm/metern1.txt | egrep "^1_1\(" | grep "*V)" | egrep -o '[0-9]*(\.)?[0-9]*\*' | egrep -o '[0-9]*(\.)?[0-9]*'`
A=`cat /run/shm/metern1.txt | egrep "^1_2\(" | grep "*A)" | egrep -o '[0-9]*(\.)?[0-9]*\*' | egrep -o '[0-9]*(\.)?[0-9]*'`
HZ=`cat /run/shm/metern1.txt | egrep "^1_3\(" | grep "*Hz)" | egrep -o '[0-9]*(\.)?[0-9]*\*' | egrep -o '[0-9]*(\.)?[0-9]*'`
CF=`cat /run/shm/metern1.txt | egrep "^1_4\(" | grep "*F)" | egrep -o '[0-9]*(\.)?[0-9]*\*' | egrep -o '[0-9]*(\.)?[0-9]*'`
W=`cat /run/shm/metern1.txt | egrep "^1\(" | grep "*W)" | egrep -o '[0-9]*(\.)?[0-9]*\*' | egrep -o '[0-9]*(\.)?[0-9]*'`
P=`cat /run/shm/produzione2.txt | egrep "^2\(" | grep "*Wh)" | egrep -o '[0-9]*(\.)?[0-9]*\*' | egrep -o '[0-9]*(\.)?[0-9]*'`
W1=`cat /run/shm/metern10.txt | egrep "^10\(" | grep "*W)" | egrep -o '[0-9]*(\.)?[0-9]*\*' | egrep -o '[0-9]*(\.)?[0-9]*'`
W2=`cat /run/shm/metern12.txt | egrep "^12\(" | grep "*W)" | egrep -o '[0-9]*(\.)?[0-9]*\*' | egrep -o '[0-9]*(\.)?[0-9]*'`
W3=`cat /run/shm/metern11.txt | egrep "^11\(" | grep "*W)" | egrep -o '[0-9]*(\.)?[0-9]*\*' | egrep -o '[0-9]*(\.)?[0-9]*'`
curl -s "http://192.168.0.52:8080/json.htm?type=command¶m=udevice&idx=1&nvalue=0&svalue=$V"
curl -s "http://192.168.0.52:8080/json.htm?type=command¶m=udevice&idx=2&nvalue=0&svalue=$A"
curl -s "http://192.168.0.52:8080/json.htm?type=command¶m=udevice&idx=3&nvalue=0&svalue=$W"
curl -s "http://192.168.0.52:8080/json.htm?type=command¶m=udevice&idx=4&nvalue=0&svalue=$P"
curl -s "http://192.168.0.52:8080/json.htm?type=command¶m=udevice&idx=5&nvalue=0&svalue=$W1"
curl -s "http://192.168.0.52:8080/json.htm?type=command¶m=udevice&idx=6&nvalue=0&svalue=$W2"
curl -s "http://192.168.0.52:8080/json.htm?type=command¶m=udevice&idx=7&nvalue=0&svalue=$W3"
curl -s "http://192.168.0.52:8080/json.htm?type=command¶m=udevice&idx=8&nvalue=0&svalue=$HZ"
curl -s "http://192.168.0.52:8080/json.htm?type=command¶m=udevice&idx=9&nvalue=0&svalue=$CF"
e il 192.168.0.52:8080 è l'indirizzo ip del server domoticz
ciao
Commenta