Playing around with my MagicMirror installation, for now i just run app in servermode only and to my iPad, no mirror installation yet.
Installing was no rocket sience, just followed the instructions. Added a couple of modules to play around with, first one out was weather data from wunderground and then a module with name syslog.
So together with MagicMirror and a scene in my HC2 i can send data to be shown in the syslog module, thats nice
Here is the lua scene code (just my first draft)
--[[
%% properties
%% events
%% globals
yeasterdayKW
test
--]]
-- USER SETTINGS --
MMip = '192.168.0.137'
MMport = '8080'
local trigger = fibaro:getSourceTrigger();
local daysoftheweek={"Söndag","Måndag","Tisdag","Onsdag","Torsdag","Fredag","Lördag"}
local yesterday = urlencode(daysoftheweek[os.date("*t").wday-1])
function urlencode(str)
if (str) then
str = string.gsub(str, "\n", "\r\n")
str = string.gsub(str, "([^%w ])",
function (c) return string.format ("%%%02X", string.byte(c)) end)
str = string.gsub (str, " ", "+")
end
return str
end
function MM(types,data)
local function getMethod(requestUrl, successCallback, errorCallback)
local http = net.HTTPClient()
http:request(requestUrl, {
options = {
method = 'GET',
headers = {
},
},
success = successCallback,
error = errorCallback
})
end
local url = 'http://'..MMip..':'..MMport..'/syslog?type='..types..'&message='..data
getMethod(url, function(resp)
print(resp.data)
end,
function(err)
print('error' .. err)
end
)
end
if (trigger['type'] == 'global') then
if trigger['varName'] == 'yeasterdayKW' then
MM('INFO',yesterday..'+'..fibaro:getGlobal(trigger['varName'])..'+'..'kWh')
elseif trigger['varName'] == 'test' then
MM('ERROR',fibaro:getGlobal(trigger['varName'])..'+'..'variabel')
end
elseif (trigger['type'] == 'other') then
print('Scene started by other.')
end