So i have created an EMBY binding. Right now it is in very early alpha stage and more proof of concept. However, posting here so others can test and contribute as i develop this further.
I am not creating a formal pull request right now as the binding is no where near ready yet. However, i am hosting it on github at
In github you can find a build under the target folder which you can download and add to the addons folder manually. Please feel free to fork, add and create pull requests to my repo and contribute if you desire.
I have modeled the binding heaveily after the kodi binding (so any refrecences to kodi in the code are from that and really should be changed to emby names) as the emby API is able to send json in a similar manner (albeit with different tags and responses). In its current form the binding does not have the ability to control devices and only receives and process updates. However, the framework for control is there i just need to add those hooks in.
Currently configuration is all manual. EMby does broadcast over upnp so a disvoery service could be added in the future for autodiscovery of the emby server. Once the binding is added you need to add a thing and provide it with the following configurations:
api key: created in your emby server dashboard ( Dashboard -> Expert -> Advanced -> Security)
DeviceID: This is the unique ID generated by emby for each device. You enter the ID here for the device you want to monitor for now playing events. THis can either be obtained from the emby server logs or from the openhab logs once the other settings of the thing are configured and the websocket connects for the first time. For both methods you need to start playing a media file and then look for the tag deviceID.
ipaddress: this is the address of your ebmy server
port: the local port (currently the binding does not use ssl)
refresh parameter: this is the time in milliseconds that the emby server will send json updates regarding the now playing sessions. the reccomended is 10000 as this corresponds to the time the emby devices are also required to report status updates. THe server will also send updates between this refresh time when any device has a change in state so updating on 10 second intervals will keep openHAB in line with emby.
Once this is configured the binding will connect to the emby server websocket and reqeust sessions data at the refresh rate specified.
The binding will then analyze the received json and map fields under the configured deviceID for the following channels:
Control: Indicates the playing state - either playing or paused
Stop: This switch gets momentarilly trigger on then off when the media on the device stops
mute: switch on when device is muted off if not muted
showtitle: the title of the currently playing item
imageURL: this will generate a string (with percent played indicator included) to the path of the primary coverart image for the currently now playing item. There are tons of options here that could be grabbed and currently i am only grabbing the primary (for movies) and the season primary(for TV) however i have plans to add config options to this channel to allow the binding to form the primary, box, fanart, etc and make this an extensible channel so that the user could add as many as they wanted.
My current use case for this and the reason i made this binding was so that the habPanel screen which is in our den could have a template that displays the coverart of the currently playing item with percent played while the media was playing and then dissappear when not playing.
And since there was not a binding for EMBY i decided to start one myself. There is still a long way to go here to make this a full binding with control but this is a proof of concept and happy to have others test and help along the way.