Is it possible to send message when domoticz started?

Post Reply
Mixanoid
Posts: 5
Joined: Sunday 17 June 2018 13:53
Target OS: Raspberry Pi
Domoticz version:
Contact:

Is it possible to send message when domoticz started?

Post by Mixanoid » Tuesday 09 October 2018 17:23

Sometimes we have problems on power line. I cannot see when the line is down (domoticz does not work without electricity) but can I receive the message when domoticz turns on?

User avatar
Egregius
Posts: 2733
Joined: Thursday 09 April 2015 12:19
Target OS: Linux
Domoticz version: Beta
Location: Beitem, BE
Contact:

Re: Is it possible to send message when domoticz started?

Post by Egregius » Tuesday 09 October 2018 17:47

You could use a cron job for that, or alter the init.d script.

User avatar
waaren
Posts: 1071
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Is it possible to send message when domoticz started?

Post by waaren » Tuesday 09 October 2018 18:47

Mixanoid wrote:
Tuesday 09 October 2018 17:23
Sometimes we have problems on power line. I cannot see when the line is down (domoticz does not work without electricity) but can I receive the message when domoticz turns on?
I use this dzVents script to notify when domoticz has been started.

Code: Select all

--[[
    active when function returns true ( domoticz started less then 180 seconds ago )  
    
    The defined tasks will only execute once after domoticz started.
    Please note that in theory this is not a failsafe way of handling this. 
    
    If domoticz crashes / is stopped after the first excution of this script and before 120 seconds after 
    it started, the Executed value is not set back to 0 and the script needs to be reloaded to reset the persistent data.
    
    If domoticz starts extremely slow, in theory it could be that this script will not be evaluated before the 180 seconds 
    after startup has passed. On my test system (PI-3), first execution is well within that window. (somewhere between 13 and 60 seconds)
    
 ]]-- 
 
 
return {
    active = function(domoticz)
              return domoticz.startTime.secondsAgo < 180
            end,
    
    on         = {      timer     = { 'every minute'  } },
    
    data     = {     Executed     = { initial = 0 } },
    
    
            
    execute = function(dz)
        if dz.data.Executed == 0 then
            dz.notify("Domoticz has just been started")                                     
        else
            print ("Älready executed; " .. tostring(dz.data.Executed) .. " seconds after domoticz started.")
            if dz.startTime.secondsAgo > 119 then
                dz.data.Executed = 0
            end    
        end            
    end
}
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, , dzVents 2.6, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave, Amazon echo

User avatar
EdddieN
Posts: 527
Joined: Wednesday 16 November 2016 12:31
Target OS: Raspberry Pi
Domoticz version: 4.9700
Location: Scotland
Contact:

Re: Is it possible to send message when domoticz started?

Post by EdddieN » Tuesday 09 October 2018 19:51

I use Monit for it with pushover, but I also like very much @waaren solution.
11101101 - www.machinon.com

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest