dzVents script works, but LED lights are not turned on

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

Moderator: leecollings

egrootoonk
Posts: 15
Joined: Wednesday 04 November 2015 15:19
Target OS: Raspberry Pi / ODroid
Domoticz version: V4.10233
Location: Nederland
Contact:

dzVents script works, but LED lights are not turned on

Post by egrootoonk »

Hello,
I have the dzVents code

Code: Select all

return {
	on = {
		devices = {
			'PIR'
		}
	},
	execute = function(domoticz, devices)

if (devices.state == 'On') then 

domoticz.devices(34).switchOn().checkFirst().forMin(1)
domoticz.devices(34).switchOff().checkFirst().afterMin(1)
end
end
}
This is actually working, BUT, the light switch is not turned on. In Domoticz I see the switch (light bulb) is turned on, but I don't see and hear the switch (and the LED lights are not turned on).

The moment I manually turn on the LED lights (by clicking in Domoticz on the switch), the LED lights do turn on!!!

Below is the log of the part when the PIR is activated.
2018-11-29 10:56:24.922 Status: dzVents: Info: Handling events for: "PIR", value: "On"
2018-11-29 10:56:24.922 Status: dzVents: Info: ------ Start internal script: Kippenhok: Device: "PIR (RFLink)", Index: 64
2018-11-29 10:56:24.924 Status: dzVents: Info: ------ Finished Kippenhok
2018-11-29 10:56:24.980 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
2018-11-29 10:56:25.013 Status: RFLink Sending: 10;NewKaku;3e540e6;2;ON;
2018-11-29 10:56:34.971 Status: dzVents: Info: Handling events for: "PIR", value: "Off"
2018-11-29 10:56:34.971 Status: dzVents: Info: ------ Start internal script: Kippenhok: Device: "PIR (RFLink)", Index: 64
2018-11-29 10:56:34.971 Status: dzVents: Info: ------ Finished Kippenhok
2018-11-29 10:57:24.989 Status: RFLink Sending: 10;NewKaku;3e540e6;2;OFF;

When I look at the log. It all seems fine, but the LED lights aren't switched on.

Below I have the log of manually switching on the lights
2018-11-29 11:24:30.357 Status: User: Admin initiated a switch command (34/Paardenstal/On)
2018-11-29 11:24:30.358 Status: RFLink Sending: 10;NewKaku;3e540e6;2;ON;
2018-11-29 11:24:45.373 Status: User: Admin initiated a switch command (34/Paardenstal/Off)
2018-11-29 11:24:45.374 Status: RFLink Sending: 10;NewKaku;3e540e6;2;OFF;

Now the LED are turned on and off.

I tried a lot of things.
In the dzVents script I replaced the switch on/of by calling the Domotiz REST API. When I manually call the http "get" the LED lights are turned on, but the moment the script does it, it isn't (meaning in Domoticz they are, but in real live the LED's aren't).

To switch the the lights, I use RF-Link. I have over 15 lights controled by Domoticz and RF-Link with no problem. Blockly scripts or scheduled on/of, all with no problems.

who can help me.


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

Re: dzVents script works, but LED lights are not turned on

Post by waaren »

egrootoonk wrote: Thursday 29 November 2018 11:31 The light switch is not turned on. In Domoticz I see the switch (light bulb) is turned on, but I don't see and hear the switch (and the LED lights are not turned on).
If I understand your script and description correctly you want the light to go on for one minute when motion is detected.
If that is indeed your intention then the script below will do just that.

Code: Select all

return {
	on = {
		devices = {
			'PIR'
		}
	},
	execute = function(domoticz, device)
        if device.state == 'On' then 
            domoticz.devices(34).switchOn().checkFirst().forMin(1)
        end
end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
egrootoonk
Posts: 15
Joined: Wednesday 04 November 2015 15:19
Target OS: Raspberry Pi / ODroid
Domoticz version: V4.10233
Location: Nederland
Contact:

Re: dzVents script works, but LED lights are not turned on

Post by egrootoonk »

waaren wrote: Thursday 29 November 2018 14:30
egrootoonk wrote: Thursday 29 November 2018 11:31 The light switch is not turned on. In Domoticz I see the switch (light bulb) is turned on, but I don't see and hear the switch (and the LED lights are not turned on).
If I understand your script and description correctly you want the light to go on for one minute when motion is detected.
If that is indeed your intention then the script below will do just that.
In the wiki of dzVents is this Note below. So I guess I need the on and off (as in my code).
The problem is: the script logic and Domoticz are working fine. but the LED lights don't go on.


https://www.domoticz.com/wiki/DzVents:_ ... _scripting

Important note when using forXXX(): Let's say you have a light that is triggered by a motion detector. Currently the light is Off and you do this: light.switchOn().forMin(5). What happens inside Domoticz is this: at t0 Domoticz issues the switchOn() command and schedules a command to restore the current state at t5 which is Off. So at t5 it will switch the light off.

If, however, before the scheduled switchOff() happens at t5, new motion is detected and you send this command again at t2 then something unpredictable may seem to happen: the light is never turned off! This is what happens:

At t2 Domoticz receives the switchOn().forMin(5) command again. It sees a scheduled command at t5 and deletes that command (it is within the new interval). Then Domoticz performs the (unnecessary, it's already on) switchOn() command. Then it checks the current state of the light which is On!! and schedules a command to return to that state at t2+5=t7. So, at t7 the light is switched on again. And there you have it: the light is not switched off and never will be because future commands will always be checked against the current on-state.

That's just how it works and you will have to deal with it in your script. So, instead of simply re-issuing switchOn().forMin(5) you have to check the switch's state first:

if (light.active) then
light.switchOff().afterMin(5)
else
light.switchOn().forMin(5)
end
or issue these two commands both as they are mutually exclusive:

light.switchOff().checkFirst().afterMin(5)
light.switchOn().checkFirst().forMin(5)
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: dzVents script works, but LED lights are not turned on

Post by waaren »

egrootoonk wrote: Thursday 29 November 2018 14:47 Important note when using forXXX(): Let's say you have a light that is triggered by a motion detector. Currently the light is Off and you do this: light.switchOn().forMin(5). What happens inside Domoticz is this: at t0 Domoticz issues the switchOn() command and schedules a command to restore the current state at t5 which is Off. So at t5 it will switch the light off.
Ah.. understand now. Should be handled correctly with this

Code: Select all

return {
        on = { devices = { 'PIR' }},
        
    execute = function(domoticz, device)
        light = domoticz.devices(34)
       
        
        if device.state == 'On' then 
            light.cancelQueuedCommands()
            light.switchOn().checkFirst()
            light.switchOff().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
egrootoonk
Posts: 15
Joined: Wednesday 04 November 2015 15:19
Target OS: Raspberry Pi / ODroid
Domoticz version: V4.10233
Location: Nederland
Contact:

Re: dzVents script works, but LED lights are not turned on

Post by egrootoonk »

waaren wrote: Thursday 29 November 2018 15:49
egrootoonk wrote: Thursday 29 November 2018 14:47 Important note when using forXXX(): Let's say you have a light that is triggered by a motion detector. Currently the light is Off and you do this: light.switchOn().forMin(5). What happens inside Domoticz is this: at t0 Domoticz issues the switchOn() command and schedules a command to restore the current state at t5 which is Off. So at t5 it will switch the light off.
Ah.. understand now. Should be handled correctly with this

Code: Select all

return {
        on = { devices = { 'PIR' }},
        
    execute = function(domoticz, device)
        light = domoticz.devices(34)
       
        
        if device.state == 'On' then 
            light.cancelQueuedCommands()
            light.switchOn().checkFirst()
            light.switchOff().afterSec(60)
        end
    end
}
But Waaren, still the LED's don't turn on after PIR movement. What can it be?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: dzVents script works, but LED lights are not turned on

Post by waaren »

egrootoonk wrote: Thursday 29 November 2018 15:55 still the LED's don't turn on after PIR movement. What can it be?
Could be a number of things.
- current state not correct in domoticz
- PIR returning wrong state
- dzVents not active
- wrong name or number in the script (is PIR the name of the motion detector or is it PIR_something ?)

To investigate root cause we first should find out what is in the log.

I added some log statements.

Code: Select all

return {
        on = { devices = { "PIR" }},
        -- on = { devices = { "PIR*" }}, -- if motion detector name starts with PIR
  
        
logging = 
        {
                level           = domoticz.LOG_DEBUG,
                marker      =    "PIR"
        },

        
    execute = function(domoticz, device)
        light = domoticz.devices(34)
        
        local function logWrite(str,level)
            domoticz.log(str,level or domoticz.LOG_DEBUG)
        end
        logWrite(device.name .. " state: ".. device.state)
        logWrite(light.name .. " state: " .. light.state)
        
        if device.state == 'On' then 
            logWrite("PIR.state is On " )
            light.cancelQueuedCommands()
            light.switchOn().checkFirst()
            light.switchOff().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
egrootoonk
Posts: 15
Joined: Wednesday 04 November 2015 15:19
Target OS: Raspberry Pi / ODroid
Domoticz version: V4.10233
Location: Nederland
Contact:

Re: dzVents script works, but LED lights are not turned on

Post by egrootoonk »

Domoticz responds the same. From op Domoticz pov it it working like a charm. I see the PIR sensor activated and the switch IDX34 goes on. Domoticz shows me all this.

But: the actual lights are not switched on. It seems like the instructions to the gateway (RFLink) is not right. (If I manually click the IDX34 switch. the lights do switch on...

The log file:
2018-11-29 16:58:41.356 Status: EventSystem: reset all events...
2018-11-29 16:58:41.358 Status: dzVents: Write file: /home/pi/domoticz/scripts/dzVents/generated_scripts/Kippenhok log.lua
2018-11-29 16:58:57.488 (RFLink) Light/Switch (PIR)
2018-11-29 16:58:57.594 Status: dzVents: Info: Handling events for: "PIR", value: "On"
2018-11-29 16:58:57.594 Status: dzVents: Info: PIR: ------ Start internal script: Kippenhok log: Device: "PIR (RFLink)", Index: 64
2018-11-29 16:58:57.595 Status: dzVents: Debug: PIR: Processing device-adapter for Paardenstal: Switch device adapter
2018-11-29 16:58:57.595 Status: dzVents: Debug: PIR: PIR state: On
2018-11-29 16:58:57.595 Status: dzVents: Debug: PIR: Paardenstal state: Off
2018-11-29 16:58:57.595 Status: dzVents: Debug: PIR: PIR.state is On
2018-11-29 16:58:57.595 Status: dzVents: Debug: PIR: Constructed timed-command: On
2018-11-29 16:58:57.595 Status: dzVents: Debug: PIR: Constructed timed-command: On
2018-11-29 16:58:57.595 Status: dzVents: Debug: PIR: Constructed timed-command: Off
2018-11-29 16:58:57.595 Status: dzVents: Debug: PIR: Constructed timed-command: Off AFTER 60 SECONDS
2018-11-29 16:58:57.595 Status: dzVents: Info: PIR: ------ Finished Kippenhok log
2018-11-29 16:58:57.653 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
2018-11-29 16:58:57.654 Status: RFLink Sending: 10;NewKaku;3e540e6;2;ON;
2018-11-29 16:58:58.583 (RFLink) Light/Switch (Paardenstal)
2018-11-29 16:59:07.528 (RFLink) Light/Switch (PIR)
2018-11-29 16:59:07.659 Status: dzVents: Info: Handling events for: "PIR", value: "Off"
2018-11-29 16:59:07.659 Status: dzVents: Info: PIR: ------ Start internal script: Kippenhok log: Device: "PIR (RFLink)", Index: 64
2018-11-29 16:59:07.660 Status: dzVents: Debug: PIR: Processing device-adapter for Paardenstal: Switch device adapter
2018-11-29 16:59:07.660 Status: dzVents: Debug: PIR: PIR state: Off
2018-11-29 16:59:07.660 Status: dzVents: Debug: PIR: Paardenstal state: On
2018-11-29 16:59:07.660 Status: dzVents: Info: PIR: ------ Finished Kippenhok log
2018-11-29 16:59:57.670 Status: RFLink Sending: 10;NewKaku;3e540e6;2;OFF;
2018-11-29 16:59:58.621 (RFLink) Light/Switch (Paardenstal)
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: dzVents script works, but LED lights are not turned on

Post by waaren »

egrootoonk wrote: Thursday 29 November 2018 16:55 Domoticz responds the same. From op Domoticz pov it it working like a charm. I see the PIR sensor activated and the switch IDX34 goes on. Domoticz shows me all this.

But: the actual lights are not switched on. It seems like the instructions to the gateway (RFLink) is not right. (If I manually click the IDX34 switch. the lights do switch on...
The log shows that the script works as expected and domoticz does send the command. Problem might be some interfering signal.
Can you also show the log when you manually switch the light ?
One approach is to send the on signal more than once (with the repeatAfterSec(1,3)) I use this for some of my lights that are far away from my RFLink.

Code: Select all

return {
        on = { devices = { "PIR" }},
        -- on = { devices = { "PIR*" }}, -- if motion detector name starts with PIR
  
        
logging = 
        {
                level           = domoticz.LOG_DEBUG,
                marker      =    "PIR"
        },

        
    execute = function(domoticz, device)
        light = domoticz.devices(34)
        
        local function logWrite(str,level)
            domoticz.log(str,level or domoticz.LOG_DEBUG)
        end
        logWrite(device.name .. " state: ".. device.state)
        logWrite(light.name .. " state: " .. light.state)
        
        if device.state == 'On' then 
            logWrite("PIR.state is On " )
            light.cancelQueuedCommands()
            light.switchOn().repeatAfterSec(1, 3)
            light.switchOff().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
egrootoonk
Posts: 15
Joined: Wednesday 04 November 2015 15:19
Target OS: Raspberry Pi / ODroid
Domoticz version: V4.10233
Location: Nederland
Contact:

Re: dzVents script works, but LED lights are not turned on

Post by egrootoonk »

I can confirm that the LED lights were switched on and of (2 times) when I manually switch them on/of

This is the light in Domoticz
https://drive.google.com/open?id=1UdXbB ... aDhjvPiEFa

Now we are getting to the core of the problem.
When the script switches it seems like it is sending the signal (but it's not)
When I manually switch the lights on/off the signal is send to the lights and the LED are turned on!

I can't explain why.

2018-11-30 17:21:36.433 Status: User: Admin initiated a switch command (34/Paardenstal/On)
2018-11-30 17:21:36.434 Status: RFLink Sending: 10;NewKaku;3e540e6;2;ON;
2018-11-30 17:21:37.348 (RFLink) Light/Switch (Paardenstal)
2018-11-30 17:21:51.591 Status: User: Admin initiated a switch command (34/Paardenstal/Off)
2018-11-30 17:21:51.592 Status: RFLink Sending: 10;NewKaku;3e540e6;2;OFF;
2018-11-30 17:21:52.512 (RFLink) Light/Switch (Paardenstal)
2018-11-30 17:21:57.831 Status: User: Admin initiated a switch command (34/Paardenstal/On)
2018-11-30 17:21:57.832 Status: RFLink Sending: 10;NewKaku;3e540e6;2;ON;
2018-11-30 17:21:58.767 (RFLink) Light/Switch (Paardenstal)
2018-11-30 17:22:06.628 Status: User: Admin initiated a switch command (34/Paardenstal/Off)
2018-11-30 17:22:06.629 Status: RFLink Sending: 10;NewKaku;3e540e6;2;OFF;
2018-11-30 17:22:07.575 (RFLink) Light/Switch (Paardenstal)
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: dzVents script works, but LED lights are not turned on

Post by waaren »

egrootoonk wrote: Friday 30 November 2018 17:27 Now we are getting to the core of the problem.
When the script switches it seems like it is sending the signal (but it's not)
The script itself does not send anything. It just ask domoticz to do this and domoticz send that request to the hardware.
The lines

Code: Select all

2018-11-29 16:58:57.654 Status: RFLink Sending: 10;NewKaku;3e540e6;2;ON;
2018-11-29 16:59:57.670 Status: RFLink Sending: 10;NewKaku;3e540e6;2;OFF;
are not send by the script but are directly from domoticz and are exactly the same as the commands domoticz send when triggered by the switch

Code: Select all

2018-11-30 17:21:57.832 Status: RFLink Sending: 10;NewKaku;3e540e6;2;ON;
2018-11-30 17:22:06.629 Status: RFLink Sending: 10;NewKaku;3e540e6;2;OFF;
So I don't share your conclusion. If you are not convinced I suggest that you test it with another device closer to the rflink.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
egrootoonk
Posts: 15
Joined: Wednesday 04 November 2015 15:19
Target OS: Raspberry Pi / ODroid
Domoticz version: V4.10233
Location: Nederland
Contact:

Re: dzVents script works, but LED lights are not turned on

Post by egrootoonk »

I Did.

I replaced the switch to a switch apx 4 meters from the RFLink. Same results. Then I tried 3 others. All within very close range of the RFLink. All had the same result.

The switches are mixed in brand: Action, Kaku, euromest.
In Domoticz it seems oke., but in real life the lights are not activated.

Is there a way we can monitor the output of the RF link?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: dzVents script works, but LED lights are not turned on

Post by waaren »

egrootoonk wrote: Friday 30 November 2018 22:14 I Did.

I replaced the switch to a switch apx 4 meters from the RFLink. Same results. Then I tried 3 others. All within very close range of the RFLink. All had the same result.

The switches are mixed in brand: Action, Kaku, euromest.
In Domoticz it seems oke., but in real life the lights are not activated.

Is there a way we can monitor the output of the RF link?
Just to understand what is happening; When you switch the lights manually, Do you switch them using a wall switch or do you click on the bulb in the domoticz Gui ?
The difference between these two methods is that by using the wall switch you send the signal from this wall switch directly. When using the the domoticz Gui the signal will be send using your rfLink.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
egrootoonk
Posts: 15
Joined: Wednesday 04 November 2015 15:19
Target OS: Raspberry Pi / ODroid
Domoticz version: V4.10233
Location: Nederland
Contact:

Re: dzVents script works, but LED lights are not turned on

Post by egrootoonk »

Just to understand what is happening; When you switch the lights manually, Do you switch them using a wall switch or do you click on the bulb in the domoticz Gui ?
Gui
When the script is fired, I see the changes in the Gui and log but LED stay out. If I click in the Gui on the light bulb, the light do turn on.
elmortero
Posts: 247
Joined: Sunday 29 November 2015 20:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.9639
Location: Spain
Contact:

Re: dzVents script works, but LED lights are not turned on

Post by elmortero »

Out of curiosity: what if you change light = domoticz.devices(34) to light = domoticz.devices('Paardenstal') ?
egrootoonk
Posts: 15
Joined: Wednesday 04 November 2015 15:19
Target OS: Raspberry Pi / ODroid
Domoticz version: V4.10233
Location: Nederland
Contact:

Re: dzVents script works, but LED lights are not turned on

Post by egrootoonk »

I did, no change in behaviour.

Is there a way to see what is send to rflink?
egrootoonk
Posts: 15
Joined: Wednesday 04 November 2015 15:19
Target OS: Raspberry Pi / ODroid
Domoticz version: V4.10233
Location: Nederland
Contact:

Re: dzVents script works, but LED lights are not turned on

Post by egrootoonk »

I found a way to debug the data send/received from RFLink and found out that dzVents is failing to send the "on" once the PIR was triggerd.

Code: Select all

10;rfdebug=on;

Code: Select all

Re: How to log RFLink "raw" messages in Domoticz ?

Post by Stuntteam » Wednesday 01 February 2017 14:52
We crafted a quick and dirty solution for this.
In the hardware tab, select the "Create RFLink Devices" button and in the popup enter:
10;rfdebug=on;
to activate the debug feature within the Domoticz log.
and
10;rfdebug=off;
to deactivate the debug feature.

If you get a timeout, the Domoticz (beta) version does not have support for this yet.
Obviously you will need a beta version that was compiled today..

Note: activating the debug option is only so that users can capture some debug packets without stopping/starting Domoticz, reconnecting RFLink etc.
It is not meant to be used in normal operation.
I Changed the switch to 'Schemerlamp Teak Kastje' in the dzVents script.

So what I did: 1. Turn on/off the light manually using the GUI of Domoticz. (The light did turn on and off).
Than I triggered the PIR so the script could kick in.

I found out that when I mannually turn on the light during the 60 seconds of the script, The lights are switched off by the script.
So it seem that the Switch ON is the problem.


2018-12-01 21:32:48.806 Status: User: Admin initiated a switch command (21/Schemerlamp Teak Kastje/On)
2018-12-01 21:32:48.807 Status: RFLink Sending: 10;TriState;8aa290;10;ON;
2018-12-01 21:32:49.062 RFLink: 20;D3;OK;
2018-12-01 21:32:49.066 (RFLink) Light/Switch (Schemerlamp Teak Kastje)
2018-12-01 21:32:54.543 RFLink: 20;D4;OK;
2018-12-01 21:32:54.547 (RFLink) Light/Switch (Schemerlamp Teak Kastje)
2018-12-01 21:32:54.278 Status: User: Admin initiated a switch command (21/Schemerlamp Teak Kastje/Off)
2018-12-01 21:32:54.279 Status: RFLink Sending: 10;TriState;8aa290;10;OFF;
2018-12-01 21:33:12.092 RFLink: 20;D5;DEBUG;Pulses=50;Pulses(uSec)=1200,300,1110,300,300,1110,300,1110,300,1110,1110,300,300,1110,300,1110,1110,300,1110,300,1110,300,300,1110,300,1110,300,1110,1110,300,300,1110,300,1110,300,1110,1110,300,1110,300,300,1110,1110,300,1110,300,300,1110,300,6990;
2018-12-01 21:33:12.100 RFLink: 20;D6;EV1527;ID=0c4e23;SWITCH=06;CMD=ON;
2018-12-01 21:33:12.112 (RFLink) Light/Switch (PIR)
2018-12-01 21:33:12.194 RFLink: 20;D7;DEBUG;Pulses=50;Pulses(uSec)=1200,300,1110,300,300,1110,300,1110,300,1110,1110,300,300,1110,300,1110,1110,300,1110,300,1110,300,300,1110,300,1110,300,1110,1110,300,300,1110,300,1110,300,1110,1110,300,1110,300,300,1110,1110,300,1110,300,300,1110,300,6990;
2018-12-01 21:33:12.360 RFLink: 20;D8;DEBUG;Pulses=50;Pulses(uSec)=1200,300,1110,300,300,1110,300,1110,300,1110,1110,300,300,1110,300,1110,1110,300,1110,300,1110,300,300,1110,300,1110,300,1110,1110,300,300,1110,300,1110,300,1110,1110,300,1110,300,300,1110,1110,300,1110,300,300,1110,300,6990;
2018-12-01 21:33:12.404 RFLink: 20;D9;DEBUG;Pulses=50;Pulses(uSec)=1200,300,1110,300,300,1110,300,1110,300,1110,1110,300,300,1110,300,1110,1110,300,1110,300,1110,300,300,1110,300,1110,300,1110,1110,300,300,1110,300,1110,300,1110,1110,300,1110,300,300,1110,1110,300,1110,300,300,1110,300,6990;
2018-12-01 21:33:12.617 RFLink: 20;DA;OK;
2018-12-01 21:33:12.620 (RFLink) Light/Switch (Schemerlamp Teak Kastje)
2018-12-01 21:33:12.760 RFLink: 20;DB;DEBUG;Pulses=50;Pulses(uSec)=1200,300,1110,300,300,1110,300,1110,300,1110,1110,300,300,1110,300,1110,1110,300,1110,300,1110,300,300,1110,300,1110,300,1110,1110,300,300,1110,300,1110,300,1110,1110,300,1110,300,300,1110,1110,300,1110,300,300,1110,300,6990;
2018-12-01 21:33:12.862 RFLink: 20;DC;DEBUG;Pulses=50;Pulses(uSec)=1200,300,1110,300,300,1110,300,1110,300,1110,1110,300,300,1110,300,1110,1110,300,1110,300,1110,300,300,1110,300,1110,300,1110,1110,300,300,1110,300,1110,300,1110,1110,300,1110,300,300,1110,1110,300,1110,300,300,1110,300,6990;
2018-12-01 21:33:12.969 RFLink: 20;DD;DEBUG;Pulses=50;Pulses(uSec)=1200,300,1110,300,300,1110,300,1110,300,1110,1110,300,300,1110,300,1110,1110,300,1110,300,1110,300,300,1110,300,1110,300,1110,1110,300,300,1110,300,1110,300,1110,1110,300,1110,300,300,1110,1110,300,1110,300,300,1110,300,6990;
2018-12-01 21:33:12.206 Status: dzVents: Info: Handling events for: "PIR", value: "On"
2018-12-01 21:33:12.206 Status: dzVents: Info: PIR: ------ Start internal script: Kippenhok log: Device: "PIR (RFLink)", Index: 64
2018-12-01 21:33:12.207 Status: dzVents: Debug: PIR: Processing device-adapter for Schemerlamp Teak Kastje: Switch device adapter
2018-12-01 21:33:12.207 Status: dzVents: Debug: PIR: PIR state: On
2018-12-01 21:33:12.207 Status: dzVents: Debug: PIR: Schemerlamp Teak Kastje state: Off
2018-12-01 21:33:12.207 Status: dzVents: Debug: PIR: PIR.state is On
2018-12-01 21:33:12.207 Status: dzVents: Debug: PIR: Constructed timed-command: On
2018-12-01 21:33:12.207 Status: dzVents: Debug: PIR: Constructed timed-command: On
2018-12-01 21:33:12.207 Status: dzVents: Debug: PIR: Constructed timed-command: Off
2018-12-01 21:33:12.208 Status: dzVents: Debug: PIR: Constructed timed-command: Off AFTER 60 SECONDS
2018-12-01 21:33:12.208 Status: dzVents: Info: PIR: ------ Finished Kippenhok log
2018-12-01 21:33:12.270 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
2018-12-01 21:33:12.283 Status: RFLink Sending: 10;TriState;8aa290;10;ON;
2018-12-01 21:33:13.071 RFLink: 20;DE;DEBUG;Pulses=50;Pulses(uSec)=1170,300,1110,300,300,1110,300,1110,300,1110,1110,300,300,1110,300,1110,1110,300,1110,300,1110,300,300,1110,300,1110,300,1110,1110,300,300,1110,300,1110,300,1110,1110,300,1110,300,300,1110,1110,300,1110,300,300,1110,300,6990;
2018-12-01 21:33:13.174 RFLink: 20;DF;DEBUG;Pulses=50;Pulses(uSec)=1200,300,1110,300,300,1110,300,1110,300,1110,1110,300,300,1110,300,1110,1110,300,1110,300,1110,300,300,1110,300,1110,300,1110,1110,300,300,1110,300,1110,300,1110,1110,300,1110,300,300,1110,1110,300,1110,300,300,1110,300,6990;
2018-12-01 21:33:13.275 RFLink: 20;E0;DEBUG;Pulses=50;Pulses(uSec)=1200,300,1110,300,300,1110,300,1110,300,1110,1110,300,300,1110,300,1110,1110,300,1110,300,1110,300,300,1110,300,1110,300,1110,1110,300,300,1110,300,1110,300,1110,1110,300,1110,300,300,1110,1110,300,1110,300,300,1110,300,6990;
2018-12-01 21:33:13.378 RFLink: 20;E1;DEBUG;Pulses=50;Pulses(uSec)=1200,300,1110,300,300,1110,300,1110,300,1110,1110,300,300,1110,300,1110,1110,300,1110,300,1110,300,300,1110,300,1110,300,1110,1110,300,300,1110,300,1110,300,1110,1110,300,1110,300,300,1110,1110,300,1110,300,300,1110,300,6990;
2018-12-01 21:33:22.133 (RFLink) Light/Switch (PIR)
2018-12-01 21:33:22.263 Status: dzVents: Info: Handling events for: "PIR", value: "Off"
2018-12-01 21:33:22.263 Status: dzVents: Info: PIR: ------ Start internal script: Kippenhok log: Device: "PIR (RFLink)", Index: 64
2018-12-01 21:33:22.264 Status: dzVents: Debug: PIR: Processing device-adapter for Schemerlamp Teak Kastje: Switch device adapter
2018-12-01 21:33:22.264 Status: dzVents: Debug: PIR: PIR state: Off
2018-12-01 21:33:22.264 Status: dzVents: Debug: PIR: Schemerlamp Teak Kastje state: On
2018-12-01 21:33:22.264 Status: dzVents: Info: PIR: ------ Finished Kippenhok log
2018-12-01 21:34:12.504 RFLink: 20;E2;OK;
2018-12-01 21:34:12.507 (RFLink) Light/Switch (Schemerlamp Teak Kastje)
2018-12-01 21:34:12.271 Status: RFLink Sending: 10;TriState;8aa290;10;OFF;
elmortero
Posts: 247
Joined: Sunday 29 November 2015 20:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.9639
Location: Spain
Contact:

Re: dzVents script works, but LED lights are not turned on

Post by elmortero »

From what I see in you log your script does exactly what is supposed to be done (or I am misunderstanding this totally).

Code: Select all

2018-12-01 21:33:12.206 Status: dzVents: Info: Handling events for: "PIR", value: "On"  --> motion detected by PIR, so script is launched
2018-12-01 21:33:12.207 Status: dzVents: Debug: PIR: PIR state: On
2018-12-01 21:33:12.207 Status: dzVents: Debug: PIR: Schemerlamp Teak Kastje state: Off  --> script detects PIR is ON and Schemer..... is OFF
2018-12-01 21:33:12.208 Status: dzVents: Debug: PIR: Constructed timed-command: Off AFTER 60 SECONDS --> action based on conditions from line 
                                                above: switch Schemer.. ON and switch OFF after 60 seconds

2018-12-01 21:34:12.507 (RFLink) Light/Switch (Schemerlamp Teak Kastje) --> 60 seconds have passed since the ON command from 21:33:12 so:
  2018-12-01 21:34:12.271 Status: RFLink Sending: 10;TriState;8aa290;10;OFF; --> send OFF command.
egrootoonk
Posts: 15
Joined: Wednesday 04 November 2015 15:19
Target OS: Raspberry Pi / ODroid
Domoticz version: V4.10233
Location: Nederland
Contact:

Re: dzVents script works, but LED lights are not turned on

Post by egrootoonk »

Yes I totally agree but I still can't explain why the LED is not switched on via the scripts as I said before when I use the GUI I can control the let's
SweetPants

Re: dzVents script works, but LED lights are not turned on

Post by SweetPants »

egrootoonk wrote: Sunday 02 December 2018 16:31 Yes I totally agree but I still can't explain why the LED is not switched on via the scripts as I said before when I use the GUI I can control the let's
Is the PIR also controlled by the RFLINK? It still could be interference, PIR transmitting multiple times and interfering with the switch commands for the LED's. This does not happen when you manually control the LED switch from domoticz. What happens if you do a SwitchOn.AfterSec(<delay>)?
egrootoonk
Posts: 15
Joined: Wednesday 04 November 2015 15:19
Target OS: Raspberry Pi / ODroid
Domoticz version: V4.10233
Location: Nederland
Contact:

Re: dzVents script works, but LED lights are not turned on

Post by egrootoonk »

SweetPants wrote: Monday 03 December 2018 12:32 What happens if you do a SwitchOn.AfterSec(<delay>)?
I did a quick test and it is looking good so far. I will test more tomorrow. Will let you know.

Thankx


Edwin
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest