J3n50m4t / Home-Assistant-DreamScreen-Service

Home Assistant Service for sending commands to a Wifi enabled DreamScreen
MIT License
31 stars 15 forks source link

HDR Tone Remapping control? #40

Open Mibix opened 3 years ago

Mibix commented 3 years ago

I guess this is more of a question/feature request but is there a way to turn on and off the HDR Tone Remapping from Kodi? Can't figure out how to do it if it is possible.

zanix commented 3 years ago

Use the dreamscreen.set_hdr_tone_remapping service

image

Or here is a script example

script:
  dreamscreen_hdr_off:
    alias: "DreamScreen - Turn off HDR Tone Mapping"
    sequence:
      - service: dreamscreen.set_hdr_tone_remapping
        data:
          entity_id: dreamscreen.living_room
          hdr_tone_remapping: 0
  dreamscreen_hdr_on:
    alias: "DreamScreen - Turn on HDR Tone Mapping"
    sequence:
      - service: dreamscreen.set_hdr_tone_remapping
        data:
          entity_id: dreamscreen.living_room
          hdr_tone_remapping: 1
Mibix commented 3 years ago

Thank you so much I will try later

zanix commented 3 years ago

I just noticed you asked if it can be toggled in Kodi. This integration is for Home Assistant but the underlying python is a more generic library (https://github.com/J3n50m4t/pydreamscreen) If you have the Kodi component in Home Assistant, I think you can add an automation trigger when Kodi is playing and then use the service call to toggle the hdr mode.

Mibix commented 3 years ago

hmm I am getting this error:

Logger: homeassistant.components.script.dreamscreen_down_hdr_off
Source: helpers/script.py:1324
Integration: Script (documentation, issues)
First occurred: 10:35:41 AM (12 occurrences)
Last logged: 10:36:24 AM

Dreamscreen Down HDR Off: Error executing script. Invalid data for call_service at pos 1: extra keys not allowed @ data['remapping']

Here is the entry in my scripts.yaml file:

dreamscreen_down_hdr_off:
  alias: "Dreamscreen Down HDR Off"
  sequence:
    - service: dreamscreen.set_hdr_tone_remapping
      data:
        entity_id: dreamscreen.dreamscreen_4k_d
        remapping: `0`

Not sure what I am doing wrong here, any ideas?

zanix commented 3 years ago

Looks like "remapping" is not the right attribute. I just looked at the code and it seems it should be "hdr_tone_remapping"

Mibix commented 3 years ago

hdr_tone_remapping

That fixed it, thanks! I don't think I can get it to work on Kodi since I would need the Kodi HA plugin to know when HDR content is being played to function right and switch it. This is still way better than the Dreamscreen app I can just create a tasker shortcut on my phone or hit it from the HA website. Thanks for adding this!

zanix commented 3 years ago

I just took a quick look at the Kodi API and I don't see an obvious way to get if the current video is HDR Maybe this? https://kodi.wiki/view/JSON-RPC_API/v12#Player.GetItem Which contains these fields: https://kodi.wiki/view/JSON-RPC_API/v12#List.Fields.All I don't see a specific color mode in there though...

Alternatively, if the title of the currently playing video has something like [HDR] in the title of the video you might be able to use that.

Mibix commented 3 years ago

Kodi doesn't even natively support all HDR right now so most people have to use an external player like madvr and integrate it, maybe in the future.