Page 1 of 1

Problem with Dzvents timers

Posted: Thursday 07 September 2017 8:58
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

Re: Problem with Dzvents timers

Posted: Thursday 07 September 2017 9:06
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

Re: Problem with Dzvents timers

Posted: Thursday 07 September 2017 9:54
by Giel
Hoi easy can it be..... Thanks Elmortero

Re: Problem with Dzvents timers

Posted: Thursday 07 September 2017 10:15
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 ?

Re: Problem with Dzvents timers

Posted: Thursday 07 September 2017 16:11
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

Re: Problem with Dzvents timers

Posted: Friday 08 September 2017 9:24
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

Re: Problem with Dzvents timers

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

Will try with a virtual switch later today.
Great!

Re: Problem with Dzvents timers

Posted: Saturday 09 September 2017 11:01
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.

Re: Problem with Dzvents timers

Posted: Saturday 09 September 2017 11:17
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

Re: Problem with Dzvents timers

Posted: Wednesday 24 January 2018 18:04
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?

Re: Problem with Dzvents timers

Posted: Wednesday 24 January 2018 23:40
by waaren
Does the following code does what you want ?

Code: Select all

domotics.devices(devicename).switchOff().afterSec(time)