Domotica

Sono partito qualche anno fa con il sitema americano X10 che usava onde convogliate nella rete elettrica per arrivare

ad oggi al sistema su Z-Wave ( onde radio) e in particolare sul sistema della ditta Polacca Fibaro acquisita nel 2018

dalla italiana NICE, è un sistema molto particolare e aperto, si puo programmare in modo grafico ( a blocchi) o in alternativa

( e permette di tutto) attraverso il linguaggio LUA ( una specie di linguaggio C):

 

sys center

 

metto alcuni link per approfondire:

http://www.fibaro.com/it/sistema-fibaro

http://www.zwave-community.it/index.php

http://forum.fibaro.com/

http://www.domotique-fibaro.fr/

 

 

 

Esempio di Programmazione in LUA su Fibaro HC2

Di seguto un esempio di programmazione in LUA per accendere e spegnere ad orari programmati uno o più disposistivi

se l'ora e il giorno della settimana sono quelli indicati nei cicli IF mi esegue l'azione in questo accende alle 9.30 (prima if) o spegne alle 21,30 (seconda if) tutti i giorni il dispositivo con ID 201

il dispositivo identificato con ID 201 potrebbe essere ad esempio questo:

   e questo è il suo schema  

 

ed ecco il codice:

 

--[[

%% autostart

%% properties

%% globals

--]]


-- check script instance count in memory

if (fibaro:countScenes() > 1) then

fibaro:debug("Script already running.");

fibaro:abort();

end

fibaro:debug(os.date() .. " - Script start");

function tempFunc()

local currentDate = os.date("*t");

if ((currentDate.wday == 1 or currentDate.wday == 2 or currentDate.wday == 3 or currentDate.wday == 4 or currentDate.wday == 5 or currentDate.wday == 6 or currentDate.wday == 7) and (string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min) == "09:30") )then

fibaro:call(201, "turnOn");

fibaro:debug("ON");

-- qui posso inserire altre if con tempi diversi e dispositivi diversi....


end

if ((currentDate.wday == 1 or currentDate.wday == 2 or currentDate.wday == 3 or currentDate.wday == 4 or currentDate.wday == 5 or currentDate.wday == 6 or currentDate.wday == 7) and (string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min) == "21:30") )then


fibaro:call(201, "turnOff");

fibaro:debug("OFF");


-- qui posso inserire altre if con tempi diversi e dispositivi diversi....


end



setTimeout(tempFunc, 60*1000);

end