Reverse on/off operation on Hyperion light switch - automation/script

Hi all,

Im fairly new to HA and have been playing with it over the last couple of weeks - i cant seem to put it down!

Basically, i have hyperion ambient lighting behind my TV which has a hdmi grabber and grabs the TV content. It is ALWAYS on. This causes my tv lights to go blue when i turn my set top box off. The set top box must have a blue default colour.

Using the hyperion component in Home Assistant, I got around this behavior by changing the default ‘on’ colour to black. So now, i can actually turn my lights off completely by switching the lights ‘on’ using the switch in HA, or by telling Alexa to " turn my tv lights on". It is most annoying.

This was an improvement but now, id like to reverse the behaviour, so when i switch the lights off in HA, they actually turn the lights on, but set them to black.

I have tried several approaches using scripts and automation, the closest one i have can be found below, where i use a zee light to test automation triggers to set my lounge to a different colour, just to check my automation is doing something.

My amazon echo controls most of my lounge using the emulated hue component, so eventually id like to group all my devices in the Alexa app, and say, ‘Turn my lounge off’ which would then trigger the automation to actually switch my lights on, but set them to the default colour to black.

`automation reverse off:
alias: Reverse off operation
trigger:
platform: state
from: ‘off’
to: ‘on’
entity_id: light.raspberrypi
action:
service: light.turn_on
entity_id:
- light.raspberrypi
data:
brightness: 150
rgb_color: [255, 0, 0]

automation reverse on:
alias: Reverse on operation blue
trigger:
platform: state
from: ‘on’
to: ‘off’
entity_id: light.raspberrypi
action:
service: light.turn_on
entity_id:
- light.raspberrypi
- light.living_room_lamp
data:
brightness: 150
rgb_color: [116, 209, 234]`

I know im not far off, any advice would be appreciated.

Thanks

I understand what you meant. I sorted it out by setting a command line switch, which basically acts as hyperion remote. Command off for me sets the lights to black (so they are off), command on clears all channels so basically turns them back to work as ambilight.

In my case command_on:
echo '{ "command": "clearall"}' | nc 192.168.0.11 19444

And command_off:
echo '{ "color": [0,0,0], "command": "color", "priority": 0 }' | nc 192.168.0.11 19444

Of course use your own local IP of Hyperion.

I actually solved this by simply calling the hyperion off script using a switch in the end.

I need help with this, as I understand it the Hyperion add-on today is much better now than before. But all I want to do is automate “clear all” (HDMI-effect) So i can easily toggle my ambilight on and off.

Let’s see your code?
Surely you can just turn it off using

  • service:
    light.turn_off
  • entity_id:
    light.hyperion
    I’m an automation?

This works, however “clear all” means that it clears the current effect, meaning that my HDMI-ambilight starts using the HDMI input as effect source. So just using “on” and “off” works for the lights but not for the HDMI mode.(just turning on makes the LEDs white) I spent a good part of my saturday setting my pi up so i could ssh from hassio to lightberry without password to send the command. So the problem is solved for me atleast.

Command line switch?

echo '{ "command": "clearall"}' | nc 192.168.0.13 19444
echo '{ "color": [0,0,0], "command": "color", "priority": 0 }' | nc 192.168.0.13 19444

Cant do that, i use ssh password on my lightberry.

You may be able to adapt this… I use it to automatically select the grabber when i turn the tv lights on…

automation hdmi effect:
  alias: HDMI - Hyperion
  hide_entity: True
  trigger:
    platform: state
    entity_id: light.tv_lights
    to: 'on'
  action:
    - service: light.turn_on
      data:
        entity_id: light.tv_lights
        effect: HDMI
2 Likes

Well shit.

Thanks dude. gonna use that instead.

Ha ha no problem bro. I think this post was one of my first!

Much learning has happened since!

1 Like

Nice one, in addition you can use:

Set hyperion effect after playback -----------
  • alias: Set hyperion effect after playback
    initial_state: ‘on’
    trigger:
    • platform: state
      entity_id: media_player.plex_iiidefcontoweriii
      to: ‘off’
    • platform: state
      entity_id: media_player.plex_iiidefcontoweriii
      to: ‘paused’
    • platform: state
      entity_id: media_player.plex_iiidefcontoweriii
      to: ‘idle’
      action:
    • service: light.turn_on
      data:
      entity_id: light.hyperion
      effect: “Full color mood blobs”