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
muc 1
I found a VD with a button's code:
-- SYNCHRONIZATION TIME CONFIGURATION ----
...
ntpServer = "..."
...
local HC2 = Net.FHttp("127.0.0.1", 11111);
-- get current location settings
result ,status2, errorCode2 = HC2:GET("/api/settings/location");
--- checking
if (tonumber(status2)==200) then
response = json.decode(result);
response.ntpServer = ntpServer;
response.ntp = true;
...
-- set with new settings
local payload = json.encode(response);
local response, status, errorCode = HC2:PUT("/api/settings/location", payload);
...
and the main loop's code:
local syncTime = "03:03";
local currentTime = os.date("%H:%M");
...
if (currentTime == syncTime)
then
fibaro:call(id, "pressButton", ...);
end
fibaro:sleep(60000);
Can this (HC2=..., HC2:GET, HC2:PUT) be translated into a code which runs in a scene ?
(function xy() instead of button's code and setTimeout(.., xy) instead of main loop)
Thanks!
6 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.