Junglejim 354 Posted January 20, 2023 Share Posted January 20, 2023 (edited) On 02/01/2023 at 10:52, seanbuff said: I had a quick play with this, and while it's not part of the default integration. You can still pull that data using a rest sensor in HA that consumes the LibraryService endpoint of your Emby Servers API. The code would look something like this: # Emby Media Counts rest: - resource: http://<Emby IP>:8096/emby/Items/Counts?api_key=<Your_API_Key> method: GET scan_interval: 3600 sensor: - name: "Emby Movie Count" value_template: '{{ value_json ["MovieCount"] }}' - name: "Emby TV Series Count" value_template: '{{ value_json ["SeriesCount"] }}' - name: "Emby TV Episode Count" value_template: '{{ value_json ["EpisodeCount"] }}' - name: "Emby Album Count" value_template: '{{ value_json ["AlbumCount"] }}' - name: "Emby Song Count" value_template: '{{ value_json ["SongCount"] }}' Once you have the individual sensors, the output in the UI would be: I currently have mine polling Emby every hour, so I imagine after some amount of time I'll have enough data to populate a graph to visualize this over a longer time-frame. (just as an example) Hi @seanbuff, thanks for the sensors code. My TV Shows/Episodes numbers are spot on, Movies are +9 but I think that's due to the Top-Picks plugin (I can live with that).. My question is what card/code are you using to display the sensor info? I'd like to add this to my Emby dashboard. Still a noob with this at the mo but I can't seem to get the card like this. Edit: Got it sorted with some digging around in the add cards section. Thanks for the sensors code! I like to have a go with Home Assistant every few weeks, there is so much to learn with this app and the possibilities are endless. Edited January 20, 2023 by Junglejim 1 Link to comment Share on other sites More sharing options...
Junglejim 354 Posted January 21, 2023 Share Posted January 21, 2023 Ok this is me done for a couple of weeks. Got my Emby dash to a nice level.. Could not get the template code working for active users but that's for another day (just have a workaround from the overview at the mo). 5 Link to comment Share on other sites More sharing options...
seanbuff 842 Posted January 21, 2023 Share Posted January 21, 2023 5 minutes ago, Junglejim said: Got my Emby dash to a nice level.. Looks good mate, well done. 1 Link to comment Share on other sites More sharing options...
skank 82 Posted January 29, 2023 Author Share Posted January 29, 2023 On 1/21/2023 at 7:51 AM, Junglejim said: Ok this is me done for a couple of weeks. Got my Emby dash to a nice level.. Could not get the template code working for active users but that's for another day (just have a workaround from the overview at the mo). ok im gonna try this as well + automations to dim lights (got that now) + automation through push notification in HA when media is added (and what media) , anyone have an automation for this yet? 1 Link to comment Share on other sites More sharing options...
Junglejim 354 Posted January 30, 2023 Share Posted January 30, 2023 16 hours ago, skank said: ok im gonna try this as well + automations to dim lights (got that now) + automation through push notification in HA when media is added (and what media) , anyone have an automation for this yet? Yeah mate give it a go, I haven't got to automation's yet but I have my Lifx light's all setup and ready to go. Link to comment Share on other sites More sharing options...
skank 82 Posted February 1, 2023 Author Share Posted February 1, 2023 On 1/1/2023 at 10:45 PM, Spaceboy said: ok - nice. spent some time on this and have it all implemented. starting to get the hang of yaml a bit more and using custome components. as i was reading on templates i noticed that apparently you are using the old style format. if you are interested (not sure its needed yet) the new style to get the same as what you have is # Active Emby Users template: - sensor: - name: "emby_users_watching" state: "{{ states.media_player | selectattr ( 'state' , 'eq' , 'playing' ) | rejectattr ( 'entity_id' , 'eq' , 'media_player.living_room_tv' ) | rejectattr ( 'entity_id' , 'eq' , 'media_player.bedroom_speaker_2' ) | rejectattr ( 'entity_id' , 'eq' , 'media_player.unnamed_room' ) | rejectattr ( 'entity_id' , 'eq' , 'media_player.bathroom' ) | rejectattr ( 'entity_id' , 'eq' , 'media_player.bedroom' ) | rejectattr ( 'entity_id' , 'eq' , 'media_player.living_room' ) | rejectattr ( 'entity_id' , 'eq' , 'media_player.sonos_roam' ) | rejectattr ( 'entity_id' , 'eq' , 'media_player.shield' ) | rejectattr ( 'entity_id' , 'eq' , 'media_player.mogo_pro' ) | list | count }}" and my emby page looks like this one odd thing i notice is that when using the mini media player card for the playing devices it doesnt fit properly into the wrapper card. not sure why that is or its not evident from your pics. perhaps the theme you are using doesnt have that problem - i havent looked at themes at all other than to make it dark. i'm also using the emby integration in a couple of automations, nothing different than what has already been described here tbh. i have an automation that checks if the sun has gone down and if so dims my living room lights when i'm playing anything on the living room tv. And toggles adaptive lighting back on when it stops. would also be interested to hear from others on how they are using the emby integration. i'm happy to be "inspired" by other people I'm stuck with your template code, it contains some spaces so i cant copy it. Anyone have correct code? The one i'm using now that aint working is: [code] # Active Emby Users template: - sensor: - name: "emby_users_watching" state: "{{ states.media_player | selectattr('state', 'eq', 'playing' ) | rejectattr('entity_id', 'eq', 'media_player.badkamer' ) | rejectattr('entity_id', 'eq', 'media_player.bureau' ) | rejectattr('entity_id', 'eq', 'media_player.keuken' ) | rejectattr('entity_id', 'eq', 'media_player.woonkamer_mini' ) | rejectattr('entity_id', 'eq', 'media_player.living_tv' ) | list | count }}" [/code] Link to comment Share on other sites More sharing options...
skank 82 Posted February 1, 2023 Author Share Posted February 1, 2023 @seanbuffcan you help with "automation through push notification in HA when media is added (and what media) , anyone have an automation for this yet?" Link to comment Share on other sites More sharing options...
Junglejim 354 Posted February 1, 2023 Share Posted February 1, 2023 14 minutes ago, skank said: I'm stuck with your template code, it contains some spaces so i cant copy it. Anyone have correct code? The one i'm using now that aint working is: [code] # Active Emby Users template: - sensor: - name: "emby_users_watching" state: "{{ states.media_player | selectattr('state', 'eq', 'playing' ) | rejectattr('entity_id', 'eq', 'media_player.badkamer' ) | rejectattr('entity_id', 'eq', 'media_player.bureau' ) | rejectattr('entity_id', 'eq', 'media_player.keuken' ) | rejectattr('entity_id', 'eq', 'media_player.woonkamer_mini' ) | rejectattr('entity_id', 'eq', 'media_player.living_tv' ) | list | count }}" [/code] Yea I tried to copy & paste that code but it always threw a syntax error. Will give it another go at some point. I haven't touched automation's yet but plan to in the future, still get a bit to read up on as far as that's concerned. Link to comment Share on other sites More sharing options...
Spaceboy 2500 Posted February 1, 2023 Share Posted February 1, 2023 19 minutes ago, skank said: I'm stuck with your template code, it contains some spaces so i cant copy it. Anyone have correct code? The one i'm using now that aint working is: [code] # Active Emby Users template: - sensor: - name: "emby_users_watching" state: "{{ states.media_player | selectattr('state', 'eq', 'playing' ) | rejectattr('entity_id', 'eq', 'media_player.badkamer' ) | rejectattr('entity_id', 'eq', 'media_player.bureau' ) | rejectattr('entity_id', 'eq', 'media_player.keuken' ) | rejectattr('entity_id', 'eq', 'media_player.woonkamer_mini' ) | rejectattr('entity_id', 'eq', 'media_player.living_tv' ) | list | count }}" [/code] where are you entering this? you know it needs to go in your config.yaml? then you refer to the template in the lovelace card Link to comment Share on other sites More sharing options...
Spaceboy 2500 Posted February 1, 2023 Share Posted February 1, 2023 20 minutes ago, skank said: @seanbuffcan you help with "automation through push notification in HA when media is added (and what media) , anyone have an automation for this yet?" so are you trying to get a notification come up on your phone from HA? i have some other notifications that alert my iphone on certain events Link to comment Share on other sites More sharing options...
skank 82 Posted February 1, 2023 Author Share Posted February 1, 2023 6 minutes ago, Spaceboy said: where are you entering this? you know it needs to go in your config.yaml? then you refer to the template in the lovelace card I've split up my config into packages normally it starts with sensor: - platform: .... Link to comment Share on other sites More sharing options...
skank 82 Posted February 1, 2023 Author Share Posted February 1, 2023 15 minutes ago, Spaceboy said: so are you trying to get a notification come up on your phone from HA? i have some other notifications that alert my iphone on certain events Yes But then with what is added from emby I already use notifications from HA for other stuff too (android) Link to comment Share on other sites More sharing options...
Spaceboy 2500 Posted February 1, 2023 Share Posted February 1, 2023 1 hour ago, skank said: I've split up my config into packages normally it starts with sensor: - platform: .... attach your config.yaml as a text file with personal information obfuscated 1 hour ago, skank said: Yes But then with what is added from emby I already use notifications from HA for other stuff too (android) ok, so you need to set up a webhook in emby for new media added and have that be the trigger for the automation in HA (you already know how to configure the event for the trigger) Link to comment Share on other sites More sharing options...
seanbuff 842 Posted February 2, 2023 Share Posted February 2, 2023 15 hours ago, skank said: @seanbuffcan you help with "automation through push notification in HA when media is added (and what media) , anyone have an automation for this yet?" I spent a bit of time on this and unfortunately wasn't happy with the end result. I'm encountering the same issue described here with Webhooks, in that they are being passed as form-data and not as a proper JSON response. Meaning, I can get the notification to pop and show the raw data, but i'm not able to pull out specific data like "Title" easily like I would be able to with JSON. So I gave up. If @Luke ever gets around to adding an option to send Webhooks with a content-header of application/json then i'll revisit this. Link to comment Share on other sites More sharing options...
skank 82 Posted February 2, 2023 Author Share Posted February 2, 2023 On 2/1/2023 at 12:08 PM, Spaceboy said: attach your config.yaml as a text file with personal information obfuscated ok, so you need to set up a webhook in emby for new media added and have that be the trigger for the automation in HA (you already know how to configure the event for the trigger) The sensor is working now, now the automation Link to comment Share on other sites More sharing options...
skank 82 Posted February 2, 2023 Author Share Posted February 2, 2023 10 hours ago, seanbuff said: I spent a bit of time on this and unfortunately wasn't happy with the end result. I'm encountering the same issue described here with Webhooks, in that they are being passed as form-data and not as a proper JSON response. Meaning, I can get the notification to pop and show the raw data, but i'm not able to pull out specific data like "Title" easily like I would be able to with JSON. So I gave up. If @Luke ever gets around to adding an option to send Webhooks with a content-header of application/json then i'll revisit this. Hey Thx for replying Pity it aint working as expected. Yes the title should be in the message/notification. What did u get working then with the raw data? Link to comment Share on other sites More sharing options...
skank 82 Posted February 2, 2023 Author Share Posted February 2, 2023 (edited) I now know again, why i stopped using it. FYI i use emby server on my unraid machine (not 24/24 on) , i use HA on raspberry pi 24/24 on (but not able to host the emby server) When i shut down my server, all info about emby on HA is gone.. https://i.ibb.co/t8KhR4Z/app.jpg Could there be developed something, so that all the data/info is on the HA side? Would love to see that... Edited February 2, 2023 by skank Link to comment Share on other sites More sharing options...
coreyjohnson75 1 Posted February 2, 2023 Share Posted February 2, 2023 what do you mean it is gone? Like HA forgets what you configured? Or you lose the history? Link to comment Share on other sites More sharing options...
skank 82 Posted February 2, 2023 Author Share Posted February 2, 2023 4 hours ago, coreyjohnson75 said: what do you mean it is gone? Like HA forgets what you configured? Or you lose the history? Just look at the picture i posted... its empty No it doesnt lose configuration cause when i turn on my server it auto-populates again Link to comment Share on other sites More sharing options...
Spaceboy 2500 Posted February 2, 2023 Share Posted February 2, 2023 1 hour ago, skank said: Just look at the picture i posted... its empty No it doesnt lose configuration cause when i turn on my server it auto-populates again try this? https://community.home-assistant.io/t/sensor-display-last-known-value-instead-of-unavailable/200081/2 1 Link to comment Share on other sites More sharing options...
skank 82 Posted February 2, 2023 Author Share Posted February 2, 2023 2 minutes ago, Spaceboy said: try this? https://community.home-assistant.io/t/sensor-display-last-known-value-instead-of-unavailable/200081/2 thx i will , and what about latest movies and tvshows with the pictures? Link to comment Share on other sites More sharing options...
Spaceboy 2500 Posted February 2, 2023 Share Posted February 2, 2023 not sure thats possible tbh Link to comment Share on other sites More sharing options...
seanbuff 842 Posted February 3, 2023 Share Posted February 3, 2023 14 hours ago, skank said: When i shut down my server, all info about emby on HA is gone.. But why would you ever shutdown Emby??? 16 hours ago, skank said: Pity it aint working as expected. Yes the title should be in the message/notification. What did u get working then with the raw data? The default minimized notification is okay, but when you expand it - it's not so good. Link to comment Share on other sites More sharing options...
Junglejim 354 Posted February 3, 2023 Share Posted February 3, 2023 8 hours ago, seanbuff said: But why would you ever shutdown Emby??? Yeah I totally agree with that. I run Emby & HA plus many more containers in dockers on my NAS (OMV) which is 24/7. I just stumbled onto a OMV intergration that I'm going to play with.. (graphs etc..) Link to comment Share on other sites More sharing options...
Junglejim 354 Posted February 10, 2023 Share Posted February 10, 2023 Some slow progress, I had a play with my OMV sensors. Just used the basic cards for the moment but it looking ok I guess, needs some more love but that's for another day. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now