Jump to content

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 'email size'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • FIBARO Community
    • FIBARO Portal and Forum policy
    • FIBARO
    • Say hello!
    • Off-topics
  • FIBARO Update
    • FIBARO System Update
    • FIBARO Mobile Update
  • FIBARO Community Support
    • Scenes and Interface
    • FIBARO Products
    • FIBARO Mobile
    • FIBARO HomeKit
    • FIBARO Assistant Integrations
    • Other Devices / Third-party devices
    • Tutorials and Guides
    • Home Automation
    • Suggestions
  • FIBARO Społeczność
    • FIBARO
    • Przywitaj się!
    • Off-topic
  • FIBARO Aktualizacja
    • FIBARO System Aktualizacja
    • FIBARO Mobile Aktualizacja
  • FIBARO Wsparcie Społeczności
    • Sceny i Interfejs
    • FIBARO Urządzenia
    • FIBARO Mobilnie
    • FIBARO HomeKit
    • Integracja z Amazon Alexa i Google Home
    • Urządzenia Firm Trzecich
    • Poradniki
    • Automatyka Domowa
    • Sugestie

Categories

  • Scenes
  • Virtual Devices
  • Quick Apps
  • Icons

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Facebook


Google+


Skype


Website URL


WhatsApp


Country


Gateway/s


Interests

Found 1 result

  1. Hi Guys, I have the following battery check script, which sends a weekly email with the status of the batteries. The problem is, only the first 980 characters arrive in the e-mail. The rest is cut off. I have tried to send a mail via the Notification Center, where I can send over 1200 characters per mail. I do not understand why it works here and not in the script. With more than 25 battery devices this is a problem. Perhaps an LUA specialist can look at this and find a work around for this problem.. Thank you. --[[ %% autostart %% properties %% globals --]] -- file: Batterystatus.lua -- version: 0.03 -- purpose: Check the batteries and email status. -- Batteries are checked once per week (Sunday on checktime) -- Copyleft 03-2017 {jwi} local sourceTrigger = fibaro:getSourceTrigger(); local oldnodeId = nil ; local subject = "Battery status"; local userId = 2 -- primary email address local checkday = 1 -- 1=Sunday 2=Monday ... local checktime = "19:15" local full = 100 --between 50 and 100 the battery status is assumed to be good local warning = 50 --between 30 and 50 battery is running low local critical = 25 --below 25 battery status is asumed as critical local empty = 255 --probably a completely empty battery Debug = function ( color, message ) fibaro:debug(string.format('<%s style="color:%s;">%s', "span", color, message, "span")) end devices = fibaro:getDevicesId({interfaces = {"battery"}, visible = true, enabled = true}) function checkBatteries() local status = ' ' ; local n = 0; Debug('withe', os.date('%c')); for id = 1, #devices do local batteryLevel = fibaro:get(devices[id], 'batteryLevel') local nodeId = fibaro:get(devices[id], 'nodeId') if batteryLevel ~= nil and nodeId ~= nil then local name = fibaro:getName(devices[id]) if oldnodeId ~= nodeId then local room = fibaro:getRoomNameByDeviceID(devices[id]) if not(room == "unassigned") then n = n+1 if tonumber(batteryLevel) >= warning and tonumber(batteryLevel) <= full then Debug('green', "Battery " ..name..' ('..room..') - Battery: '..batteryLevel..' % OK') status = status .. n .. ") " ..name..' ('..room..') ' ..batteryLevel..' % OK\n'; elseif tonumber(batteryLevel) >= critical and tonumber(batteryLevel) <= warning then Debug('yellow', "Battery " ..name..' ('..room..') - Battery: '..batteryLevel..' % Warning') status = status .. n .. ") " ..name..' ('..room..') ' ..batteryLevel..' % Warnung\n'; elseif tonumber(batteryLevel) < critical then Debug('red', "Battery " ..name..' ('..room..') - Battery: '..batteryLevel..' %') status = status .. n .. ") " ..name..' ('..room..') ' ..batteryLevel..' % Critical\n'; elseif tonumber(batteryLevel) > full or tonumber(batteryLevel) == empty then Debug('red', "Battery " ..name..' ('..room..') - Battery: '..batteryLevel..' % probably empty!') status = status .. n .. ") " ..name..' ('..room..') ' ..batteryLevel..' % Error\n'; end end end oldnodeId = nodeId end end status = status .. 'Checked on: ' .. os.date('%c') ..'\n' status = status ..n.. ' devices were checked. ' Debug('withe', os.date('%c')); Debug('withe', '------------------------------------------------------------') Debug('withe', status) fibaro:call(userId, "sendEmail", subject, status) --fibaro:call(5, "sendEmail", subject, status) local status = ' '; end -- function function main() local currentDate = os.date("*t"); local currenthour = string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min) local weekday = currentDate.wday local startSource = fibaro:getSourceTrigger(); if (weekday == checkday) and currenthour == checktime then checkBatteries() end setTimeout(main, 60*1000) end if (sourceTrigger["type"] == "autostart") then main() else local currentDate = os.date("*t"); local startSource = fibaro:getSourceTrigger(); if (startSource["type"] == "other") then checkBatteries() end end
×
×
  • Create New...