I’ve done it ! Finally completed installation of DomotiGa and SmartVISU. Below are only screenshots of draft setup as I still have to add some sensors and improvements, but it’s a start.
DomotiGa
As DomogiGa is not directly compatible with GPIO ports (and since it’s installed on a different server anyway), my DomotiGa sensors are actually Shell devices which point to Python scripts (which connect to a MySQL DB and return the value of each sensor). Each Shell device gets automatically updated every 300 sec in DomotiGa by default, so to ensure I get live data I have added JSON-RPC calls in my GPIO script:
My GPIO Python script calls a bash file that contains the JSON-RPC Call:
curl -sS -X POST -H "Content-Type: application/json" -H "Accept: application/json" -d '{"jsonrpc": "2.0", "method": "device.set", "params": {"device_id": 2, "value": "On"}, "id": 2}' [server_ip_address]:9090
(I always send the value “On” but since DomotiGa will run the Python script following the JSON-RPC call it doesn’t matter)
My Python script for DomotiGa Shell Device:
import MySQLdb as mdb
con = mdb.connect(sqlhost, sqlusername, sqlpassword, sqltable)
cur = con.cursor()
cur.execute("SELECT pinStatus FROM pinStatus WHERE pinNumber=22")
row = cur.fetchone()
if(row[0] == '1'):
print "On"
else:
print "Off"
con.close()
My SmartVISU page contains this type of script for each device:
{{ basic.symbol('PIR1_Off', 'PIR1_switch', 'PIR 1', icon1~'message_presence.png', 0) }}{{ basic.symbol('PIR1_On', 'PIR1_switch', 'PIR 1', icon1~'message_presence_active.png', 1) }}