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
Search the Community
Showing results for tags 'report'.
-
I have a smoke alarm (FireAngel ST-630 with Sprue Z-wave-module) which I would like to trigger switching off a relay when an alarm is given. Basically, there are two ways to make one device trigger another, associations or scenes. Using association has the advantage of being independent of the HC2 gateway, so that is what I was looking for at first. The supplier of the alarm tells me, however, that association will not work in this case, since the appropriate association group uses a "sensor notification reports and not a set command". I am a little out of my depth here, and would appreciate any comments. The complete documentation for the device is enclosed. There is no Fibaro template for this device, but I do not expect that to make a difference. Do you agree with the supplier that association to a switch or relay is not possible in this case? What is a good and simple way to set up a scene for this function: 'If smoke alarm on device xxx then set switch yyy to "off"?' Sprue-Z-Wave-Module-Developer-Pack-2017.pdf
-
hi, I made this VD a while ago. It makes a weekly report of the HC2 and works pretty good but I want to move in to a scene. I used Net.FHttp and this doesnt work in scenes. Can somebody help? Regards Martijn --- UPDATE MEMORY VARIABLES fibaro:call(fibaro:getSelfId(), "pressButton", "8") --- MAKE CONNECTION connection = Net.FHttp("127.0.0.1", 11111); --- FUNCTION REQUEST DEVICES getData = function() --- MAKE CONNECTION response ,status, errorCode = connection:GET( "/api/devices/" ); --- STATUS NOTIFICATIONS fibaro:debug("status = " .. status); fibaro:debug("errorCode = " .. errorCode); --- IF SUCCES if (tonumber(status) == 200) then --- DECODE TO LUA TABLE deviceTable = json.decode(response); end return deviceTable; end --- FUNCTION REQUEST CONSUMPTION getConsumption = function(url) --- MAKE CONNECTION response ,status, errorCode = connection:GET( url ); --- IF SUCCES if (tonumber(status) == 200) then consumptionTable = json.decode(response); end return consumptionTable; end --- CONSTRUCT SUBSTRACTION DAYS START DATE OF LAST WEEK if(os.date("%a") == "Mon") then substract = 7 elseif(os.date("%a") == "Tue") then substract = 8 elseif(os.date("%a") == "Wed") then substract = 9 elseif(os.date("%a") == "Thu") then substract = 10 elseif(os.date("%a") == "Fri") then substract = 11 elseif(os.date("%a") == "Sat") then substract = 12 elseif(os.date("%a") == "Sun") then substract = 13 end --- SET VARIABLES UserId = 2; lowBat = 70; SelfId = fibaro:getSelfId() dev = getData(); lowBattDevices = ""; deadDevices = ""; totalConsumption= 0 ; heavyConsumption= ""; now = os.date("*t") week_start = os.time({year=now.year,month=now.month,day=now.day-substract,hour=0,min=0,sec=0}) --, week_end = week_start + 604799 -- plus a week --- LOOP THROUGH DEVICES for i = 1, #dev do --- SET VARS batLevel = tonumber(dev.properties.batteryLevel); deadValue = dev.properties.dead; deviceName = tostring(dev.name); prestr = "[" .. dev.id .. "] ➜ " .. deviceName; --- DEAD DEVICES if(dev.visible == true and deadValue == "true") then --- TRY TO WAKE fibaro:wakeUpDeadDevice(dev.id) fibaro:sleep(2*1000); --- CHECK IF STILL DEAD if(fibaro:getValue(dev.id, 'dead') ~= "1") then deadDevices = deadDevices .. prestr .. " ✔ Woke up \n"; else deadDevices = deadDevices .. prestr .. " ❌ Did not wake up \n"; end end --- LOW BATT / IF FIELD EXISTS if (dev.visible == true and dev.properties.batteryLevel ~= nil and (batLevel < 100 or batLevel == 255)) then --- ONLY LOW BAT OF ALLREADYDEAD if(deadValue == "true" or batLevel <= lowBat or (deadValue ~= "true" and batLevel == 255)) then -- lowBattDevices = lowBattDevices .. prestr .. " - " .. string.format('<%s style="color:%s;">%s</%s>', "span", "red", dev.properties.batteryLevel .. " %", "span") .. "<br>\n" lowBattDevices = lowBattDevices .. prestr .. " - " .. dev.properties.batteryLevel .. "% ❌ \n" else lowBattDevices = lowBattDevices .. prestr .. " - " .. dev.properties.batteryLevel .. "% ✔ \n" end end --- CONSUMPTION if (dev.visible == true) then --- SET VARS url = "/api/energy/" .. week_start .."/" .. week_end .. "/compare/devices/power/" .. dev.id Consumption = getConsumption(url); --- ONLY IF THERE IS A KWH FIELD if(Consumption[1].kWh ~= nil) then --- SET VARS kwh = tonumber(Consumption[1].kWh) --- HEAVY USERS LOOP if kwh > 1 then heavyConsumption = heavyConsumption .. prestr .. " ⚡ " .. Consumption[1].kWh .. " kWh \r"; end --- TOTAL CONSUMPTION SUM totalConsumption = tonumber(totalConsumption) + kwh end end end --- CONSTRUCT MAIL HOME REPORT emailContent = "Weekly Home Report \n"; emailContent = emailContent .. "Date: " .. os.date("%d %b %Y - %H:%M") .. "\n \n"; emailContent = emailContent .. "⎋ Low Battery\r"; emailContent = emailContent .. lowBattDevices .. "\r \r"; emailContent = emailContent .. "⎋ Dead Nodes\n"; emailContent = emailContent .. deadDevices .. "\n \n"; --- SEND MAIL fibaro:call(UserId,"sendEmail", "Weekly Home Report " .. os.date("%d %b %Y - %H:%M"),emailContent); --- CONSTRUCT MAIL CONSUMPTION REPORT emailContentConsumption = "Weekly Consumption Report \n"; emailContentConsumption = emailContentConsumption .. "Date: " .. os.date("%d %b %Y - %H:%M") .. "\n \n"; emailContentConsumption = emailContentConsumption .. "⌘ Consumption\n"; emailContentConsumption = emailContentConsumption .. "From: " .. os.date("%d %b %Y",week_start) .. " till " .. os.date("%d %b %Y",week_end) .. "\n \n"; emailContentConsumption = emailContentConsumption .. "Heavy consumption \n"; emailContentConsumption = emailContentConsumption .. heavyConsumption .. "\n\n"; emailContentConsumption = emailContentConsumption .. "Consumption total\n"; emailContentConsumption = emailContentConsumption .. totalConsumption .. " kWh \n\n"; --- SEND MAIL fibaro:call(UserId,"sendEmail", "Weekly Consumption Report " .. os.date("%d %b %Y - %H:%M"),emailContentConsumption); --- CONSTRUCT MAIL CONSUMPTION REPORT emailContentMemory = "Weekly Memory Report \n"; emailContentMemory = emailContentMemory .. "Date: " .. os.date("%d %b %Y - %H:%M") .. "\n \n"; emailContentMemory = emailContentMemory .. "⌽ Memory\n"; emailContentMemory = emailContentMemory .. "➜ Free memory: " ..fibaro:getValue(SelfId, "ui.labFreeRam.value") .. "\n"; emailContentMemory = emailContentMemory .. "➜ Maximum free: " ..fibaro:getValue(SelfId, "ui.labMax.value") .. "\n"; emailContentMemory = emailContentMemory .. "➜ Minimum free: " ..fibaro:getValue(SelfId, "ui.labMini.value") .. "\n"; emailContentMemory = emailContentMemory .. "➜ Memory Cache: " ..fibaro:getValue(SelfId, "ui.labCache.value") .. "\n"; emailContentMemory = emailContentMemory .. "➜ Memory Buffers: " ..fibaro:getValue(SelfId, "ui.labBuffers.value") .. "\n"; emailContentMemory = emailContentMemory .. "➜ Memory Used: " ..fibaro:getValue(SelfId, "ui.labUsed.value") .. "\n"; emailContentMemory = emailContentMemory .. "➜ Storage: " ..fibaro:getValue(SelfId, "ui.labStorage.value") .. "\n"; --- SEND MAIL fibaro:call(UserId,"sendEmail", "Weekly Memory Report " .. os.date("%d %b %Y - %H:%M"),emailContentMemory);
- 3 replies
-
- net.fhttp
- virtualdevice
-
(and 3 more)
Tagged with: