light switch not off with SwitchOn().forMIN(2) [closed]

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

Moderator: leecollings

User avatar
rbisschops
Posts: 63
Joined: Monday 12 May 2014 11:20
Target OS: Raspberry Pi / ODroid
Domoticz version: 2.2563
Location: Schiedam, Netherlands
Contact:

Re: light switch not off with SwitchOn().forMIN(2)

Post by rbisschops »

dannybloe: isn't .active not part of V2.3? Like many, i'm running V2.2.

[edit] using .active gives unexpected behaviour in V2.2 not an error, so better be carefull with this :(
Last edited by rbisschops on Friday 05 January 2018 14:14, edited 2 times in total.
RPi 3B (master): RFXtrx433, Harmony Hub, Z-Wave devices, CoCo units, Hue, Xiaomi Aquara
RPi 2B (slave): P1 connection, MySensors with custom built watermeter sensors on Aquadis+
RPi’s with: Mosquitto MQTT, Home Bridge, Home Assistant (for evaluation only)
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: light switch not off with SwitchOn().forMIN(2)

Post by dannybloe »

Ah, yeah, you can check for the state or use 'if (device.bState) then'
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: light switch not off with SwitchOn().forMIN(2)

Post by dannybloe »

I'm a bit confused now. Which 'original' code are you referring to? The one on '04 Jan 2018, 17:34'?

You description of how checkFirst() is correct. It's just a check against the current state indeed.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
User avatar
rbisschops
Posts: 63
Joined: Monday 12 May 2014 11:20
Target OS: Raspberry Pi / ODroid
Domoticz version: 2.2563
Location: Schiedam, Netherlands
Contact:

Re: light switch not off with SwitchOn().forMIN(2)

Post by rbisschops »

I understand your confusion. I was refering to the code i posted yesterday (17:34) the one you kindly corrected. The puzzling part for me is that the command is still send despite the checkfist() after the switchOn(). Afterall, as the switch is on, it should not be send at all imho.
RPi 3B (master): RFXtrx433, Harmony Hub, Z-Wave devices, CoCo units, Hue, Xiaomi Aquara
RPi 2B (slave): P1 connection, MySensors with custom built watermeter sensors on Aquadis+
RPi’s with: Mosquitto MQTT, Home Bridge, Home Assistant (for evaluation only)
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: light switch not off with SwitchOn().forMIN(2)

Post by dannybloe »

I suppose you mean the outdoorlamp.switchOn().checkFirst().forMin(2) inside the nightime check. (that's the only lamp with a switchOn()).
So, have you really confirmed that the on command is indeed sent if the state is on? Have you set dzVents in debug mode and actually confirmed that a switch on command is placed in the commandArray? In debug mode the command array is dumped after each script. If it is sent it should show something like 'Buitenlam voor: On FOR 2 MINUTES'
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
User avatar
rbisschops
Posts: 63
Joined: Monday 12 May 2014 11:20
Target OS: Raspberry Pi / ODroid
Domoticz version: 2.2563
Location: Schiedam, Netherlands
Contact:

Re: light switch not off with SwitchOn().forMIN(2)

Post by rbisschops »

@dannybloe: Maybe a stuppid moment to conclude this, but wasn't checkFirst() also added in 2.3.0. I see this in the log:

Code: Select all

2018-01-06 13:54:30.386 Error: dzVents: Error: Presence actions: An error occured when calling event handler presence_V1-0-3
2018-01-06 13:54:30.386 Error: dzVents: Error: Presence actions: .../pi/domoticz/scripts/dzVents/scripts/presence_V1-0-3.lua:35: attempt to call field 'checkFirst' (a nil value)
I checked the DzVents changelog and see that it's noted as a 2.3.0 function ...
RPi 3B (master): RFXtrx433, Harmony Hub, Z-Wave devices, CoCo units, Hue, Xiaomi Aquara
RPi 2B (slave): P1 connection, MySensors with custom built watermeter sensors on Aquadis+
RPi’s with: Mosquitto MQTT, Home Bridge, Home Assistant (for evaluation only)
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: light switch not off with SwitchOn().forMIN(2)

Post by dannybloe »

Ah. Indeed. I lose track actually.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest