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
Stiven 52
Hello guys,
before the 4.520 update I used to have a scene which used to restart the HC2 but with the new update it doesn't work anymore and I cant figure this out. I could use some help from you guys. Thank you! Below is the code of the script.
--[[
%% properties
%% events
%% globals
--]]
-- specify user and passwort in clear text
local user = ''
local password = ''
function encbase64(data)
local b='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
return ((data:gsub('.', function(x)
local r,b='',x:byte()
for i=8,1,-1 do r=r..(b%2^i-b%2^(i-1)>0 and '1' or '0') end
return r;
end)..'0000'):gsub('%d%d%d?%d?%d?%d?', function(x)
if (#x < 6) then return '' end
local c=0
for i=1,6 do c=c+(x:sub(i,i)=='1' and 2^(6-i) or 0) end
return b:sub(c+1,c+1)
end)..({ '', '==', '=' })[#data%3+1])
end
local http = net.HTTPClient();
http:request('http://127.0.0.1/services/system/reboot.php',{
options = {
method = 'GET',
headers = {
["Authorization"] = 'Basic '.. encbase64(user .. ':' .. password)
}
},
success = function(response) end,
error = function(err) fibaro:debug("Error: " .. err) end
})
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.