Im wanting to sue some of the API in various rules
e.g - if the Player.OnStart returns something positive, then trigger my movie scene
if the Player.OnStop or OnResume triggers positive, then trigger another scene
Whilst I’m OK with the rules, how would I be able to obtain these values from the API? Do I need the JSONPath , MAP and HTTP bindings?
Could someone perhaps give me one example I could use to trigger a switch to on as an example?
Thanks, this doesnt have everything i require. I want to determine if the unit is on/off and also retrieve Player.Start and Player.stop to trigger automation scenes. this appears to be more geared around what is playing and controling actual media - which is still useful of course!
You can trigger a rule when the kodi Thing from the above mentioned binding becomes ONLINE or OFFLINE (see https://www.openhab.org/docs/configuration/rules-dsl.html#thing-based-triggers for some details).
I actually never tried this but can see me Thing being OFFLINE in PaperUI when my receiver is offline, so it should work.
Another solution (which I use) is to determine with the network binding and a pingdevice whether the receiver is online or offline. This works pretty reliable for my use case.
I do this (or something similar??) with the mentioned control channel of the binding. This channel (and thus the linked player item) can be used to control the Kodi instance but also receives state updates if the player state is changed from any other input source (e.g. remote). So I think I didn’t get the point what you want to do that is not possible with the binding.
I had been using the Kodi binding with OSMC installed on an RPi (which distro is also installed on the Vero). It doesn’t matter, because this is just a one-click install distro for Kodi and some enhancements. Why do you want to turn it off? I don’t know how the Vero actually works, but I don’t think that it really turns off the whole device (startup can be slow, however it’s faster like on a Raspbian) so triggering just for the player item if it changes should be enough.
I did really great things with the Kodi binding, because it provides lots of info. For example set the corresponding inputs, turn on the devices which needed based on the mediatype which is playing (through Harmony Hub).
I installed mosquitto on my vero 4k and added a cronjob which publishes some health data (temp, cpu usage, etc.) to my mosquitto broker. You could use something like that as your on/off state (in combination with the expire binding).