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

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

Moderator: leecollings

Post Reply
jake
Posts: 751
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

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

Post 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: ===================================================== 
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

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

Post 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?
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
jake
Posts: 751
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

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

Post 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
jake
Posts: 751
Joined: Saturday 30 May 2015 22:40
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

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

Post 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.
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

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

Post by dannybloe »

Maybe it's a Domoticz issue. dzVents just sends standard Domoticz commands.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest