http://domoticz.com/forum/viewtopic.php?f=21&t=11104
Just installing the HA-Bridge will allow you to trigger the lights using the Harmony. But switching the light in Domoticz will not give the Harmony (HABridge) new state information. Therefore I built my own "HABridge-Notifier" using LUA. Maybe it is useful for someone here:
LUA Code:
Code: Select all
t={}
t['C - Wall Plug Leselicht']={'Leselicht','211','1951577859'}
t['TV Switch']={'Fernseher','4','1200792111'}
t['Hue T1']={'Hue Table 1','37','1296398667'}
t['Hue T2']={'Hue Table 2','39','970283985'}
t['Hue S1']={'Hue Stehlampe','38','1551866107'}
t['Hue LivingColors 1']={'Hue Living Colors','40','957168100'}
t['Light Switch Office']={'Licht Buero','102','1272799582'}
t['Light Switch Living Room']={'Living Room Light','2','1820035260'}
for deviceName,deviceValue in pairs(devicechanged) do
if(t[deviceName] ~= nil) then
if(tostring(deviceValue)=='On') then
s=[[ batch/turnON1.sh]]..' '..t[deviceName][3]
elseif(tostring(deviceValue)=='Off') then
s=[[ batch/turnOFF2.sh]]..' '..t[deviceName][3]
elseif(deviceValue ~= nil) then
state='true'
dimN=tonumber(deviceValue:sub(11,13))
if(dimN~=nil) then
dim=tostring(math.ceil(dimN*2.55))
s=[[ batch/turnON2.sh]]..' '..state..' '..dim..' '..t[deviceName][3]
end
end
os.execute(s)
else
end
end
Depending on the action (On/Off/Dimming) I will trigger the according script. My HABridge is running on the same pi, Port 8099. In Windows domoticz waited for the OS.execute to close and I used the start command to trigger a new process - I assumed the RPI will have the same behaviour so I used nohup to get away from the console and save some ms...:
Off:
Code: Select all
nohup curl -H "Content-Type: application/json" -X PUT -d "{ \"on\": false }" http://127.0.0.1:8099/api/user/lights/$1/bridgeupdatestate -o curl.log
Code: Select all
nohup curl -H "Content-Type: application/json" -X PUT -d "{ \"on\": true }" http://127.0.0.1:8099/api/user/lights/$1/bridgeupdatestate -o curlO.log
Code: Select all
nohup curl -H "Content-Type: application/json" -X PUT -d "{ \"on\": $1, \"bri\": $2 }" http://127.0.0.1:8099/api/user/lights/$3/bridgeupdatestate -o curlO2.log