Welcome to Smart Home Forum by FIBARO
Dear Guest,
as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.
As a member you can:
- Start new topics and reply to others
- Follow topics and users to get email updates
- Get your own profile page and make new friends
- Send personal messages
- ... and learn a lot about our system!
Regards,
Smart Home Forum by FIBARO Team

Question
Ucciogenerale 2
After the implementation of the usefull scheduler provided from Robmac, I defined an alarm panel (see the attachment) in order to update the timing set in a global variable instead of changing it always through the code.
First of all you have to define a multiple global variable type HH:MM
Then you can define a virtual device with labels and buttons.
In the main loop of the virtual device you can set the code to show in the label.
e.g. in my case
---------------MAIN LOOP CODE-----------
local newora = fibaro:getGlobalValue("Sveglia")
H = string.sub(newora, 1, 2)
M = string.sub(newora, 4, 5)
if tonumber(H) < 23
then
H = tonumber(H) + 1
else H = 0
end
if string.len(H) < 2
then H = string.format("%s%s", '0', H)
else
end
newora = string.format("%s:%s", H, M)
fibaro:setGlobal("Sveglia", newora);
---------------END MAIN LOOP CODE-----------
and the buttons to change the hours and minutes (HH:MM)
e.g. in my case the wakeup time to start a scene using the Robmac scheduler
----------BUTTON 1 H[+]--------------------------------------
local newora = fibaro:getGlobalValue("Sveglia")
H = string.sub(newora, 1, 2)
M = string.sub(newora, 4, 5)
if tonumber(H) < 23
then
H = tonumber(H) + 1
else H = 0
end
if string.len(H) < 2
then H = string.format("%s%s", '0', H)
else
end
newora = string.format("%s:%s", H, M)
fibaro:setGlobal("Sveglia", newora);
----------END BUTTON 1 H[+]--------------------------------------
Consequently the other buttons are simple to retrieve.
------------------[H-]---------------------------
local newora = fibaro:getGlobalValue("Sveglia")
H = string.sub(newora, 1, 2)
M = string.sub(newora, 4, 5)
if tonumber(H) > 0
then
H = tonumber(H) - 1
else H = 23
end
if string.len(H) < 2
then H = string.format("%s%s", '0', H)
else
end
newora = string.format("%s:%s", H, M)
fibaro:setGlobal("Sveglia", newora);
------------------[H-] END---------------------------
------------------[M+]---------------------------
local newora = fibaro:getGlobalValue("Sveglia")
H = string.sub(newora, 1, 2)
M = string.sub(newora, 4, 5)
if tonumber(M) < 50
then
M = tonumber(M) + 10
else M = 0
end
if string.len(M) < 2
then M = string.format("%s%s", '0', M)
else
end
newora = string.format("%s:%s", H, M)
fibaro:setGlobal("Sveglia", newora);
------------------[M+] END---------------------------
------------------[M-]---------------------------
local newora = fibaro:getGlobalValue("Sveglia")
H = string.sub(newora, 1, 2)
M = string.sub(newora, 4, 5)
if tonumber(M) > 0
then
M = tonumber(M) - 10
else M = 50
end
if string.len(M) < 2
then M = string.format("%s%s", '0', M)
else
end
newora = string.format("%s:%s", H, M)
fibaro:setGlobal("Sveglia", newora);
------------------[M-] END---------------------------
Then to submit to the Robmac scheduler immediately the defined time (you can force but if I well understood the scheduler refreshes every 12 hours automatically) the last button "UPDATE".
------------Button UPDATE------------
fibaro:killScenes()
fibaro:startScene()
------------END Button UPDATE------------
Regards
Marco
PS: Due to a technical Fibaro's website problem I am not currently able to upload the picture sample above mentioned.
I will post it later as soon as the "Technical maintenance warning will disappear".
[ Added: 2013-09-09, 22:08 ]
here is the image
Please login or register to see this attachment.
4 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.