Problem with Dzvents timers

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

Moderator: leecollings

Post Reply
Giel
Posts: 5
Joined: Wednesday 06 September 2017 23:10
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Problem with Dzvents timers

Post by Giel »

Hello all,

I am fairly new to Domoticz and very enthusiastic about all the possibilities it offers. Dzvents looks to be a very clear framework for programming the hardware but I have some issues that you may have encountered as well.

- in Dzvents I have to use ( instead of [ to get devices to work: e.g.

domoticz.devices(51).switchOn() works ok but domoticz.devices[51].switchOn() does not and

domoticz.devices(51).switchOn().for_min(2) does not work completely - the device switchs on but never switches off.

Any ideas ???

Thanks and regards,
Giel
elmortero
Posts: 247
Joined: Sunday 29 November 2015 20:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.9639
Location: Spain
Contact:

Re: Problem with Dzvents timers

Post by elmortero »

Hi Giel,

This is normal behavior. You are using the old syntax in both examples given.
All you need to know is available in this WIKI
Giel
Posts: 5
Joined: Wednesday 06 September 2017 23:10
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Problem with Dzvents timers

Post by Giel »

Hoi easy can it be..... Thanks Elmortero
Giel
Posts: 5
Joined: Wednesday 06 September 2017 23:10
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Problem with Dzvents timers

Post by Giel »

Still no luck with the forMin() method...

In the script = domoticz.devices(100).switchOn().forMin(2)

On the device:
10:02:17 MQTT: tele/sonoff/STATE = {"Time":"2017-09-07T10:02:17", "Uptime":1, "Vcc":3.179, "POWER":"ON", etc
10:07:18 MQTT: tele/sonoff/STATE = {"Time":"2017-09-07T10:07:18", "Uptime":1, "Vcc":3.182, "POWER":"ON", etc
10:12:20 MQTT: tele/sonoff/STATE = {"Time":"2017-09-07T10:12:20", "Uptime":1, "Vcc":3.177, "POWER":"ON", "

What am I doing wrong ?
BakSeeDaa
Posts: 485
Joined: Thursday 17 September 2015 10:13
Target OS: Raspberry Pi / ODroid
Domoticz version:

Re: Problem with Dzvents timers

Post by BakSeeDaa »

The command

Code: Select all

domoticz.devices(100).switchOn().forMin(2)
looks correct now so you'd have to do some debugging.

What if you create a new virtual switch device for to test with.

Does that work? Have a look in the Domoticz log.

If it's working, I'd say that the problem is most likely isn't related to dzVents.

Is device 100 a device that can be switched on/off? Please make a device listing and let us know.

Code: Select all

http://DOMOIP:8080/json.htm?type=devices&rid=100
Giel
Posts: 5
Joined: Wednesday 06 September 2017 23:10
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Problem with Dzvents timers

Post by Giel »

Hello BakSeeDaa,

Will try with a virtual switch later today. The device is a Sonoff Wifi switch with Tasmota software. "Your" Json code resulted in the following (looks ok to me...). It does switches on every 5 minutes as expected - it is only the forMin that is causing issues. Will let you know when I have had to try another one.

HardwareName "Dummy"
HardwareType "Dummy (Does nothing, use for virtual switches only)"
HardwareTypeVal 15
HaveDimmer false
HaveGroupCmd true
HaveTimeout false
ID "71"
Image "Light"
IsSubDevice false
LastUpdate "2017-09-08 08:30:02"
Level 0
LevelInt 0
MaxDimLevel 0
Name "Sonoff_60"
Notifications "false"
PlanID "0"
PlanIDs
0 0
Protected false
ShowNotifications true
SignalLevel "-"
Status "On"
StrParam1 ""
StrParam2 ""
SubType "X10"
SwitchType "On/Off"
SwitchTypeVal 0
Timers "true"
Type "Lighting 1"
TypeImg "lightbulb"
Unit 6
Used 1
UsedByCamera false
XOffset "0"
YOffset "0"
idx
BakSeeDaa
Posts: 485
Joined: Thursday 17 September 2015 10:13
Target OS: Raspberry Pi / ODroid
Domoticz version:

Re: Problem with Dzvents timers

Post by BakSeeDaa »

Giel wrote: Friday 08 September 2017 9:24 Hello BakSeeDaa,

Will try with a virtual switch later today.
Great!
Giel
Posts: 5
Joined: Wednesday 06 September 2017 23:10
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Problem with Dzvents timers

Post by Giel »

Hello BakSeedaa,

The virtual switch with the same Dzvents script works perfectly. So Dzvents is not to blame. Perhaps Mosquitto ? Will have to dig deeper.
BakSeeDaa
Posts: 485
Joined: Thursday 17 September 2015 10:13
Target OS: Raspberry Pi / ODroid
Domoticz version:

Re: Problem with Dzvents timers

Post by BakSeeDaa »

Giel wrote: Saturday 09 September 2017 11:01 Hello BakSeedaa,

The virtual switch with the same Dzvents script works perfectly. So Dzvents is not to blame. Perhaps Mosquitto ? Will have to dig deeper.
OK, good luck :D
Quax1507
Posts: 101
Joined: Tuesday 07 April 2015 21:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Problem with Dzvents timers

Post by Quax1507 »

I have a similar problem here.

I have created a virtual device (for testing) which is switched on by an event with:

Code: Select all

domotics.devices(devicename).switchOn().forSec(time)
This is working without problems if the device was off before. If the device was already switched on, it is not turned off after "time".

I need a function which turns off the device, no matter if it was on or off before.

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

Re: Problem with Dzvents timers

Post by waaren »

Does the following code does what you want ?

Code: Select all

domotics.devices(devicename).switchOff().afterSec(time)
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