Page 1 of 1

dzVents - action delay doesn't seem to work for kodi commands

Posted: Thursday 02 March 2017 17:34
by jake
Is it possible that the '.after_sec(20) is not supported for all actions?

This code runs fine

Code: Select all

kodidevice.devices.kodiPlay()
but this code doesn't

Code: Select all

kodidevice.devices.kodiPlay().after_sec(5)
and gives the following error in the log

Code: Select all

 2017-03-01 21:36:53.353 LUA: Handling events for: "Kodi Woonkamer - Status", value: "Audio"
2017-03-01 21:36:53.353 LUA: =====================================================
2017-03-01 21:36:53.354 LUA: >>> Handler: kodi
2017-03-01 21:36:53.354 LUA: >>> Device: "Kodi Woonkamer - Status" Index: 146
2017-03-01 21:36:53.354 LUA: .....................................................
2017-03-01 21:37:01.891 LUA: An error occured when calling event handler kodi
2017-03-01 21:37:01.891 LUA: /home/pi/domoticz/scripts/lua/scripts/kodi.lua:25: attempt to index field 'devices' (a nil value)
2017-03-01 21:37:01.892 LUA: .....................................................
2017-03-01 21:37:01.892 LUA: <<< Done
2017-03-01 21:37:01.893 LUA: -----------------------------------------------------
2017-03-01 21:37:01.893 LUA: ===================================================== 

Re: dzVents - action delay doesn't seem to work for kodi commands

Posted: Friday 03 March 2017 12:22
by dannybloe
Ah, this is weird. kodidevice.devices should not work at all. If kodidevice is a 'device' then that object doesn't have a devices attribute. I'd remove the .devices part. Can you try that?

Re: dzVents - action delay doesn't seem to work for kodi commands

Posted: Friday 03 March 2017 19:33
by jake
dannybloe wrote:Ah, this is weird. kodidevice.devices should not work at all. If kodidevice is a 'device' then that object doesn't have a devices attribute. I'd remove the .devices part. Can you try that?
Sorry for the confusion, I actually forgot to take the 'device' out of the code, after I did some other trials (I thought that maybe the IF statement wasn't valid anymore, therefore the kodidevice variable was not available. But, never mind).
The error log is for the code without 'device':

Code: Select all

--kodidevice.kodiPlay().after_sec(5)
My script should do the following:

Detect that Kodi device plays Audio or Video
Put kodi player on pause when receiver is still 'off'
send 'on' signal to receiver
wait 5 seconds and put kodi in play again

For testing purposes I tried to to trigger on kodidevice.state == 'Paused' and there put the code for 5 seconds delay to start playing, but that makes no difference

Re: dzVents - action delay doesn't seem to work for kodi commands

Posted: Friday 10 March 2017 22:05
by jake
I did 2 more tests:
1: calling a function with a .after_sec(x) delay, but no success: an error in the log
2: Lightswitch with switchOn().after_sec(5) which worked as expected with a delay of 5 seconds.

Re: dzVents - action delay doesn't seem to work for kodi commands

Posted: Saturday 11 March 2017 13:43
by dannybloe
Maybe it's a Domoticz issue. dzVents just sends standard Domoticz commands.