Router or camera restart

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

meyland
Posts: 35
Joined: Wednesday 03 January 2018 16:39
Target OS: Linux
Domoticz version: 2020.2
Location: Denmark
Contact:

Router or camera restart

Post by meyland »

I have a wireless camera that sometimes loses connection to my network. I then want a dzVents script which turns off the camera via a Philips Smart Plug after 5 minutes without response and turns it on again after 1 minute. I use "System Alive Checker (ping)" to see if the camera is alive.
Can anyone help with a dzVents script?
regards

Peter
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Router or camera restart

Post by waaren »

meyland wrote: Thursday 23 July 2020 10:17 I have a wireless camera that sometimes loses connection to my network. I then want a dzVents script which turns off the camera via a Philips Smart Plug after 5 minutes without response and turns it on again after 1 minute. I use "System Alive Checker (ping)" to see if the camera is alive.
Can anyone help with a dzVents script?
Sure; what are the deviceNames, types and subtypes of the smart plug and camera (pinger device)?
Are you still on version 4.9971 as per your profile?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
meyland
Posts: 35
Joined: Wednesday 03 January 2018 16:39
Target OS: Linux
Domoticz version: 2020.2
Location: Denmark
Contact:

Re: Router or camera restart

Post by meyland »

System Alive Checker (ping) idx:365, type Lighting 2
Hue - Plug 4 - Camera04 idx: 367, type Light/Switch

Sorry, I'm on version 2020.2. Profile updated
regards

Peter
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Router or camera restart

Post by waaren »

meyland wrote: Thursday 23 July 2020 10:52 System Alive Checker (ping) idx:365, type Lighting 2
Hue - Plug 4 - Camera04 idx: 367, type Light/Switch

Sorry, I'm on version 2020.2. Profile updated
Script could look like

Code: Select all

scriptVar = 'cameraReset'

return
{
    on =
    {
        devices =
        {
            365,
        },

        customEvents =
        {
            scriptVar,
        }
    },

    data =
    {
        cameraState =
        {
             history = true,
             maxItems = 1,
        },
    },

    logging =
    {
        level = domoticz.LOG_DEBUG, -- change to domoticz.LOG_ERROR when all ok
        marker = scriptVar,
    },

    execute = function(dz, item)

        local noResponseTimeout = 300
        local cameraPower = dz.devices(367)

        if item.isDevice then
            dz.data.cameraState.add(item.state)
            if item.state == 'Off' then
                dz.emitEvent(scriptVar).afterSec(noResponseTimeout)
            end
        elseif item.isCustomEvent and ( dz.data.cameraState.getLatest().time.secondsAgo >= noResponseTimeout ) then
            dz.log('Camera did not respond within ' .. noResponseTimeout .. ' seconds to pinger. I will restart it now', dz.LOG_DEBUG )
            cameraPower.switchOff()
            cameraPower.switchOn().afterSec(60)
        end
    end
}

Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
meyland
Posts: 35
Joined: Wednesday 03 January 2018 16:39
Target OS: Linux
Domoticz version: 2020.2
Location: Denmark
Contact:

Re: Router or camera restart

Post by meyland »

Wow, thanks. I will try it when I get home again
regards

Peter
meyland
Posts: 35
Joined: Wednesday 03 January 2018 16:39
Target OS: Linux
Domoticz version: 2020.2
Location: Denmark
Contact:

Re: Router or camera restart

Post by meyland »

I have now tried the script. When the camera goes offline, then the script is triggered and after 5 minutes the script are triggered again (as expected), but the plug are not turned off. I've checked the device indexes and they are right. I've also updated my domoticz intallation to version 2020.2 (build12230) with dzVents version 3.0.11)
regards

Peter
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Router or camera restart

Post by waaren »

meyland wrote: Friday 24 July 2020 20:23 I have now tried the script. When the camera goes offline, then the script is triggered and after 5 minutes the script are triggered again (as expected), but the plug are not turned off. I've checked the device indexes and they are right. I've also updated my domoticz intallation to version 2020.2 (build12230) with dzVents version 3.0.11)
Can you share what you see in the logfile?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
meyland
Posts: 35
Joined: Wednesday 03 January 2018 16:39
Target OS: Linux
Domoticz version: 2020.2
Location: Denmark
Contact:

Re: Router or camera restart

Post by meyland »

Of course :-) The log looks like this, but I can't see any errors:

Code: Select all

2020-07-24 20:37:41.150 (System Alive - Camera04) Lighting 2 (Ping - Camera04)
2020-07-24 20:37:41.180 Status: dzVents: Info: Handling events for: "Ping - Camera04", value: "Off"
2020-07-24 20:37:41.180 Status: dzVents: Info: cameraReset: ------ Start internal script: toggleCamera04: Device: "Ping - Camera04 (System Alive - Camera04)", Index: 370
2020-07-24 20:37:41.181 Status: dzVents: Debug: cameraReset: Processing device-adapter for Hue - Plug 4 - Camera04: Switch device adapter
2020-07-24 20:37:41.181 Status: dzVents: Info: cameraReset: ------ Finished toggleCamera04
2020-07-24 20:37:41.181 Status: EventSystem: Script event triggered: /usr/bin/dzVents/runtime/dzVents.lua

2020-07-24 20:39:41.218 Status: dzVents: Info: Handling Domoticz custom event for: "cameraReset"
2020-07-24 20:39:41.218 Status: dzVents: Info: cameraReset: ------ Start internal script: toggleCamera04: Custom event: "cameraReset"
2020-07-24 20:39:41.222 Status: dzVents: Debug: cameraReset: Processing device-adapter for Hue - Plug 4 - Camera04: Switch device adapter
2020-07-24 20:39:41.223 Status: dzVents: Info: cameraReset: ------ Finished toggleCamera04
regards

Peter
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Router or camera restart

Post by waaren »

meyland wrote: Friday 24 July 2020 20:44 Of course :-) The log looks like this, but I can't see any errors:
Indeed no errors but I expected another log line. I added some extra debug code. Can you please check and revert with all loglines ?

Code: Select all

scriptVar = 'cameraReset'

return
{
    on =
    {
        devices =
        {
            365,
        },

        customEvents =
        {
            scriptVar,
        }
    },

    data =
    {
        cameraState =
        {
             history = true,
             maxItems = 1,
        },
    },

    logging =
    {
        level = domoticz.LOG_DEBUG, -- change to domoticz.LOG_ERROR when all ok
        marker = scriptVar,
    },

    execute = function(dz, item)

        local noResponseTimeout = 300
        local cameraPower = dz.devices(367)

        dz.log('isDevice: ' .. tostring(item.isDevice),dz.LOG_DEBUG)
        dz.log('isCustomEvent: ' .. tostring(item.isCustomEvent),dz.LOG_DEBUG)
        
        dz.log('secondsAgo >= ' .. noResponseTimeout .. ': ' .. tostring(dz.data.cameraState.getLatest().time.secondsAgo >= noResponseTimeout ),dz.LOG_DEBUG)
        
        dz.utils.dumpTable(dz.data.cameraState)
        
        if item.isDevice then
            dz.data.cameraState.add(item.state)
            if item.state == 'Off' then
                dz.emitEvent(scriptVar).afterSec(noResponseTimeout)
            end
        elseif item.isCustomEvent and ( dz.data.cameraState.getLatest().time.secondsAgo >= noResponseTimeout ) then
            dz.log('Camera did not respond within ' .. noResponseTimeout .. ' seconds to pinger. I will restart it now', dz.LOG_DEBUG )
            cameraPower.switchOff()
            cameraPower.switchOn().afterSec(60)
        end
    end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
meyland
Posts: 35
Joined: Wednesday 03 January 2018 16:39
Target OS: Linux
Domoticz version: 2020.2
Location: Denmark
Contact:

Re: Router or camera restart

Post by meyland »

I have checked and double checked the script and it is just as you wrote it, the only change I have made is the idx. The camera has idx 370 and the plug has idx 369

Code: Select all

scriptVar = 'cameraReset'

return
{
    on =
    {
        devices =
        {
            370,
        },

        customEvents =
        {
            scriptVar,
        }
    },

    data =
    {
        cameraState =
        {
             history = true,
             maxItems = 1,
        },
    },

    logging =
    {
        level = domoticz.LOG_DEBUG, -- change to domoticz.LOG_ERROR when all ok
        marker = scriptVar,
    },

    execute = function(dz, item)

        local noResponseTimeout = 120
        local cameraPower = dz.devices(369)

        if item.isDevice then
            dz.data.cameraState.add(item.state)
            if item.state == 'Off' then
                dz.emitEvent(scriptVar).afterSec(noResponseTimeout)
            end
        elseif item.isCustomEvent and ( dz.data.cameraState.getLatest().time.secondsAgo >= noResponseTimeout ) then
            dz.log('Camera did not respond within ' .. noResponseTimeout .. ' seconds to pinger. I will restart it now', dz.LOG_DEBUG )
            cameraPower.switchOff()
            cameraPower.switchOn().afterSec(60)
        end
    end
}

		
regards

Peter
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Router or camera restart

Post by waaren »

meyland wrote: Friday 24 July 2020 21:12 I have checked and double checked the script and it is just as you wrote it, the only change I have made is the idx. The camera has idx 370 and the plug has idx 369
Maybe you misunderstood. In my last post I added a script with some extra debug code in. Can you try that one and show all resulting loglines?
That will help me to identify the issue.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
meyland
Posts: 35
Joined: Wednesday 03 January 2018 16:39
Target OS: Linux
Domoticz version: 2020.2
Location: Denmark
Contact:

Re: Router or camera restart

Post by meyland »

Yes, you are right, I misunderstood you, sorry. I have now tried the new script, but it only gave this in the log filen:

Code: Select all

2020-07-24 21:34:54.185 (System Alive - Camera04) Lighting 2 (Ping - Camera04)
2020-07-24 21:34:54.215 Status: dzVents: Info: Handling events for: "Ping - Camera04", value: "Off"
2020-07-24 21:34:54.215 Status: dzVents: Info: cameraReset: ------ Start internal script: toggleCamera04: Device: "Ping - Camera04 (System Alive - Camera04)", Index: 370
2020-07-24 21:34:54.215 Status: dzVents: Debug: cameraReset: Processing device-adapter for Hue - Plug 4 - Camera04: Switch device adapter
2020-07-24 21:34:54.215 Status: dzVents: Debug: cameraReset: isDevice: true
2020-07-24 21:34:54.215 Status: dzVents: Debug: cameraReset: isCustomEvent: nil
2020-07-24 21:34:54.216 Status: dzVents: Info: cameraReset: ------ Finished toggleCamera04
Could it be a permissionproblem in the filesystem?
regards

Peter
meyland
Posts: 35
Joined: Wednesday 03 January 2018 16:39
Target OS: Linux
Domoticz version: 2020.2
Location: Denmark
Contact:

Re: Router or camera restart

Post by meyland »

Just some extra info. All my existing dzVents scripts are working as expected
regards

Peter
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Router or camera restart

Post by waaren »

meyland wrote: Friday 24 July 2020 21:44 Yes, you are right, I misunderstood you, sorry. I have now tried the new script, but it only gave this in the log filen:
Could it be a permissionproblem in the filesystem?
I guess not because you should then see error messages in the log.

I cannot tell what your issue is based on these loglines but the added debuglines must produce many more lines in the log. I tested it on my system and you should see something like below.

Are you logging to an OS file ?

If not please do so to be able to debug this

The domoticz logfile location and other settings are defined in /etc/init.d/domoticz.sh
the relevant settings are in set to the DAEMON_ARGS var.

with an editor of choice

Code: Select all

DAEMON_ARGS="$DAEMON_ARGS -log /var/log/domoticz.log" # or any other OS file 
#DAEMON_ARGS="$DAEMON_ARGS -loglevel  normal,status,error, debug" # debug disabled for now 
DAEMON_ARGS="$DAEMON_ARGS -loglevel  normal,status,error" # these loglevels will make it to the logfile
#DAEMON_ARGS="$DAEMON_ARGS -debuglevel normal,hardware,received,webserver,eventsystem,python,thread_id"

Code: Select all

sudo systemctl daemon-reload
sudo service domoticz stop
sudo service domoticz start
sudo tail -f  /var/log/domoticz.log

loglines from my test
Spoiler: show

Code: Select all

2020-07-24 21:46:27.919  Status: User: Admin initiated a switch command (430/cameraReset/Off)
2020-07-24 21:46:27.923  (Virtual) Light/Switch (cameraReset)
2020-07-24 21:46:27.987  Status: dzVents: Info: Handling events for: "cameraReset", value: "Off"
2020-07-24 21:46:27.987  Status: dzVents: Info: cameraReset: ------ Start internal script: 20200723 dz cameraReset: Device: "cameraReset (Virtual)", Index: 430
2020-07-24 21:46:27.988  Status: dzVents: Debug: cameraReset: Processing device-adapter for Lampen Klein: Switch device adapter
2020-07-24 21:46:27.988  Status: dzVents: Debug: cameraReset: isDevice: true
2020-07-24 21:46:27.988  Status: dzVents: Debug: cameraReset: isCustomEvent: nil
2020-07-24 21:46:27.988  Status: dzVents: Debug: cameraReset: secondsAgo >= 20: true
2020-07-24 21:46:27.988  Status: dzVents: > smoothItem()
2020-07-24 21:46:27.988  Status: dzVents: > min()
2020-07-24 21:46:27.988  Status: dzVents: > getOldest()
2020-07-24 21:46:27.988  Status: dzVents: > deltaSinceOrOldest()
2020-07-24 21:46:27.988  Status: dzVents: > avgSince()
2020-07-24 21:46:27.988  Status: dzVents: > getAtTime()
2020-07-24 21:46:27.988  Status: dzVents: > add()
2020-07-24 21:46:27.988  Status: dzVents: > avg()
2020-07-24 21:46:27.988  Status: dzVents: > getNew()
2020-07-24 21:46:27.988  Status: dzVents: > deltaSince()
2020-07-24 21:46:27.988  Status: dzVents: > storage:
2020-07-24 21:46:27.989  Status: dzVents: >     1:
2020-07-24 21:46:27.989  Status: dzVents: >             time:
2020-07-24 21:46:27.989  Status: dzVents: >                     isToday: true
2020-07-24 21:46:27.989  Status: dzVents: >                     ruleIsAfterCivilTwilightEnd()
2020-07-24 21:46:27.989  Status: dzVents: >                     daysAgo: 0
2020-07-24 21:46:27.989  Status: dzVents: >                     rawDateTime: 2020-07-24 21:45:55
2020-07-24 21:46:27.989  Status: dzVents: >                     monthName: July
2020-07-24 21:46:27.989  Status: dzVents: >                     addMinutes()
2020-07-24 21:46:27.989  Status: dzVents: >                     ruleIsOnDay()
2020-07-24 21:46:27.989  Status: dzVents: >                     seconds: 55
2020-07-24 21:46:27.989  Status: dzVents: >                     ruleIsBeforeCivilTwilightEnd()
2020-07-24 21:46:27.989  Status: dzVents: >                     minutesAgo: 0
2020-07-24 21:46:27.989  Status: dzVents: >                     addDays()
2020-07-24 21:46:27.989  Status: dzVents: >                     addHours()
2020-07-24 21:46:27.989  Status: dzVents: >                     msAgo: 32757
2020-07-24 21:46:27.989  Status: dzVents: >                     ruleIsAtCivilTwilightEnd()
2020-07-24 21:46:27.989  Status: dzVents: >                     raw: 2020-7-24 19:45:55.180
2020-07-24 21:46:27.989  Status: dzVents: >                     ruleMatchesTime()
2020-07-24 21:46:27.989  Status: dzVents: >                     ruleIsAtCivilTwilightStart()
2020-07-24 21:46:27.989  Status: dzVents: >                     month: 7
2020-07-24 21:46:27.989  Status: dzVents: >                     time: 21:45
2020-07-24 21:46:27.989  Status: dzVents: >                     minutesSinceMidnight: 1305
2020-07-24 21:46:27.989  Status: dzVents: >                     yday: 206
2020-07-24 21:46:27.989  Status: dzVents: >                     wday: 6
2020-07-24 21:46:27.989  Status: dzVents: >                     utcTime:
2020-07-24 21:46:27.989  Status: dzVents: >                             min: 45
2020-07-24 21:46:27.989  Status: dzVents: >                             month: 7
2020-07-24 21:46:27.989  Status: dzVents: >                             seconds: 55
2020-07-24 21:46:27.989  Status: dzVents: >                             minutes: 45
2020-07-24 21:46:27.989  Status: dzVents: >                             year: 2020
2020-07-24 21:46:27.989  Status: dzVents: >                             isdst: true
2020-07-24 21:46:27.989  Status: dzVents: >                             wday: 6
2020-07-24 21:46:27.989  Status: dzVents: >                             yday: 206
2020-07-24 21:46:27.989  Status: dzVents: >                             hour: 19
2020-07-24 21:46:27.989  Status: dzVents: >                             sec: 55
2020-07-24 21:46:27.989  Status: dzVents: >                             day: 24
2020-07-24 21:46:27.989  Status: dzVents: >                     milliseconds: 180
2020-07-24 21:46:27.989  Status: dzVents: >                     ruleMatchesTimeRange()
2020-07-24 21:46:27.989  Status: dzVents: >                     ruleIsAfterSunset()
2020-07-24 21:46:27.989  Status: dzVents: >                     secondsSinceMidnight: 78355
2020-07-24 21:46:27.989  Status: dzVents: >                     current:
2020-07-24 21:46:27.989  Status: dzVents: >                             min: 46
2020-07-24 21:46:27.989  Status: dzVents: >                             month: 7
2020-07-24 21:46:27.989  Status: dzVents: >                             year: 2020
2020-07-24 21:46:27.989  Status: dzVents: >                             isdst: true
2020-07-24 21:46:27.989  Status: dzVents: >                             wday: 6
2020-07-24 21:46:27.989  Status: dzVents: >                             yday: 206
2020-07-24 21:46:27.990  Status: dzVents: >                             hour: 21
2020-07-24 21:46:27.990  Status: dzVents: >                             sec: 27
2020-07-24 21:46:27.990  Status: dzVents: >                             day: 24
2020-07-24 21:46:27.990  Status: dzVents: >                     sec: 55
2020-07-24 21:46:27.990  Status: dzVents: >                     day: 24
2020-07-24 21:46:27.990  Status: dzVents: >                     dayAbbrOfWeek: fri
2020-07-24 21:46:27.990  Status: dzVents: >                     ruleIsAfterSunrise()
2020-07-24 21:46:27.990  Status: dzVents: >                     dayName: Friday
2020-07-24 21:46:27.990  Status: dzVents: >                     ruleIsAtNight()
2020-07-24 21:46:27.990  Status: dzVents: >                     isdst: true
2020-07-24 21:46:27.990  Status: dzVents: >                     matchesRule()
2020-07-24 21:46:27.990  Status: dzVents: >                     ruleIsAfterCivilTwilightStart()
2020-07-24 21:46:27.990  Status: dzVents: >                     ruleIsBeforeSunset()
2020-07-24 21:46:27.990  Status: dzVents: >                     rawDate: 2020-07-24
2020-07-24 21:46:27.990  Status: dzVents: >                     utils:
2020-07-24 21:46:27.990  Status: dzVents: >                             leftPad()
2020-07-24 21:46:27.990  Status: dzVents: >                             LOG_MODULE_EXEC_INFO: 2
2020-07-24 21:46:27.990  Status: dzVents: >                             isJSON()
2020-07-24 21:46:27.990  Status: dzVents: >                             leadingZeros()
2020-07-24 21:46:27.990  Status: dzVents: >                             groupExists()
2020-07-24 21:46:27.990  Status: dzVents: >                             stringSplit()
2020-07-24 21:46:27.990  Status: dzVents: >                             setLogMarker()
2020-07-24 21:46:27.990  Status: dzVents: >                             urlDecode()
2020-07-24 21:46:27.990  Status: dzVents: >                             toCelsius()
2020-07-24 21:46:27.990  Status: dzVents: >                             fromBase64()
2020-07-24 21:46:27.990  Status: dzVents: >                             dumpTable()
2020-07-24 21:46:27.990  Status: dzVents: >                             LOG_DEBUG: 4
2020-07-24 21:46:27.990  Status: dzVents: >                             toJSON()
2020-07-24 21:46:27.990  Status: dzVents: >                             DZVERSION: 3.0.11
2020-07-24 21:46:27.990  Status: dzVents: >                             urlEncode()
2020-07-24 21:46:27.990  Status: dzVents: >                             stringToSeconds()
2020-07-24 21:46:27.990  Status: dzVents: >                             rgbToHSB()
2020-07-24 21:46:27.990  Status: dzVents: >                             toBase64()
2020-07-24 21:46:27.990  Status: dzVents: >                             fileExists()
2020-07-24 21:46:27.990  Status: dzVents: >                             fromXML()
2020-07-24 21:46:27.990  Status: dzVents: >                             print()
2020-07-24 21:46:27.990  Status: dzVents: >                             rightPad()
2020-07-24 21:46:27.990  Status: dzVents: >                             inTable()
2020-07-24 21:46:27.990  Status: dzVents: >                             hsbToRGB()
2020-07-24 21:46:27.990  Status: dzVents: >                             dumpSelection()
2020-07-24 21:46:27.990  Status: dzVents: >                             cameraExists()
2020-07-24 21:46:27.990  Status: dzVents: >                             toXML()
2020-07-24 21:46:27.990  Status: dzVents: >                             hardwareExists()
2020-07-24 21:46:27.990  Status: dzVents: >                             sceneExists()
2020-07-24 21:46:27.990  Status: dzVents: >                             LOG_ERROR: 1
2020-07-24 21:46:27.990  Status: dzVents: >                             centerPad()
2020-07-24 21:46:27.990  Status: dzVents: >                             osExecute()
2020-07-24 21:46:27.990  Status: dzVents: >                             fromJSON()
2020-07-24 21:46:27.990  Status: dzVents: >                             deviceExists()
2020-07-24 21:46:27.990  Status: dzVents: >                             log()
2020-07-24 21:46:27.990  Status: dzVents: >                             LOG_INFO: 3
2020-07-24 21:46:27.990  Status: dzVents: >                             variableExists()
2020-07-24 21:46:27.990  Status: dzVents: >                             isXML()
2020-07-24 21:46:27.990  Status: dzVents: >                             round()
2020-07-24 21:46:27.991  Status: dzVents: >                             numDecimals()
2020-07-24 21:46:27.991  Status: dzVents: >                             LOG_FORCE: 0.5
2020-07-24 21:46:27.991  Status: dzVents: >                     toUTC()
2020-07-24 21:46:27.991  Status: dzVents: >                     ruleIsBeforeCivilTwilightStart()
2020-07-24 21:46:27.991  Status: dzVents: >                     ruleIsBeforeSunrise()
2020-07-24 21:46:27.991  Status: dzVents: >                     week: 30
2020-07-24 21:46:27.991  Status: dzVents: >                     minutes: 45
2020-07-24 21:46:27.991  Status: dzVents: >                     min: 45
2020-07-24 21:46:27.991  Status: dzVents: >                     isUTC: true
2020-07-24 21:46:27.991  Status: dzVents: >                     utcSystemTime:
2020-07-24 21:46:27.991  Status: dzVents: >                             min: 46
2020-07-24 21:46:27.991  Status: dzVents: >                             month: 7
2020-07-24 21:46:27.991  Status: dzVents: >                             year: 2020
2020-07-24 21:46:27.991  Status: dzVents: >                             isdst: false
2020-07-24 21:46:27.991  Status: dzVents: >                             wday: 6
2020-07-24 21:46:27.991  Status: dzVents: >                             yday: 206
2020-07-24 21:46:27.991  Status: dzVents: >                             hour: 19
2020-07-24 21:46:27.991  Status: dzVents: >                             sec: 27
2020-07-24 21:46:27.991  Status: dzVents: >                             day: 24
2020-07-24 21:46:27.991  Status: dzVents: >                     ruleIsAtDayTime()
2020-07-24 21:46:27.991  Status: dzVents: >                     ruleMatchesBetweenRange()
2020-07-24 21:46:27.991  Status: dzVents: >                     ruleMatchesHourSpecification()
2020-07-24 21:46:27.991  Status: dzVents: >                     ruleIsAtSunrise()
2020-07-24 21:46:27.991  Status: dzVents: >                     monthAbbrName: jul
2020-07-24 21:46:27.991  Status: dzVents: >                     makeTime()
2020-07-24 21:46:27.991  Status: dzVents: >                     ruleIsInWeek()
2020-07-24 21:46:27.991  Status: dzVents: >                     ruleIsAtSunset()
2020-07-24 21:46:27.991  Status: dzVents: >                     rawTime: 21:45:55
2020-07-24 21:46:27.991  Status: dzVents: >                     secondsAgo: 32
2020-07-24 21:46:27.991  Status: dzVents: >                     ruleIsOnDate()
2020-07-24 21:46:27.991  Status: dzVents: >                     getISO()
2020-07-24 21:46:27.991  Status: dzVents: >                     milliSeconds: 180
2020-07-24 21:46:27.991  Status: dzVents: >                     year: 2020
2020-07-24 21:46:27.991  Status: dzVents: >                     addSeconds()
2020-07-24 21:46:27.991  Status: dzVents: >                     compare()
2020-07-24 21:46:27.991  Status: dzVents: >                     ruleIsAtCivilNightTime()
2020-07-24 21:46:27.991  Status: dzVents: >                     millisecondsAgo: 32757
2020-07-24 21:46:27.991  Status: dzVents: >                     ruleIsAtSolarnoon()
2020-07-24 21:46:27.991  Status: dzVents: >                     dDate: 1595612755
2020-07-24 21:46:27.991  Status: dzVents: >                     ruleMatchesMinuteSpecification()
2020-07-24 21:46:27.991  Status: dzVents: >                     hoursAgo: 0
2020-07-24 21:46:27.991  Status: dzVents: >                     ruleIsAfterSolarnoon()
2020-07-24 21:46:27.991  Status: dzVents: >                     hour: 21
2020-07-24 21:46:27.991  Status: dzVents: >                     ruleIsAtCivilDayTime()
2020-07-24 21:46:27.991  Status: dzVents: >                     ruleIsBeforeSolarnoon()
2020-07-24 21:46:27.991  Status: dzVents: >             data: On
2020-07-24 21:46:27.991  Status: dzVents: > max()
2020-07-24 21:46:27.991  Status: dzVents: > minSince()
2020-07-24 21:46:27.991  Status: dzVents: > delta()
2020-07-24 21:46:27.991  Status: dzVents: > sumSince()
2020-07-24 21:46:27.991  Status: dzVents: > size: 1
2020-07-24 21:46:27.991  Status: dzVents: > find()
2020-07-24 21:46:27.991  Status: dzVents: > localMax()
2020-07-24 21:46:27.991  Status: dzVents: > sum()
2020-07-24 21:46:27.991  Status: dzVents: > _getForStorage()
2020-07-24 21:46:27.991  Status: dzVents: > maxSince()
2020-07-24 21:46:27.991  Status: dzVents: > delta2()
2020-07-24 21:46:27.992  Status: dzVents: > reset()
2020-07-24 21:46:27.992  Status: dzVents: > localMin()
2020-07-24 21:46:27.992  Status: dzVents: > subsetSince()
2020-07-24 21:46:27.992  Status: dzVents: > forEach()
2020-07-24 21:46:27.992  Status: dzVents: > subset()
2020-07-24 21:46:27.992  Status: dzVents: > reduce()
2020-07-24 21:46:27.992  Status: dzVents: > setNew()
2020-07-24 21:46:27.992  Status: dzVents: > getLatest()
2020-07-24 21:46:27.992  Status: dzVents: > get()
2020-07-24 21:46:27.992  Status: dzVents: > filter()
2020-07-24 21:46:27.992  Status: dzVents: Info: cameraReset: ------ Finished 20200723 dz cameraReset

2020-07-24 21:46:48.087  Status: dzVents: Info: Handling Domoticz custom event for: "cameraReset"
2020-07-24 21:46:48.087  Status: dzVents: Info: cameraReset: ------ Start internal script: 20200723 dz cameraReset: Custom event: "cameraReset"
2020-07-24 21:46:48.096  Status: dzVents: Debug: cameraReset: Processing device-adapter for Lampen Klein: Switch device adapter
2020-07-24 21:46:48.096  Status: dzVents: Debug: cameraReset: isDevice: false
2020-07-24 21:46:48.096  Status: dzVents: Debug: cameraReset: isCustomEvent: true
2020-07-24 21:46:48.096  Status: dzVents: Debug: cameraReset: secondsAgo >= 20: true
2020-07-24 21:46:48.096  Status: dzVents: > reduce()
2020-07-24 21:46:48.096  Status: dzVents: > forEach()
2020-07-24 21:46:48.096  Status: dzVents: > getOldest()
2020-07-24 21:46:48.096  Status: dzVents: > getAtTime()
2020-07-24 21:46:48.096  Status: dzVents: > size: 1
2020-07-24 21:46:48.096  Status: dzVents: > max()
2020-07-24 21:46:48.096  Status: dzVents: > localMax()
2020-07-24 21:46:48.097  Status: dzVents: > deltaSince()
2020-07-24 21:46:48.097  Status: dzVents: > localMin()
2020-07-24 21:46:48.097  Status: dzVents: > setNew()
2020-07-24 21:46:48.097  Status: dzVents: > add()
2020-07-24 21:46:48.097  Status: dzVents: > sum()
2020-07-24 21:46:48.097  Status: dzVents: > find()
2020-07-24 21:46:48.097  Status: dzVents: > deltaSinceOrOldest()
2020-07-24 21:46:48.097  Status: dzVents: > get()
2020-07-24 21:46:48.097  Status: dzVents: > delta2()
2020-07-24 21:46:48.097  Status: dzVents: > subset()
2020-07-24 21:46:48.097  Status: dzVents: > smoothItem()
2020-07-24 21:46:48.097  Status: dzVents: > delta()
2020-07-24 21:46:48.097  Status: dzVents: > avgSince()
2020-07-24 21:46:48.097  Status: dzVents: > storage:
2020-07-24 21:46:48.097  Status: dzVents: >     1:
2020-07-24 21:46:48.097  Status: dzVents: >             time:
2020-07-24 21:46:48.097  Status: dzVents: >                     rawTime: 21:46:27
2020-07-24 21:46:48.097  Status: dzVents: >                     ruleIsAtSolarnoon()
2020-07-24 21:46:48.097  Status: dzVents: >                     makeTime()
2020-07-24 21:46:48.097  Status: dzVents: >                     ruleIsAtCivilTwilightEnd()
2020-07-24 21:46:48.097  Status: dzVents: >                     sec: 27
2020-07-24 21:46:48.097  Status: dzVents: >                     seconds: 27
2020-07-24 21:46:48.097  Status: dzVents: >                     ruleIsBeforeCivilTwilightStart()
2020-07-24 21:46:48.097  Status: dzVents: >                     ruleIsAtDayTime()
2020-07-24 21:46:48.097  Status: dzVents: >                     minutesSinceMidnight: 1306
2020-07-24 21:46:48.097  Status: dzVents: >                     dayName: Friday
2020-07-24 21:46:48.097  Status: dzVents: >                     day: 24
2020-07-24 21:46:48.097  Status: dzVents: >                     ruleIsInWeek()
2020-07-24 21:46:48.097  Status: dzVents: >                     isdst: true
2020-07-24 21:46:48.097  Status: dzVents: >                     ruleIsBeforeSunrise()
2020-07-24 21:46:48.097  Status: dzVents: >                     dDate: 1595612787
2020-07-24 21:46:48.097  Status: dzVents: >                     monthAbbrName: jul
2020-07-24 21:46:48.097  Status: dzVents: >                     ruleMatchesBetweenRange()
2020-07-24 21:46:48.097  Status: dzVents: >                     matchesRule()
2020-07-24 21:46:48.097  Status: dzVents: >                     ruleIsAtCivilTwilightStart()
2020-07-24 21:46:48.097  Status: dzVents: >                     utils:
2020-07-24 21:46:48.097  Status: dzVents: >                             sceneExists()
2020-07-24 21:46:48.097  Status: dzVents: >                             log()
2020-07-24 21:46:48.097  Status: dzVents: >                             LOG_FORCE: 0.5
2020-07-24 21:46:48.097  Status: dzVents: >                             dumpSelection()
2020-07-24 21:46:48.098  Status: dzVents: >                             cameraExists()
2020-07-24 21:46:48.098  Status: dzVents: >                             fileExists()
2020-07-24 21:46:48.098  Status: dzVents: >                             osExecute()
2020-07-24 21:46:48.098  Status: dzVents: >                             LOG_MODULE_EXEC_INFO: 2
2020-07-24 21:46:48.098  Status: dzVents: >                             groupExists()
2020-07-24 21:46:48.098  Status: dzVents: >                             centerPad()
2020-07-24 21:46:48.098  Status: dzVents: >                             LOG_INFO: 3
2020-07-24 21:46:48.098  Status: dzVents: >                             round()
2020-07-24 21:46:48.098  Status: dzVents: >                             urlEncode()
2020-07-24 21:46:48.098  Status: dzVents: >                             LOG_DEBUG: 4
2020-07-24 21:46:48.098  Status: dzVents: >                             DZVERSION: 3.0.11
2020-07-24 21:46:48.098  Status: dzVents: >                             stringToSeconds()
2020-07-24 21:46:48.098  Status: dzVents: >                             print()
2020-07-24 21:46:48.098  Status: dzVents: >                             LOG_ERROR: 1
2020-07-24 21:46:48.098  Status: dzVents: >                             inTable()
2020-07-24 21:46:48.098  Status: dzVents: >                             setLogMarker()
2020-07-24 21:46:48.098  Status: dzVents: >                             hsbToRGB()
2020-07-24 21:46:48.098  Status: dzVents: >                             dumpTable()
2020-07-24 21:46:48.098  Status: dzVents: >                             leftPad()
2020-07-24 21:46:48.098  Status: dzVents: >                             fromJSON()
2020-07-24 21:46:48.098  Status: dzVents: >                             toXML()
2020-07-24 21:46:48.098  Status: dzVents: >                             deviceExists()
2020-07-24 21:46:48.098  Status: dzVents: >                             isXML()
2020-07-24 21:46:48.098  Status: dzVents: >                             stringSplit()
2020-07-24 21:46:48.098  Status: dzVents: >                             isJSON()
2020-07-24 21:46:48.098  Status: dzVents: >                             rgbToHSB()
2020-07-24 21:46:48.098  Status: dzVents: >                             fromBase64()
2020-07-24 21:46:48.098  Status: dzVents: >                             toJSON()
2020-07-24 21:46:48.098  Status: dzVents: >                             hardwareExists()
2020-07-24 21:46:48.098  Status: dzVents: >                             fromXML()
2020-07-24 21:46:48.098  Status: dzVents: >                             variableExists()
2020-07-24 21:46:48.098  Status: dzVents: >                             urlDecode()
2020-07-24 21:46:48.098  Status: dzVents: >                             toBase64()
2020-07-24 21:46:48.098  Status: dzVents: >                             rightPad()
2020-07-24 21:46:48.098  Status: dzVents: >                             leadingZeros()
2020-07-24 21:46:48.098  Status: dzVents: >                             toCelsius()
2020-07-24 21:46:48.098  Status: dzVents: >                             numDecimals()
2020-07-24 21:46:48.098  Status: dzVents: >                     utcSystemTime:
2020-07-24 21:46:48.098  Status: dzVents: >                             sec: 48
2020-07-24 21:46:48.098  Status: dzVents: >                             wday: 6
2020-07-24 21:46:48.098  Status: dzVents: >                             day: 24
2020-07-24 21:46:48.098  Status: dzVents: >                             min: 46
2020-07-24 21:46:48.099  Status: dzVents: >                             isdst: false
2020-07-24 21:46:48.099  Status: dzVents: >                             yday: 206
2020-07-24 21:46:48.099  Status: dzVents: >                             hour: 19
2020-07-24 21:46:48.099  Status: dzVents: >                             year: 2020
2020-07-24 21:46:48.099  Status: dzVents: >                             month: 7
2020-07-24 21:46:48.099  Status: dzVents: >                     addSeconds()
2020-07-24 21:46:48.099  Status: dzVents: >                     utcTime:
2020-07-24 21:46:48.099  Status: dzVents: >                             sec: 27
2020-07-24 21:46:48.099  Status: dzVents: >                             minutes: 46
2020-07-24 21:46:48.099  Status: dzVents: >                             wday: 6
2020-07-24 21:46:48.099  Status: dzVents: >                             day: 24
2020-07-24 21:46:48.099  Status: dzVents: >                             min: 46
2020-07-24 21:46:48.099  Status: dzVents: >                             seconds: 27
2020-07-24 21:46:48.099  Status: dzVents: >                             isdst: true
2020-07-24 21:46:48.099  Status: dzVents: >                             yday: 206
2020-07-24 21:46:48.099  Status: dzVents: >                             hour: 19
2020-07-24 21:46:48.099  Status: dzVents: >                             year: 2020
2020-07-24 21:46:48.099  Status: dzVents: >                             month: 7
2020-07-24 21:46:48.099  Status: dzVents: >                     time: 21:46
2020-07-24 21:46:48.099  Status: dzVents: >                     rawDate: 2020-07-24
2020-07-24 21:46:48.099  Status: dzVents: >                     compare()
2020-07-24 21:46:48.099  Status: dzVents: >                     ruleIsBeforeSunset()
2020-07-24 21:46:48.099  Status: dzVents: >                     ruleIsAfterSunrise()
2020-07-24 21:46:48.099  Status: dzVents: >                     ruleIsAfterCivilTwilightEnd()
2020-07-24 21:46:48.099  Status: dzVents: >                     milliseconds: 937
2020-07-24 21:46:48.099  Status: dzVents: >                     ruleIsAfterCivilTwilightStart()
2020-07-24 21:46:48.099  Status: dzVents: >                     ruleIsOnDate()
2020-07-24 21:46:48.099  Status: dzVents: >                     monthName: July
2020-07-24 21:46:48.099  Status: dzVents: >                     addMinutes()
2020-07-24 21:46:48.099  Status: dzVents: >                     ruleMatchesHourSpecification()
2020-07-24 21:46:48.099  Status: dzVents: >                     year: 2020
2020-07-24 21:46:48.099  Status: dzVents: >                     minutes: 46
2020-07-24 21:46:48.099  Status: dzVents: >                     ruleIsAtCivilNightTime()
2020-07-24 21:46:48.099  Status: dzVents: >                     min: 46
2020-07-24 21:46:48.099  Status: dzVents: >                     secondsSinceMidnight: 78387
2020-07-24 21:46:48.099  Status: dzVents: >                     ruleMatchesTimeRange()
2020-07-24 21:46:48.099  Status: dzVents: >                     month: 7
2020-07-24 21:46:48.099  Status: dzVents: >                     toUTC()
2020-07-24 21:46:48.099  Status: dzVents: >                     ruleMatchesTime()
2020-07-24 21:46:48.099  Status: dzVents: >                     secondsAgo: 21
2020-07-24 21:46:48.099  Status: dzVents: >                     ruleIsAtSunrise()
2020-07-24 21:46:48.099  Status: dzVents: >                     ruleIsAtNight()
2020-07-24 21:46:48.099  Status: dzVents: >                     hoursAgo: 0
2020-07-24 21:46:48.099  Status: dzVents: >                     hour: 21
2020-07-24 21:46:48.099  Status: dzVents: >                     ruleIsAfterSolarnoon()
2020-07-24 21:46:48.099  Status: dzVents: >                     week: 30
2020-07-24 21:46:48.099  Status: dzVents: >                     getISO()
2020-07-24 21:46:48.099  Status: dzVents: >                     wday: 6
2020-07-24 21:46:48.100  Status: dzVents: >                     current:
2020-07-24 21:46:48.100  Status: dzVents: >                             sec: 48
2020-07-24 21:46:48.100  Status: dzVents: >                             wday: 6
2020-07-24 21:46:48.100  Status: dzVents: >                             day: 24
2020-07-24 21:46:48.100  Status: dzVents: >                             min: 46
2020-07-24 21:46:48.100  Status: dzVents: >                             isdst: true
2020-07-24 21:46:48.100  Status: dzVents: >                             yday: 206
2020-07-24 21:46:48.100  Status: dzVents: >                             hour: 21
2020-07-24 21:46:48.100  Status: dzVents: >                             year: 2020
2020-07-24 21:46:48.100  Status: dzVents: >                             month: 7
2020-07-24 21:46:48.100  Status: dzVents: >                     ruleIsAfterSunset()
2020-07-24 21:46:48.100  Status: dzVents: >                     daysAgo: 0
2020-07-24 21:46:48.100  Status: dzVents: >                     msAgo: 20107
2020-07-24 21:46:48.100  Status: dzVents: >                     isToday: true
2020-07-24 21:46:48.100  Status: dzVents: >                     ruleIsAtSunset()
2020-07-24 21:46:48.100  Status: dzVents: >                     addHours()
2020-07-24 21:46:48.100  Status: dzVents: >                     ruleIsAtCivilDayTime()
2020-07-24 21:46:48.100  Status: dzVents: >                     minutesAgo: 0
2020-07-24 21:46:48.100  Status: dzVents: >                     dayAbbrOfWeek: fri
2020-07-24 21:46:48.100  Status: dzVents: >                     ruleIsBeforeSolarnoon()
2020-07-24 21:46:48.100  Status: dzVents: >                     isUTC: true
2020-07-24 21:46:48.100  Status: dzVents: >                     ruleIsOnDay()
2020-07-24 21:46:48.100  Status: dzVents: >                     rawDateTime: 2020-07-24 21:46:27
2020-07-24 21:46:48.100  Status: dzVents: >                     raw: 2020-7-24 19:46:27.937
2020-07-24 21:46:48.100  Status: dzVents: >                     ruleIsBeforeCivilTwilightEnd()
2020-07-24 21:46:48.100  Status: dzVents: >                     addDays()
2020-07-24 21:46:48.100  Status: dzVents: >                     yday: 206
2020-07-24 21:46:48.100  Status: dzVents: >                     millisecondsAgo: 20107
2020-07-24 21:46:48.100  Status: dzVents: >                     ruleMatchesMinuteSpecification()
2020-07-24 21:46:48.100  Status: dzVents: >                     milliSeconds: 937
2020-07-24 21:46:48.100  Status: dzVents: >             data: Off
2020-07-24 21:46:48.100  Status: dzVents: > getNew()
2020-07-24 21:46:48.100  Status: dzVents: > avg()
2020-07-24 21:46:48.100  Status: dzVents: > filter()
2020-07-24 21:46:48.100  Status: dzVents: > reset()
2020-07-24 21:46:48.100  Status: dzVents: > min()
2020-07-24 21:46:48.100  Status: dzVents: > minSince()
2020-07-24 21:46:48.100  Status: dzVents: > maxSince()
2020-07-24 21:46:48.100  Status: dzVents: > subsetSince()
2020-07-24 21:46:48.100  Status: dzVents: > _getForStorage()
2020-07-24 21:46:48.100  Status: dzVents: > getLatest()
2020-07-24 21:46:48.100  Status: dzVents: > sumSince()
2020-07-24 21:46:48.100  Status: dzVents: Debug: cameraReset: Camera did not respond within 20 seconds to pinger. I will restart it now
2020-07-24 21:46:48.100  Status: dzVents: Debug: cameraReset: Constructed timed-command: Off
2020-07-24 21:46:48.101  Status: dzVents: Debug: cameraReset: Constructed timed-command: On
2020-07-24 21:46:48.101  Status: dzVents: Debug: cameraReset: Constructed timed-command: On AFTER 60 SECONDS
2020-07-24 21:46:48.101  Status: dzVents: Info: cameraReset: ------ Finished 20200723 dz cameraReset
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
meyland
Posts: 35
Joined: Wednesday 03 January 2018 16:39
Target OS: Linux
Domoticz version: 2020.2
Location: Denmark
Contact:

Re: Router or camera restart

Post by meyland »

I'm logging to a OS file in /var/log and the logfile does not contain any errors. I think there are som errors in my installation of Domoticz, but I can't find id.

I think the reset script dies at the line where "secondsAgo >= 20: true" should be printed without any error messages.
regards

Peter
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Router or camera restart

Post by waaren »

meyland wrote: Friday 24 July 2020 22:24 I'm logging to a OS file in /var/log and the logfile does not contain any errors. I think there are som errors in my installation of Domoticz, but I can't find id.

I think the reset script dies at the line where "secondsAgo >= 20: true" should be printed without any error messages.
Strange :o
The first try it passed this and emitted the event.

What happens if you do

Code: Select all

cd <domoticz dir>
sudo ./updatebeta
Your database and scripts will not be touched by this update
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
meyland
Posts: 35
Joined: Wednesday 03 January 2018 16:39
Target OS: Linux
Domoticz version: 2020.2
Location: Denmark
Contact:

Re: Router or camera restart

Post by meyland »

I dont have a updatebeta in my domoticz folder. I have compiled domoticz today from github, so I think I'm on the latest build :-)
Could it be something with dz.data or maybe cameraState? Are those datatypes saved ind the database or in th filesystem? I remember that I have some problems with the file scripts/dzVents/domoticzData.lua, because it not was owned by domoticz
regards

Peter
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Router or camera restart

Post by waaren »

meyland wrote: Friday 24 July 2020 23:03 I dont have a updatebeta in my domoticz folder. I have compiled domoticz today from github, so I think I'm on the latest build :-)
Could it be something with dz.data or maybe cameraState? Are those datatypes saved ind the database or in th filesystem? I remember that I have some problems with the file scripts/dzVents/domoticzData.lua, because it not was owned by domoticz
If you compile locally you will find the updatebeta script in the git source directory.
Just copy it to your domoticz folder, copy your current domoticz binary to domoticz.local, execute sudo ./updatebeta and copy domoticz.local back to domoticz.

This will ensure you have all the supporting files and directories versions aligned with your domoticz binary version.

I use below script to stay aligned

Code: Select all

#!/bin/bash

basedir="/usr/local/domotica/git/"

if [ $# -eq 0 ] ;  then
	clear
    echo "No arguments supplied"
	echo
	echo default base directory is  /usr/local/domotica/git 
	echo 
	echo Usage:
	echo 
	echo ${0##*/} beta .................. get all from "$HOSTNAME:$basedir"beta
	echo ${0##*/} development ........... get all from "$HOSTNAME:$basedir"development
	echo ${0##*/} beta DEV ............. get all from "DEV:$basedir"beta
	echo 
	exit 1
fi

from=${1:-"beta"}
sourceSystem=${2:-"$HOSTNAME"}
target=${3:-"/opt/domoticz"}
source=${4:-"$sourceSystem:$basedir$from"}
skip=${5:-"noskip"}
currentDir=$PWD

#
# Root required
#
if [[ $EUID -ne 0 ]]; then
   echo "This script must be run as root" 1>&2
   exit 1
fi

while true; do
	read -p "Do you want to copy from $source to $target? (yn) " yn
	case $yn in
		[JjYy]* ) echo OK
				  break;;
		[Nn]* ) exit;;
		* ) echo "No valid input. Please try again";;
	esac
done

cd $target

echo Stop domoticz
service domoticz stop

cd $target

echo Create tar with executable database etc.
tar cazf domoticz.tar.gz $(readlink -e domoticz *.txt *.sh *.pem *.log update* dzVents/* scripts/*) 2>/dev/null
echo $(tar -tzf domoticz.tar.gz | wc -l) files archived


echo rsync $source/domoticz domoticz
rsync -I $source/domoticz $target/domoticz

if test $skip = 'skip' ; then
	echo skipping the rsync steps
else
	echo rsync $source/www/* to $target/www
	rsync -rI $source/www/ $target/www

	echo rsync $source/dzVents/* to $target/dzVents
	rsync -rI $source/dzVents/ $target/dzVents

	echo rsync $source/Config/* to $target/Config
	rsync -rI $source/Config/ $target/Config

	echo rsync $source/scripts/lua to $target/scripts/lua
	rsync -rI $source/scripts/lua/ $target/scripts/lua
	rsync -rI $source/scripts/lua/xmlhandler/ $target/scripts/lua/xmlHandler
fi

echo start domoticz
service domoticz start

$target/domoticz --help | grep Giz
cd $currentDir
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
meyland
Posts: 35
Joined: Wednesday 03 January 2018 16:39
Target OS: Linux
Domoticz version: 2020.2
Location: Denmark
Contact:

Re: Router or camera restart

Post by meyland »

I will give it a try tomorrow
regards

Peter
cobra045
Posts: 46
Joined: Friday 12 February 2016 20:58
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.4834
Contact:

Re: Router or camera restart

Post by cobra045 »

I have the same problem with a Foscam camera, so this is a solution, thanks for that.

But on the website https://www.domoticz.com/wiki/System_Al ... ker_(Ping) at the bottom is the following text

"When running Domoticz without root (recommended), you need to add the correct socket capabilities for this to function properly (otherwise it will fail silently!): "

I don't understand, who can explain this to me ??

Or what is the correct rule for this?
$ sudo setcap cap_net_raw = + eip path_to_domoticz_executable

Thanks for the help.

Cobra045
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest