Lights switch -> lastUpdate not working

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

Moderator: leecollings

Post Reply
RobbieT
Posts: 17
Joined: Thursday 13 December 2018 14:34
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Lights switch -> lastUpdate not working

Post by RobbieT »

I'm using the following script to control my lights. When I got to bed I push a button and the mode is changed to "Alles uit".
Currently my lights turn off and immediatly two of my lights turn on for 2.5 minutes. I can't figure out why this happens. The code has a line; Modus.lastUpdate.minutesAgo > 3 but i seems that this one isn't pickedup.

Anyone have an idea?

Code: Select all

--*------------------------------------------------------------------------------------*--
--Creator: Rob
--Date: 01-04-2020
--Last update: 10-04-2020
--Changelog:
--10-04-2020: Added option so lights will not switch off when event lights at night are on.
--Source: -
--Description: Used to switch the lights in the living room, based on someone home and lux
--*------------------------------------------------------------------------------------*--

return {
	on = {
		devices = {
			311,                                                                        --PIR Livingroom | Lux
            312,                                                                        --PIR Livingroom | Movement
            313                                                                         --Mode                                                                             
		}
	},
	
    --Add logging for this script  
   logging = {
   level = domoticz.LOG_INFO,                                                           --Set the loglevel. Seclect from:LOG_INFO, LOG_DEBUG, LOG_ERROR or LOG_FORCE to override system log level
   marker = "-=#Livingroom Lights | Lux#=-"
   },
	
	execute = function(domoticz, device)
	--Declarations
	local Modus             = domoticz.devices(313)                                     --Mode
	local LuxDevice         = domoticz.devices(311)                                     --PIR Livingroom | Lux
    local Lux               = LuxDevice.lux
    local Movement          = domoticz.devices(312)                                     --PIR Livingroom | Movement
	
	--Function
	--Light above dresser
	if (Modus.state == 'Iemand thuis/Oppas' and Lux < 75) then                          --Someone home and lux below set value then,
	domoticz.devices(179).switchOn().checkFirst()                                        --turn on light above dresser at 100% after 5 minutes
	else                                                                                --If not,
    domoticz.devices(179).switchOff().checkFirst()                                      --Turn off light above dresser
    end
        
    --Other lights in the livingroom
    if (Modus.state == 'Iemand thuis/Oppas' and Lux < 14) then
    domoticz.devices(188).dimTo(70)                                                     --Turn on lights above the dinnertable at 70%
    domoticz.devices(185).dimTo(35)                                                     --Turn on lights above the couch at 35%
    domoticz.devices(51).switchOn().checkFirst()                                        --Turn on light next to the television
    domoticz.devices(290).switchOn().checkFirst()                                       --Turn on ledstrip in the kitchen at 75%

    elseif (Modus.state == 'Iemand thuis/Oppas' and Lux > 15) then
    domoticz.devices(185).switchOff().checkFirst()                                      --Turn off lights above the couch
    domoticz.devices(51).switchOff().checkFirst()                                       --Turn off light next to the television
    end
    
    --update 12-04-2020
    if Modus.lastUpdate.minutesAgo > 3 and Modus.state == 'Alles uit'                   --If mode is set to 'Alles uit' and mode hasn't changed the last 3 minutes and
    and Movement.active and Lux < 10 then                                               --there is movement and lux is below set level then,
    domoticz.devices(188).dimTo(15)                                                     --Turn on lights above the dinnertable at 15%
    domoticz.devices(185).dimTo(15)                                                     --Turn on lights above the couch at 15%
    domoticz.devices(188).switchOff().afterSec(150)                                     --Turn off lights above the dinnertable after 2.5 minutes
    domoticz.devices(185).switchOff().afterSec(150)                                     --Turn off lights above the couch after 2.5 minutes
    --end update 12-04-2020
    
    elseif Modus.state == 'Uit' then
    domoticz.devices(188).switchOff().checkFirst()                                      --Turn off lights above the dinnertable
    domoticz.devices(179).switchOff().checkFirst()                                      --Turn off light above the dresser
    domoticz.devices(185).switchOff().checkFirst()                                      --Turn off lights above the couch
    domoticz.devices(51).switchOff().checkFirst()                                       --Turn off lights next to the television
    domoticz.devices(290).switchOff().checkFirst()                                      --Turn off ledstrip in the kitchen
    end
end
}
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Lights switch -> lastUpdate not working

Post by waaren »

