Witam.
scena typu BEGINER tak więc proszę o wyrozumiałość.
założenie jest takie:
Podczas otwierania i zamykania okien otrzymuję głosowy komunikat, podczas zamknięcia ostatniego okna komunikat informujący
o tym że zamknięte są wszystkie okna. Myślę że pomysł przydatny gdy zaczyna mocno wiać, można jeszcze dodać funkcje przypominająca o zamknięciu otwartych okien z warunków pogodowych itp.
kody są umieszczone w trzech oddzielnych scenach dla poszczególnych okien
i tutaj mam pytanie do zaawansowanych userów, walczyłem troszkę czasu i nie udało mi się połączyć to w jedną scenę, proszę o podpowiedź.
--[[
%% autostart
%% properties
75 value
%% globals
--]]
-- otwarcie i zamknięcie okna w salonie
local startSource = fibaro:getSourceTrigger();
if (( tonumber(fibaro:getValue(75, "value")) > 0 ) or startSource["type"] == "other")
then
fibaro:setGlobal("Komunikat", "Otwarto okno w salonie.");
fibaro:call(95, "pressButton", "1")
elseif (( tonumber(fibaro:getValue(75, "value")) == 0 ) or startSource["type"] == "other")
then
fibaro:setGlobal("Komunikat", "Zamknięto okno w salonie.");
fibaro:call(95, "pressButton", "1")
end
-----------------------------------------------------------------------------
druga scena
--[[
%% properties
71 value
%% globals
--]]
-- otwarcie i zamknięcie okna w.....
local startSource = fibaro:getSourceTrigger();
if (( tonumber(fibaro:getValue(71, "value")) > 0 ) or startSource["type"] == "other")
then
fibaro:setGlobal("Komunikat", "Otwarto okno w.....");
fibaro:call(95, "pressButton", "1")
elseif (( tonumber(fibaro:getValue(71, "value")) == 0 ) or startSource["type"] == "other")
then
fibaro:setGlobal("Komunikat", "Zamknięto okno w.....");
fibaro:call(95, "pressButton", "1")
end
--------------------------------------------------------------------------------
trzecia scena
--[[
%% properties
67 value
75 value
71 value
%% globals
--]]
-- otwarcie i zamknięcie okna w biurze
local startSource = fibaro:getSourceTrigger();
if (( tonumber(fibaro:getValue(67, "value")) > 0 ) or startSource["type"] == "other")
then
fibaro:setGlobal("Komunikat", "Otwarto okno w biurze.");
fibaro:call(95, "pressButton", "1")
elseif (( tonumber(fibaro:getValue(67, "value")) == 0 ) or startSource["type"] == "other")
then
fibaro:setGlobal("Komunikat", "Zamknięto okno w biurze.");
fibaro:call(95, "pressButton", "1")
end
if
tonumber(fibaro:getValue(75, "value")) == 0 and
tonumber(fibaro:getValue(71, "value")) == 0 and
tonumber(fibaro:getValue(67, "value")) == 0
then
fibaro:setGlobal("Komunikat", "Wszystkie okna zamknięte.");
fibaro:call(95, "pressButton", "1")
end