jake wrote:jake wrote:@Dnpwwo, do you think you will be able to complete the feature request to add another Kodi state (besides on/off/video/audio): something like sleep, by detecting when the screensaver is active?
@Dnpwwo: I did some research if my original request to get a Kodi 'idle' or 'sleep' state in Domotizc. Would it be possible to integrate the OnScreenSaverActivated functionality in your plugin? In this forum someone tries to use OnScreenSaverActivated, but gets into trouble because Kodi dims the screen while playing audio:
https://www.google.nl/url?sa=t&source=w ... l2r-jEMtAQ
UPDATE: I found the plugin for Kodi "Kodi Callbacks" and their I could use an http command to enable/disable a new virtual switch in Domoticz at the Kodi state of 'OnIdle' and 'onResumeAfterIdle'
However, the 'idle' state in Domoticz directly, would be preferred, of course
I figured it out how to get the
http://kodi.wiki/view/Add-on:Kodi_Callbacks working within Kodi:
-Install the add-on via de built in add-on manager in Kodi
-In the configuration of the add-on
-- create a task: http, url = domoticz url:8080/json.htm and as type: GET
-- create an event on the activity 'OnIdle' with 'Task 1' and the custom text the JSON command parameters as described in the
https://www.domoticz.com/wiki/Domoticz_ ... JSON wiki, starting with the ?type=command¶m=switchlight&idx=99&switchcmd=On (idx=99: change to your virtual switch idx that is used to define if Kodi is idle)
--repeat the event 2 but choosing the on ResumeAfterIdle instead and the same task 1
The event delay in seconds starts counting from the first second that Kodi is Idle, not as I expected 'after the screensaver kicks in, but right then when audio or video stops and no UI is used
@Dnpwwo:
I realize that I use the onIdle from within Kodi and use the time delay also from within that add-on. From just the Domoticz side it might be more difficult to create a timer within Domoticz, the idle time variable should be defined in the 'hardware' section of Domoticz, I guess.
Another practical approach could be: combine the OnScreenSaverActivated information with the current 'On' state in the Domoticz plugin. I assume that would also give a reliable 'idle' state, since 'On' is only displayed when no audio/video is playing. The screensaver also only kicks in when there is no UI interaction.