Home-Assistant-DreamScreen-Service icon indicating copy to clipboard operation
Home-Assistant-DreamScreen-Service copied to clipboard

HDR Tone Remapping control?

Open Mibix opened this issue 4 years ago • 8 comments

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.

Mibix avatar Dec 05 '20 05:12 Mibix

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

zanix avatar Apr 16 '21 22:04 zanix

Thank you so much I will try later

Mibix avatar Apr 17 '21 14:04 Mibix

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.

zanix avatar Apr 18 '21 23:04 zanix

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?

Mibix avatar Apr 20 '21 14:04 Mibix

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

zanix avatar Apr 20 '21 15:04 zanix

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!

Mibix avatar Apr 20 '21 16:04 Mibix

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.

zanix avatar Apr 20 '21 17:04 zanix

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.

Mibix avatar Apr 20 '21 17:04 Mibix