RobbieT wrote: Monday 20 April 2020 16:34 I'm using the following script to control my lights. When I got to bed I push a button and the mode is changed to "Alles uit".
Currently my lights turn off and immediatly two of my lights turn on for 2.5 minutes. I can't figure out why this happens. The code has a line; Modus.lastUpdate.minutesAgo > 3 but i seems that this one isn't pickedup.

Anyone have an idea?
My idea is to add some loglines to the begin of the script (after the part where your variables are declarated) to print the state of your switches / lights and the lastUpdate time of your mode to the log

something like

Code: Select all

domoticz.log('Modus.lastUpdate.minutesAgo: ' .. Modus.lastUpdate.minutesAgo , domoticz.LOG_FORCE)
domoticz.log('Modus.state: ' .. Modus.state, domoticz.LOG_FORCE)
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
RobbieT
Posts: 17
Joined: Thursday 13 December 2018 14:34
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Lights switch -> lastUpdate not working

Post by RobbieT »

waaren wrote: Monday 20 April 2020 18:18
RobbieT wrote: Monday 20 April 2020 16:34 I'm using the following script to control my lights. When I got to bed I push a button and the mode is changed to "Alles uit".
Currently my lights turn off and immediatly two of my lights turn on for 2.5 minutes. I can't figure out why this happens. The code has a line; Modus.lastUpdate.minutesAgo > 3 but i seems that this one isn't pickedup.

Anyone have an idea?
My idea is to add some loglines to the begin of the script (after the part where your variables are declarated) to print the state of your switches / lights and the lastUpdate time of your mode to the log

something like

Code: Select all

domoticz.log('Modus.lastUpdate.minutesAgo: ' .. Modus.lastUpdate.minutesAgo , domoticz.LOG_FORCE)
domoticz.log('Modus.state: ' .. Modus.state, domoticz.LOG_FORCE)
Sorry, I'm a bit confused an getting an error after the lines. Where should I put them?
And I quess domoticz,log should be domoticz.log (dot instead of a comma).
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Lights switch -> lastUpdate not working

Post by waaren »

RobbieT wrote: Tuesday 21 April 2020 11:42 I quess domoticz,log should be domoticz.log (dot instead of a comma).
Yes :oops: . I corrected that now.
Sorry, I'm a bit confused an getting an error after the lines. Where should I put them?

Added some loglines. Can you try with this ?

Code: Select all

--*------------------------------------------------------------------------------------*--
--Creator: Rob
--Date: 01-04-2020
--Last update: 10-04-2020
--Changelog:
--10-04-2020: Added option so lights will not switch off when event lights at night are on.
--Source: -
--Description: Used to switch the lights in the living room, based on someone home and lux
--*------------------------------------------------------------------------------------*--

