Page 1 of 1

forSec option does not work any more on blind devices

Posted: Tuesday 31 March 2020 19:36
by dlube
Hi All
All is inside the subject. ;)
I managed to open my garage door during 3 sec with the previous stable version of dzVents.
dz.devices("Garage door").switchOff().forSec(3)

With the latest version 3.0.1 I can use open() instead of switchOff but forSec has no effect.
dz.devices("Garage door").open().forSec(3)

Is there another way to open my garage door for 3 seconds?

Re: forSec option does not work any more on blind devices

Posted: Tuesday 31 March 2020 21:31
by waaren
dlube wrote: Tuesday 31 March 2020 19:36 I managed to open my garage door during 3 sec with the previous stable version of dzVents.
dz.devices("Garage door").switchOff().forSec(3)
Is there another way to open my garage door for 3 seconds?
Does the old command

Code: Select all

dz.devices("Garage door").switchOff().forSec(3)
still work ?

My preference is to use this sequence of commands.

Code: Select all

garageDoor = dz.devices("Garage door")
garageDoor.cancelQueuedCommands()
garageDoor.open()
garageDoor.stop().afterSec(3)  -- or garageDoor.close().afterSec(3) -- if that's what you want.

Re: forSec option does not work any more on blind devices

Posted: Tuesday 31 March 2020 22:47
by dlube
Old code does not work any more.
The door opens and stop when the door is fully opened (20sec after) :D
I will try yours tomorow.
Thank you

Re: forSec option does not work any more on blind devices

Posted: Wednesday 01 April 2020 18:58
by dlube
Does not work too :(
I think that this is a regression introduced with the update of the action on blind devices.

Here is the log file

Code: Select all

2020-04-01 19:20:21.553  (ENOCEAN PI) Lighting 2 (Cde1 Bouton 3)
2020-04-01 19:20:21.636  Status: dzVents: Debug: Dumping domoticz data to /home/pi/domoticz/scripts/dzVents/domoticzData.lua
2020-04-01 19:20:21.691  Status: dzVents: Debug: Processing device-adapter for Cde1 Bouton 3: Switch device adapter
2020-04-01 19:20:21.691  Status: dzVents: Debug: dzVents version: 3.0.1
2020-04-01 19:20:21.691  Status: dzVents: Debug: Event triggers:
2020-04-01 19:20:21.691  Status: dzVents: Debug: - Device: Cde1 Bouton 3
2020-04-01 19:20:21.738  Status: dzVents: Info: Handling events for: "Cde1 Bouton 3", value: "On"
2020-04-01 19:20:21.738  Status: dzVents: Info: Télécommande Garage: ------ Start internal script: Telecommande: Device: "Cde1 Bouton 3 (ENOCEAN PI)", Index: 232
2020-04-01 19:20:21.743  Status: dzVents: Info: Télécommande Garage: ------ Finished Telecommande
2020-04-01 19:20:21.744  Status: dzVents: Debug: Commands sent to Domoticz: 
2020-04-01 19:20:21.744  Status: dzVents: Debug: - Cancel = {["idx"]=203, ["type"]="device"}
2020-04-01 19:20:21.744  Status: dzVents: Debug: - Garage = Off
2020-04-01 19:20:21.744  Status: dzVents: Debug: - Garage = Stop AFTER 3 SECONDS

Re: forSec option does not work any more on blind devices

Posted: Friday 03 April 2020 19:33
by dlube
I found a workaround

Code: Select all

door.open()
door.stop().at(os.date("%H:%M:%S",os.time()+3))
How to report it to the developement team?

Re: forSec option does not work any more on blind devices

Posted: Friday 03 April 2020 21:47
by waaren
dlube wrote: Friday 03 April 2020 19:33 How to report it to the development team?
Good that you got it working !
I am co-developer of dzVents and the creator of the .at() method in dzVents. What it does is computing the amount of seconds from now and use that computed value in an afterSec() method. So you can imagine why I am surprised that the

Code: Select all

.at(os.date("%H:%M:%S",os.time()+3)) method -- 3 seconds from now
works and the

Code: Select all

.afterSec(3) -- 3 seconds from now
does not.

I am very much interested in the log output of both methods. If there is something unexpected I might be able to fix it.

Re: forSec option does not work any more on blind devices

Posted: Saturday 04 April 2020 11:31
by dlube
Sorry, was my mistake :(
I did a lot of modifications for my tests and the type of the device was not the same.

"Blind inverted" device
The code below is working well:

Code: Select all

myDevice.open()
myDevice.stop().afterSec(3)

Code: Select all

myDevice.switchOn()
myDevice.stop().afterSec(3)
The code below is not working:

Code: Select all

myDevice.open().forSec(3)

Code: Select all

myDevice.switchOn().forSec(3)

"Blind" device
None of the code below is working:

Code: Select all

myDevice.open().forSec(3)

Code: Select all

myDevice.open()
myDevice.stop().afterSec(3)

Code: Select all

myDevice.switchOff().forSec(3)

Code: Select all

myDevice.switchOff()
myDevice.stop().afterSec(3)
Hope it help :)

Re: forSec option does not work any more on blind devices

Posted: Monday 06 April 2020 15:43
by waaren
dlube wrote: Saturday 04 April 2020 11:31 I did a lot of modifications for my tests and the type of the device was not the same.
Checked this on all recent Beta's but cannot replicate this. The forSec() is ignored for open() or close() as there is no way dzVents can know what to do when the delay is over. This has been the way it worked from the moment forSec() became available in dzVents.
All other methods work as designed.

Re: forSec option does not work any more on blind devices  [SOLVED]

Posted: Monday 06 April 2020 18:52
by dlube
It was working with switchOff().forSec(3) previously.
The problem raized after the update.

For me, open().forSec(x) mean that you would like to open the door during x seconds and stop.
This is usefull with a door which do not accept percentage.
A good way to introduce it should be to create something like this myBlind.open().stopIn(3)

My solution is the following:

I create a switch and manage the state of this switch.

Code: Select all

     if mySwitch.state == 'On' then
          door.open()
     else
          door.stop()
     end
and the command to open the door for 3 s

Code: Select all

	mySwitch.switchOn().forSec(3)
Not very clean but it works.
Thank you for your support.