return {
    on = {
        devices = {
            311,                                                                        --PIR Livingroom | Lux
            312,                                                                        --PIR Livingroom | Movement
            313                                                                         --Mode                                                                             
        }
    },
    
    --Add logging for this script  
   logging = {
        level = domoticz.LOG_DEBUG,                          --Set the loglevel. Select from:LOG_INFO, LOG_DEBUG, LOG_ERROR or LOG_FORCE to override system log level
        marker = "-=#Livingroom Lights | Lux#=-"
   },
    
    execute = function(domoticz, device)
    --Declarations
    local Modus             = domoticz.devices(313)                                     --Mode
    local LuxDevice         = domoticz.devices(311)                                     --PIR Livingroom | Lux
    local Lux               = LuxDevice.lux
    local Movement          = domoticz.devices(312)                                     --PIR Livingroom | Movement

    domoticz.log('Modus.lastUpdate.minutesAgo: ' .. Modus.lastUpdate.minutesAgo , domoticz.LOG_DEBUG)
    domoticz.log('Modus.state: ' .. tostring(Modus.state), domoticz.LOG_DEBUG)
    domoticz.log(device.name .. ' state: ' .. tostring(device.state), domoticz.LOG_DEBUG)
    domoticz.log(Movement.name .. ' active: ' .. tostring(Movement.active), domoticz.LOG_DEBUG)
    
    --Function
    --Light above dresser
    if (Modus.state == 'Iemand thuis/Oppas' and Lux < 75) then                          --Someone home and lux below set value then,
        domoticz.devices(179).switchOn().checkFirst()                                        --turn on light above dresser at 100% after 5 minutes
    else                                                                                --If not,
        domoticz.devices(179).switchOff().checkFirst()                                      --Turn off light above dresser
    end
        
    --Other lights in the livingroom
    if (Modus.state == 'Iemand thuis/Oppas' and Lux < 14) then
        domoticz.devices(188).dimTo(70)                                                     --Turn on lights above the dinnertable at 70%
        domoticz.devices(185).dimTo(35)                                                     --Turn on lights above the couch at 35%
        domoticz.devices(51).switchOn().checkFirst()                                        --Turn on light next to the television
        domoticz.devices(290).switchOn().checkFirst()                                       --Turn on ledstrip in the kitchen at 75%

    elseif (Modus.state == 'Iemand thuis/Oppas' and Lux > 15) then
        domoticz.devices(185).switchOff().checkFirst()                                      --Turn off lights above the couch
        domoticz.devices(51).switchOff().checkFirst()                                       --Turn off light next to the television
    end
    
    --update 12-04-2020              -- If mode is set to 'Alles uit' and mode hasn't changed the last 3 minutes and
    if Modus.lastUpdate.minutesAgo > 3 and Modus.state == 'Alles uit' and Movement.active and Lux < 10 then  --there is movement and lux is below set level then,
        domoticz.devices(188).dimTo(15)                                                     --Turn on lights above the dinnertable at 15%
        domoticz.devices(185).dimTo(15)                                                     --Turn on lights above the couch at 15%
        domoticz.devices(188).switchOff().afterSec(150)                                     --Turn off lights above the dinnertable after 2.5 minutes
        domoticz.devices(185).switchOff().afterSec(150)                                     --Turn off lights above the couch after 2.5 minutes
        --end update 12-04-2020
    elseif Modus.state == 'Uit' then
        domoticz.devices(188).switchOff().checkFirst()                                      --Turn off lights above the dinnertable
        domoticz.devices(179).switchOff().checkFirst()                                      --Turn off light above the dresser
        domoticz.devices(185).switchOff().checkFirst()                                      --Turn off lights above the couch
        domoticz.devices(51).switchOff().checkFirst()                                       --Turn off lights next to the television
        domoticz.devices(290).switchOff().checkFirst()                                      --Turn off ledstrip in the kitchen
    end
end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
RobbieT
Posts: 17
Joined: Thursday 13 December 2018 14:34
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Lights switch -> lastUpdate not working

Post by RobbieT »

waaren wrote: Tuesday 21 April 2020 12:00
RobbieT wrote: Tuesday 21 April 2020 11:42 I quess domoticz,log should be domoticz.log (dot instead of a comma).
Yes :oops: . I corrected that now.
Sorry, I'm a bit confused an getting an error after the lines. Where should I put them?
Added some loglines. Can you try with this ?
Here is the logging;

Code: Select all

2020-04-21 23:49:56.339  Status: dzVents: Info:  Lampen woonkamer geschakeld: ------ Start internal script: Lampen woonkamer via knop: Device: "Xiaomi Switch (Xiaomi Gateway)", Index: 92
2020-04-21 23:49:56.339  Status: dzVents: Info:  Lampen woonkamer geschakeld: De lampen zijn uitgeschakeld
2020-04-21 23:49:56.339  Status: dzVents: Info:  Lampen woonkamer geschakeld: ------ Finished Lampen woonkamer via knop
2020-04-21 23:49:56.340  Status: EventSystem: Script event triggered: /usr/local/domoticz/dzVents/runtime/dzVents.lua
2020-04-21 23:49:56.341  EventSystem: Event triggered: Switch naar off_1
2020-04-21 23:49:56.385  (Milight Hub DIY - MQTT) 007/Lampen | Eettafel alles - MQTT: Command: 'Off', Level: 0, Color:
2020-04-21 23:49:56.385  (Milight Hub DIY - MQTT) 018/Lampen | Keuken - Ledstrip - MQTT: Command: 'Off', Level: 0, Color:
2020-04-21 23:49:56.686  (Milight Hub DIY - MQTT) 007/Lampen | Eettafel alles - MQTT: State change: '{'state': 'OFF'}
2020-04-21 23:49:57.806  (Milight Hub DIY - MQTT) 018/Lampen | Keuken - Ledstrip - MQTT: State change: '{'state': 'OFF'}
2020-04-21 23:50:00.188  Status: EventSystem: Script event triggered: /usr/local/domoticz/dzVents/runtime/dzVents.lua
2020-04-21 23:50:01.353  (Xiaomi Gateway) Light/Switch (Xiaomi Switch)
2020-04-21 23:50:01.372  Status: dzVents: Info:  Lampen woonkamer geschakeld: ------ Start internal script: Lampen woonkamer via knop: Device: "Xiaomi Switch (Xiaomi Gateway)", Index: 92
2020-04-21 23:50:01.373  Status: dzVents: Info:  Lampen woonkamer geschakeld: ------ Finished Lampen woonkamer via knop
2020-04-21 23:50:06.372  (Milight Hub DIY - MQTT) 004/Lampen | Bank alles - MQTT: Command: 'Off', Level: 0, Color:
2020-04-21 23:50:06.773  (Milight Hub DIY - MQTT) 004/Lampen | Bank alles - MQTT: State change: '{'state': 'OFF'}
2020-04-21 23:50:11.528  (Xiaomi Gateway) Light/Switch (Smartplug - Lamp naast TV)
2020-04-21 23:50:11.974  Status: {"cmd":"report","model":"plug","sid":"158d00028ac7ab","short_id":44587,"data":"{\"status\":\"off\"}"}
2020-04-21 23:50:16.393  (Milight Hub DIY - MQTT) 001/Lampen | Dressoir - MQTT: Command: 'Off', Level: 0, Color:
2020-04-21 23:50:16.694  (Milight Hub DIY - MQTT) 001/Lampen | Dressoir - MQTT: State change: '{'state': 'OFF'}
2020-04-21 23:50:26.363  (Dummy Switches) Light/Switch (Algemeen uit)
2020-04-21 23:50:26.383  Status: dzVents: Info:  -=#Switch mode#=-: ------ Start internal script: Modus aanpassen: Device: "Algemeen uit (Dummy Switches)", Index: 243
2020-04-21 23:50:26.383  Status: dzVents: Info:  -=#Switch mode#=-: ------ Finished Modus aanpassen
2020-04-21 23:50:26.383  Status: EventSystem: Script event triggered: /usr/local/domoticz/dzVents/runtime/dzVents.lua
2020-04-21 23:50:26.404  (Dummy Switches) Light/Switch (Modus)
2020-04-21 23:50:26.424  Status: dzVents: Info:  -=#Livingroom Lights | Lux#=-: ------ Start internal script: Lampen woonkamer - Lux - test: Device: "Modus (Dummy Switches)", Index: 313
2020-04-21 23:50:26.424  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Processing device-adapter for Bewegiginssensor Woonkamer | Lux: Lux device adapter
2020-04-21 23:50:26.424  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Processing device-adapter for Bewegingssensor Woonkamer | Beweging: Switch device adapter
2020-04-21 23:50:26.424  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Modus.lastUpdate.minutesAgo: 1045
2020-04-21 23:50:26.424  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Modus.state: Alles uit
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Lights switch -> lastUpdate not working

Post by waaren »

RobbieT wrote: Wednesday 22 April 2020 0:11 Here is the logging;
the only relevant result from the script is

Code: Select all

2020-04-21 23:50:26.424  Status: dzVents: Info:  -=#Livingroom Lights | Lux#=-: ------ Start internal script: Lampen woonkamer - Lux - test: Device: "Modus (Dummy Switches)", Index: 313
2020-04-21 23:50:26.424  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Processing device-adapter for Bewegiginssensor Woonkamer | Lux: Lux device adapter
2020-04-21 23:50:26.424  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Processing device-adapter for Bewegingssensor Woonkamer | Beweging: Switch device adapter
2020-04-21 23:50:26.424  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Modus.lastUpdate.minutesAgo: 1045
2020-04-21 23:50:26.424  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Modus.state: Alles uit
There must have been more then this. The other loglines are from other scripts.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
RobbieT
Posts: 17
Joined: Thursday 13 December 2018 14:34
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Lights switch -> lastUpdate not working

Post by RobbieT »

waaren wrote: Wednesday 22 April 2020 1:14
RobbieT wrote: Wednesday 22 April 2020 0:11 Here is the logging;
the only relevant result from the script is

Code: Select all

2020-04-21 23:50:26.424  Status: dzVents: Info:  -=#Livingroom Lights | Lux#=-: ------ Start internal script: Lampen woonkamer - Lux - test: Device: "Modus (Dummy Switches)", Index: 313
2020-04-21 23:50:26.424  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Processing device-adapter for Bewegiginssensor Woonkamer | Lux: Lux device adapter
2020-04-21 23:50:26.424  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Processing device-adapter for Bewegingssensor Woonkamer | Beweging: Switch device adapter
2020-04-21 23:50:26.424  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Modus.lastUpdate.minutesAgo: 1045
2020-04-21 23:50:26.424  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Modus.state: Alles uit
There must have been more then this. The other loglines are from other scripts.
This is everything that happens when I push the button when I go to bed.

Code: Select all

2020-04-21 23:49:56.339  Status: dzVents: Info:  Lampen woonkamer geschakeld: ------ Start internal script: Lampen woonkamer via knop: Device: "Xiaomi Switch (Xiaomi Gateway)", Index: 92
2020-04-21 23:49:56.339  Status: dzVents: Info:  Lampen woonkamer geschakeld: De lampen zijn uitgeschakeld
2020-04-21 23:49:56.339  Status: dzVents: Info:  Lampen woonkamer geschakeld: ------ Finished Lampen woonkamer via knop
2020-04-21 23:49:56.340  Status: EventSystem: Script event triggered: /usr/local/domoticz/dzVents/runtime/dzVents.lua
2020-04-21 23:49:56.341  EventSystem: Event triggered: Switch naar off_1
2020-04-21 23:49:56.385  (Milight Hub DIY - MQTT) 007/Lampen | Eettafel alles - MQTT: Command: 'Off', Level: 0, Color:
2020-04-21 23:49:56.385  (Milight Hub DIY - MQTT) 018/Lampen | Keuken - Ledstrip - MQTT: Command: 'Off', Level: 0, Color:
2020-04-21 23:49:56.686  (Milight Hub DIY - MQTT) 007/Lampen | Eettafel alles - MQTT: State change: '{'state': 'OFF'}
2020-04-21 23:49:57.806  (Milight Hub DIY - MQTT) 018/Lampen | Keuken - Ledstrip - MQTT: State change: '{'state': 'OFF'}
2020-04-21 23:50:01.353  (Xiaomi Gateway) Light/Switch (Xiaomi Switch)
2020-04-21 23:50:01.372  Status: dzVents: Info:  Lampen woonkamer geschakeld: ------ Start internal script: Lampen woonkamer via knop: Device: "Xiaomi Switch (Xiaomi Gateway)", Index: 92
2020-04-21 23:50:01.373  Status: dzVents: Info:  Lampen woonkamer geschakeld: ------ Finished Lampen woonkamer via knop
2020-04-21 23:50:06.372  (Milight Hub DIY - MQTT) 004/Lampen | Bank alles - MQTT: Command: 'Off', Level: 0, Color:
2020-04-21 23:50:06.773  (Milight Hub DIY - MQTT) 004/Lampen | Bank alles - MQTT: State change: '{'state': 'OFF'}
2020-04-21 23:50:11.528  (Xiaomi Gateway) Light/Switch (Smartplug - Lamp naast TV)
2020-04-21 23:50:11.974  Status: {"cmd":"report","model":"plug","sid":"158d00028ac7ab","short_id":44587,"data":"{\"status\":\"off\"}"}
2020-04-21 23:50:16.393  (Milight Hub DIY - MQTT) 001/Lampen | Dressoir - MQTT: Command: 'Off', Level: 0, Color:
2020-04-21 23:50:16.694  (Milight Hub DIY - MQTT) 001/Lampen | Dressoir - MQTT: State change: '{'state': 'OFF'}
2020-04-21 23:50:26.363  (Dummy Switches) Light/Switch (Algemeen uit)
2020-04-21 23:50:26.383  Status: dzVents: Info:  -=#Switch mode#=-: ------ Start internal script: Modus aanpassen: Device: "Algemeen uit (Dummy Switches)", Index: 243
2020-04-21 23:50:26.383  Status: dzVents: Info:  -=#Switch mode#=-: ------ Finished Modus aanpassen
2020-04-21 23:50:26.383  Status: EventSystem: Script event triggered: /usr/local/domoticz/dzVents/runtime/dzVents.lua
2020-04-21 23:50:26.404  (Dummy Switches) Light/Switch (Modus)
2020-04-21 23:50:26.424  Status: dzVents: Info:  ------ Start internal script: Automatische vakantiemodus: Device: "Modus (Dummy Switches)", Index: 313
2020-04-21 23:50:26.424  Status: dzVents: Info:  ------ Finished Automatische vakantiemodus
2020-04-21 23:50:26.424  Status: dzVents: Info:  -=#Livingroom Lights | Lux#=-: ------ Start internal script: Lampen woonkamer - Lux - test: Device: "Modus (Dummy Switches)", Index: 313
2020-04-21 23:50:26.424  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Processing device-adapter for Bewegiginssensor Woonkamer | Lux: Lux device adapter
2020-04-21 23:50:26.424  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Processing device-adapter for Bewegingssensor Woonkamer | Beweging: Switch device adapter
2020-04-21 23:50:26.424  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Modus.lastUpdate.minutesAgo: 1045
2020-04-21 23:50:26.424  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Modus.state: Alles uit
2020-04-21 23:50:26.424  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Modus state: Alles uit
2020-04-21 23:50:26.424  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Bewegingssensor Woonkamer | Beweging active: true
2020-04-21 23:50:26.424  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Processing device-adapter for Lampen | Dressoir - MQTT: RGB(W) device adapter
2020-04-21 23:50:26.424  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Processing device-adapter for Lampen | Dressoir - MQTT: Switch device adapter
2020-04-21 23:50:26.424  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Constructed timed-command: Off
2020-04-21 23:50:26.425  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Processing device-adapter for Lampen | Eettafel alles - MQTT: RGB(W) device adapter
2020-04-21 23:50:26.425  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Processing device-adapter for Lampen | Eettafel alles - MQTT: Switch device adapter
2020-04-21 23:50:26.425  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Constructed timed-command: Set Level 15
2020-04-21 23:50:26.425  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Processing device-adapter for Lampen | Bank alles - MQTT: RGB(W) device adapter
2020-04-21 23:50:26.425  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Processing device-adapter for Lampen | Bank alles - MQTT: Switch device adapter
2020-04-21 23:50:26.425  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Constructed timed-command: Set Level 15
2020-04-21 23:50:26.425  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Constructed timed-command: Off
2020-04-21 23:50:26.425  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Constructed timed-command: Off AFTER 150 SECONDS
2020-04-21 23:50:26.425  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Constructed timed-command: Off
2020-04-21 23:50:26.425  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Constructed timed-command: Off AFTER 150 SECONDS
2020-04-21 23:50:26.425  Status: dzVents: Info:  -=#Livingroom Lights | Lux#=-: ------ Finished Lampen woonkamer - Lux - test
2020-04-21 23:50:26.425  Status: EventSystem: Script event triggered: /usr/local/domoticz/dzVents/runtime/dzVents.lua
2020-04-21 23:50:26.472  (Milight Hub DIY - MQTT) 007/Lampen | Eettafel alles - MQTT: Command: 'Set Level', Level: 15, Color:
2020-04-21 23:50:26.472  (Milight Hub DIY - MQTT) 004/Lampen | Bank alles - MQTT: Command: 'Set Level', Level: 15, Color:
2020-04-21 23:50:26.823  (Milight Hub DIY - MQTT) 007/Lampen | Eettafel alles - MQTT: State change: '{'state': 'ON'}
2020-04-21 23:50:27.075  (Milight Hub DIY - MQTT) 007/Lampen | Eettafel alles - MQTT: State change: '{'brightness': 38}
2020-04-21 23:50:27.326  (Milight Hub DIY - MQTT) 004/Lampen | Bank alles - MQTT: State change: '{'state': 'ON'}
2020-04-21 23:50:27.578  (Milight Hub DIY - MQTT) 004/Lampen | Bank alles - MQTT: State change: '{'brightness': 38}
2020-04-21 23:51:10.280  (Xiaomi Gateway) Light/Switch (Bewegingssensor Woonkamer | Beweging)
2020-04-21 23:51:10.280  Status: {"cmd":"report","model":"sensor_motion.aq2","sid":"158d00046668a2","short_id":40452,"data":"{\"no_motion\":\"120\"}"}
2020-04-21 23:51:10.299  Status: dzVents: Info:  -=#Livingroom Lights | Lux#=-: ------ Start internal script: Lampen woonkamer - Lux - test: Device: "Bewegingssensor Woonkamer | Beweging (Xiaomi Gateway)", Index: 312
2020-04-21 23:51:10.299  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Processing device-adapter for Modus: Switch device adapter
2020-04-21 23:51:10.300  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Processing device-adapter for Bewegiginssensor Woonkamer | Lux: Lux device adapter
2020-04-21 23:51:10.300  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Modus.lastUpdate.minutesAgo: 0
2020-04-21 23:51:10.300  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Modus.state: Alles uit
2020-04-21 23:51:10.300  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Bewegingssensor Woonkamer | Beweging state: Off
2020-04-21 23:51:10.300  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Bewegingssensor Woonkamer | Beweging active: false
2020-04-21 23:51:10.300  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Processing device-adapter for Lampen | Dressoir - MQTT: RGB(W) device adapter
2020-04-21 23:51:10.300  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Processing device-adapter for Lampen | Dressoir - MQTT: Switch device adapter
2020-04-21 23:51:10.300  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Constructed timed-command: Off
2020-04-21 23:51:10.300  Status: dzVents: Info:  -=#Livingroom Lights | Lux#=-: ------ Finished Lampen woonkamer - Lux - test
2020-04-21 23:51:18.249  Status: {"cmd":"report","model":"sensor_motion.aq2","sid":"158d00046668a2","short_id":40452,"data":"{\"lux\":\"0\"}"}
2020-04-21 23:51:18.249  (Xiaomi Gateway) Lux (Bewegiginssensor Woonkamer | Lux)
2020-04-21 23:51:18.257  (Xiaomi Gateway) Light/Switch (Bewegingssensor Woonkamer | Beweging)
2020-04-21 23:51:18.257  Status: {"cmd":"report","model":"sensor_motion.aq2","sid":"158d00046668a2","short_id":40452,"data":"{\"status\":\"motion\"}"}
2020-04-21 23:51:18.269  Status: dzVents: Info:  -=#Livingroom Lights | Lux#=-: ------ Start internal script: Lampen woonkamer - Lux - test: Device: "Bewegiginssensor Woonkamer | Lux (Xiaomi Gateway)", Index: 311
2020-04-21 23:51:18.269  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Processing device-adapter for Modus: Switch device adapter
2020-04-21 23:51:18.269  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Processing device-adapter for Bewegingssensor Woonkamer | Beweging: Switch device adapter
2020-04-21 23:51:18.269  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Modus.lastUpdate.minutesAgo: 0
2020-04-21 23:51:18.269  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Modus.state: Alles uit
2020-04-21 23:51:18.269  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Bewegiginssensor Woonkamer | Lux state: 0
2020-04-21 23:51:18.269  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Bewegingssensor Woonkamer | Beweging active: false
2020-04-21 23:51:18.269  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Processing device-adapter for Lampen | Dressoir - MQTT: RGB(W) device adapter
2020-04-21 23:51:18.269  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Processing device-adapter for Lampen | Dressoir - MQTT: Switch device adapter
2020-04-21 23:51:18.269  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Constructed timed-command: Off
2020-04-21 23:51:18.269  Status: dzVents: Info:  -=#Livingroom Lights | Lux#=-: ------ Finished Lampen woonkamer - Lux - test
2020-04-21 23:51:18.290  Status: dzVents: Info:  -=#Livingroom Lights | Lux#=-: ------ Start internal script: Lampen woonkamer - Lux - test: Device: "Bewegingssensor Woonkamer | Beweging (Xiaomi Gateway)", Index: 312
2020-04-21 23:51:18.290  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Processing device-adapter for Modus: Switch device adapter
2020-04-21 23:51:18.290  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Processing device-adapter for Bewegiginssensor Woonkamer | Lux: Lux device adapter
2020-04-21 23:51:18.290  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Modus.lastUpdate.minutesAgo: 0
2020-04-21 23:51:18.290  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Modus.state: Alles uit
2020-04-21 23:51:18.290  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Bewegingssensor Woonkamer | Beweging state: On
2020-04-21 23:51:18.290  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Bewegingssensor Woonkamer | Beweging active: true
2020-04-21 23:51:18.290  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Processing device-adapter for Lampen | Dressoir - MQTT: RGB(W) device adapter
2020-04-21 23:51:18.290  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Processing device-adapter for Lampen | Dressoir - MQTT: Switch device adapter
2020-04-21 23:51:18.290  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Constructed timed-command: Off
2020-04-21 23:51:18.290  Status: dzVents: Info:  -=#Livingroom Lights | Lux#=-: ------ Finished Lampen woonkamer - Lux - test
2020-04-21 23:52:56.460  (Milight Hub DIY - MQTT) 007/Lampen | Eettafel alles - MQTT: Command: 'Off', Level: 0, Color:
2020-04-21 23:52:56.460  (Milight Hub DIY - MQTT) 004/Lampen | Bank alles - MQTT: Command: 'Off', Level: 0, Color:
2020-04-21 23:52:57.967  (Milight Hub DIY - MQTT) 007/Lampen | Eettafel alles - MQTT: State change: '{'state': 'OFF'}
2020-04-21 23:52:58.219  (Milight Hub DIY - MQTT) 004/Lampen | Bank alles - MQTT: State change: '{'state': 'OFF'}
2020-04-21 23:53:00.182  Status: EventSystem: Script event triggered: /usr/local/domoticz/dzVents/runtime/dzVents.lua
2020-04-21 23:53:17.985  (Xiaomi Gateway) Light/Switch (Bewegingssensor Woonkamer | Beweging)
2020-04-21 23:53:17.985  Status: {"cmd":"report","model":"sensor_motion.aq2","sid":"158d00046668a2","short_id":40452,"data":"{\"no_motion\":\"120\"}"}
2020-04-21 23:53:18.005  Status: dzVents: Info:  -=#Livingroom Lights | Lux#=-: ------ Start internal script: Lampen woonkamer - Lux - test: Device: "Bewegingssensor Woonkamer | Beweging (Xiaomi Gateway)", Index: 312
2020-04-21 23:53:18.005  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Processing device-adapter for Modus: Switch device adapter
2020-04-21 23:53:18.005  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Processing device-adapter for Bewegiginssensor Woonkamer | Lux: Lux device adapter
2020-04-21 23:53:18.005  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Modus.lastUpdate.minutesAgo: 2
2020-04-21 23:53:18.005  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Modus.state: Alles uit
2020-04-21 23:53:18.005  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Bewegingssensor Woonkamer | Beweging state: Off
2020-04-21 23:53:18.005  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Bewegingssensor Woonkamer | Beweging active: false
2020-04-21 23:53:18.005  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Processing device-adapter for Lampen | Dressoir - MQTT: RGB(W) device adapter
2020-04-21 23:53:18.005  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Processing device-adapter for Lampen | Dressoir - MQTT: Switch device adapter
2020-04-21 23:53:18.005  Status: dzVents: Debug: -=#Livingroom Lights | Lux#=-: Constructed timed-command: Off
2020-04-21 23:53:18.005  Status: dzVents: Info:  -=#Livingroom Lights | Lux#=-: ------ Finished Lampen woonkamer - Lux - test
for the complete info, this is the part from the script that is executed when I click the button (log marker; marker = "Lampen woonkamer geschakeld)

Code: Select all

        elseif (Knop.state == 'Double Click') then 
            domoticz.devices(188).switchOff().checkFirst()                          --Lampen boven eettafel
            domoticz.devices(290).switchOff().checkFirst()                          --Lamp onder keukenkastjes
            domoticz.devices(185).switchOff().afterSec(10)                          --Lampen boven bank
            domoticz.devices(51).switchOff().afterSec(15)                           --Lamp naast televisie
            domoticz.devices(179).switchOff().afterSec(20)                          --Lamp boven dressoir
            domoticz.devices(243).switchOn()                                        --Algemeen op uit      
            domoticz.log('De lampen zijn uitgeschakeld')
            
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Lights switch -> lastUpdate not working

Post by waaren »

RobbieT wrote: Wednesday 22 April 2020 13:06 for the complete info, this is the part from the script that is executed when I click the button (log marker; marker = "Lampen woonkamer geschakeld)
Thx. Based on this log this is what I see happening in the script and by domoticz

Code: Select all

23:50:26 Script is triggered by Mode -->> (alles uit)
line 43:  domoticz.devices(179).switchOff().checkFirst() is processed
line 60-63 
 domoticz.devices(188).dimTo(15)                                                     --Turn on lights above the dinnertable at 15%
 domoticz.devices(185).dimTo(15)                                                     --Turn on lights above the couch at 15%
 domoticz.devices(188).switchOff().afterSec(150)                                     --Turn off lights above the dinnertable after 2.5 minutes
 domoticz.devices(185).switchOff().afterSec(150)   
are processed

23:51:10 Script is triggered by Bewegingssensor Woonkamer | Beweging  -->> (Off)
line 43:  domoticz.devices(179).switchOff().checkFirst() is processed

23:51:18 Script is triggered by Bewegiginssensor Woonkamer | Lux  -->>  (0)
line 43:  domoticz.devices(179).switchOff().checkFirst() is processed

23:51:18 Script is triggered by "Bewegingssensor Woonkamer | Beweging -->> (On)
line 43:  domoticz.devices(179).switchOff().checkFirst() is processed


23:52:56 Lights off commands send to lights (150 seconds after the switchOff()afterSec(150) command)

23:53:18 Script is triggered by "Bewegingssensor Woonkamer | Beweging -->> (Off)
line 43:  domoticz.devices(179).switchOff().checkFirst() is processed
My conclusion based on the above: lastUpdate is working and domoticz sends the required commands to the devices.
I suspect that the strange effect you describe is from another script or device action or group.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest