2019-03-23 21:05:47 +00:00
|
|
|
"""Support for Hyperion remotes."""
|
2016-02-19 05:27:50 +00:00
|
|
|
import json
|
2015-10-17 17:36:52 +00:00
|
|
|
import logging
|
|
|
|
import socket
|
|
|
|
|
2016-09-11 07:24:25 +00:00
|
|
|
import voluptuous as vol
|
|
|
|
|
|
|
|
from homeassistant.components.light import (
|
2019-07-31 19:25:30 +00:00
|
|
|
ATTR_BRIGHTNESS,
|
|
|
|
ATTR_EFFECT,
|
|
|
|
ATTR_HS_COLOR,
|
|
|
|
PLATFORM_SCHEMA,
|
|
|
|
SUPPORT_BRIGHTNESS,
|
|
|
|
SUPPORT_COLOR,
|
|
|
|
SUPPORT_EFFECT,
|
|
|
|
Light,
|
|
|
|
)
|
2019-03-23 21:05:47 +00:00
|
|
|
from homeassistant.const import CONF_HOST, CONF_NAME, CONF_PORT
|
2016-09-11 07:24:25 +00:00
|
|
|
import homeassistant.helpers.config_validation as cv
|
2018-03-18 22:00:29 +00:00
|
|
|
import homeassistant.util.color as color_util
|
2015-10-17 17:36:52 +00:00
|
|
|
|
|
|
|
_LOGGER = logging.getLogger(__name__)
|
2016-09-11 07:24:25 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
CONF_DEFAULT_COLOR = "default_color"
|
|
|
|
CONF_PRIORITY = "priority"
|
|
|
|
CONF_HDMI_PRIORITY = "hdmi_priority"
|
|
|
|
CONF_EFFECT_LIST = "effect_list"
|
2016-09-11 07:24:25 +00:00
|
|
|
|
|
|
|
DEFAULT_COLOR = [255, 255, 255]
|
2019-07-31 19:25:30 +00:00
|
|
|
DEFAULT_NAME = "Hyperion"
|
2016-09-11 07:24:25 +00:00
|
|
|
DEFAULT_PORT = 19444
|
2017-10-30 20:48:42 +00:00
|
|
|
DEFAULT_PRIORITY = 128
|
Hyperion: Add brightness, HDMI and effect support (#11543)
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
- fixed some style issues with too long lines
* Hyperion: Add brightness, HDMI and effect support
- fixed some more indentation style issues
* Hyperion: Add brightness, HDMI and effect support
- yet more fixed visuel indent issues
* Hyperion: Add brightness, HDMI and effect support
- more visuel indents
* Hyperion: Add brightness, HDMI and effect support
- fixed invalid variable "A"
* Hyperion: Add brightness, HDMI and effect support
- remove unnececary brackets
- specify specific exceptions
* correct changing state holding attributes during a service method
Proccesed the comments of @MartinHjelmare: https://github.com/home-assistant/home-assistant/pull/11543#pullrequestreview-88328659
* indent correction
corrected tab instead of 4 spaces
* Hyperion: Add brightness, HDMI and effect support
- changed 'none' to None
- renamed "self._skip_check" to "self._skip_update"
* Add brightness, HDMI and effect support
changed checking if a list is empty from "list == []" to "not list"
2018-01-13 20:06:34 +00:00
|
|
|
DEFAULT_HDMI_PRIORITY = 880
|
2019-07-31 19:25:30 +00:00
|
|
|
DEFAULT_EFFECT_LIST = [
|
|
|
|
"HDMI",
|
|
|
|
"Cinema brighten lights",
|
|
|
|
"Cinema dim lights",
|
|
|
|
"Knight rider",
|
|
|
|
"Blue mood blobs",
|
|
|
|
"Cold mood blobs",
|
|
|
|
"Full color mood blobs",
|
|
|
|
"Green mood blobs",
|
|
|
|
"Red mood blobs",
|
|
|
|
"Warm mood blobs",
|
|
|
|
"Police Lights Single",
|
|
|
|
"Police Lights Solid",
|
|
|
|
"Rainbow mood",
|
|
|
|
"Rainbow swirl fast",
|
|
|
|
"Rainbow swirl",
|
|
|
|
"Random",
|
|
|
|
"Running dots",
|
|
|
|
"System Shutdown",
|
|
|
|
"Snake",
|
|
|
|
"Sparks Color",
|
|
|
|
"Sparks",
|
|
|
|
"Strobe blue",
|
|
|
|
"Strobe Raspbmc",
|
|
|
|
"Strobe white",
|
|
|
|
"Color traces",
|
|
|
|
"UDP multicast listener",
|
|
|
|
"UDP listener",
|
|
|
|
"X-Mas",
|
|
|
|
]
|
|
|
|
|
|
|
|
SUPPORT_HYPERION = SUPPORT_COLOR | SUPPORT_BRIGHTNESS | SUPPORT_EFFECT
|
|
|
|
|
|
|
|
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
|
|
|
{
|
|
|
|
vol.Required(CONF_HOST): cv.string,
|
|
|
|
vol.Required(CONF_PORT, default=DEFAULT_PORT): cv.port,
|
|
|
|
vol.Optional(CONF_DEFAULT_COLOR, default=DEFAULT_COLOR): vol.All(
|
|
|
|
list,
|
|
|
|
vol.Length(min=3, max=3),
|
|
|
|
[vol.All(vol.Coerce(int), vol.Range(min=0, max=255))],
|
|
|
|
),
|
|
|
|
vol.Optional(CONF_NAME, default=DEFAULT_NAME): cv.string,
|
|
|
|
vol.Optional(CONF_PRIORITY, default=DEFAULT_PRIORITY): cv.positive_int,
|
|
|
|
vol.Optional(
|
|
|
|
CONF_HDMI_PRIORITY, default=DEFAULT_HDMI_PRIORITY
|
|
|
|
): cv.positive_int,
|
|
|
|
vol.Optional(CONF_EFFECT_LIST, default=DEFAULT_EFFECT_LIST): vol.All(
|
|
|
|
cv.ensure_list, [cv.string]
|
|
|
|
),
|
|
|
|
}
|
|
|
|
)
|
2015-10-17 17:36:52 +00:00
|
|
|
|
2016-09-11 07:24:25 +00:00
|
|
|
|
2018-08-24 14:37:30 +00:00
|
|
|
def setup_platform(hass, config, add_entities, discovery_info=None):
|
2017-05-01 03:10:08 +00:00
|
|
|
"""Set up a Hyperion server remote."""
|
2019-03-23 21:05:47 +00:00
|
|
|
name = config[CONF_NAME]
|
|
|
|
host = config[CONF_HOST]
|
|
|
|
port = config[CONF_PORT]
|
|
|
|
priority = config[CONF_PRIORITY]
|
|
|
|
hdmi_priority = config[CONF_HDMI_PRIORITY]
|
|
|
|
default_color = config[CONF_DEFAULT_COLOR]
|
|
|
|
effect_list = config[CONF_EFFECT_LIST]
|
2016-09-11 07:24:25 +00:00
|
|
|
|
2019-03-23 21:05:47 +00:00
|
|
|
device = Hyperion(
|
2019-07-31 19:25:30 +00:00
|
|
|
name, host, port, priority, default_color, hdmi_priority, effect_list
|
|
|
|
)
|
2016-09-11 07:24:25 +00:00
|
|
|
|
2015-10-20 15:30:23 +00:00
|
|
|
if device.setup():
|
2018-08-24 14:37:30 +00:00
|
|
|
add_entities([device])
|
2015-10-17 17:36:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Hyperion(Light):
|
2016-03-07 21:08:21 +00:00
|
|
|
"""Representation of a Hyperion remote."""
|
2015-10-17 17:36:52 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
def __init__(
|
|
|
|
self, name, host, port, priority, default_color, hdmi_priority, effect_list
|
|
|
|
):
|
2016-03-07 21:08:21 +00:00
|
|
|
"""Initialize the light."""
|
2015-10-17 17:36:52 +00:00
|
|
|
self._host = host
|
|
|
|
self._port = port
|
2016-04-19 15:19:27 +00:00
|
|
|
self._name = name
|
2017-10-30 20:48:42 +00:00
|
|
|
self._priority = priority
|
Hyperion: Add brightness, HDMI and effect support (#11543)
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
- fixed some style issues with too long lines
* Hyperion: Add brightness, HDMI and effect support
- fixed some more indentation style issues
* Hyperion: Add brightness, HDMI and effect support
- yet more fixed visuel indent issues
* Hyperion: Add brightness, HDMI and effect support
- more visuel indents
* Hyperion: Add brightness, HDMI and effect support
- fixed invalid variable "A"
* Hyperion: Add brightness, HDMI and effect support
- remove unnececary brackets
- specify specific exceptions
* correct changing state holding attributes during a service method
Proccesed the comments of @MartinHjelmare: https://github.com/home-assistant/home-assistant/pull/11543#pullrequestreview-88328659
* indent correction
corrected tab instead of 4 spaces
* Hyperion: Add brightness, HDMI and effect support
- changed 'none' to None
- renamed "self._skip_check" to "self._skip_update"
* Add brightness, HDMI and effect support
changed checking if a list is empty from "list == []" to "not list"
2018-01-13 20:06:34 +00:00
|
|
|
self._hdmi_priority = hdmi_priority
|
2016-07-28 04:11:12 +00:00
|
|
|
self._default_color = default_color
|
|
|
|
self._rgb_color = [0, 0, 0]
|
Hyperion: Add brightness, HDMI and effect support (#11543)
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
- fixed some style issues with too long lines
* Hyperion: Add brightness, HDMI and effect support
- fixed some more indentation style issues
* Hyperion: Add brightness, HDMI and effect support
- yet more fixed visuel indent issues
* Hyperion: Add brightness, HDMI and effect support
- more visuel indents
* Hyperion: Add brightness, HDMI and effect support
- fixed invalid variable "A"
* Hyperion: Add brightness, HDMI and effect support
- remove unnececary brackets
- specify specific exceptions
* correct changing state holding attributes during a service method
Proccesed the comments of @MartinHjelmare: https://github.com/home-assistant/home-assistant/pull/11543#pullrequestreview-88328659
* indent correction
corrected tab instead of 4 spaces
* Hyperion: Add brightness, HDMI and effect support
- changed 'none' to None
- renamed "self._skip_check" to "self._skip_update"
* Add brightness, HDMI and effect support
changed checking if a list is empty from "list == []" to "not list"
2018-01-13 20:06:34 +00:00
|
|
|
self._rgb_mem = [0, 0, 0]
|
|
|
|
self._brightness = 255
|
2019-07-31 19:25:30 +00:00
|
|
|
self._icon = "mdi:lightbulb"
|
Hyperion: Add brightness, HDMI and effect support (#11543)
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
- fixed some style issues with too long lines
* Hyperion: Add brightness, HDMI and effect support
- fixed some more indentation style issues
* Hyperion: Add brightness, HDMI and effect support
- yet more fixed visuel indent issues
* Hyperion: Add brightness, HDMI and effect support
- more visuel indents
* Hyperion: Add brightness, HDMI and effect support
- fixed invalid variable "A"
* Hyperion: Add brightness, HDMI and effect support
- remove unnececary brackets
- specify specific exceptions
* correct changing state holding attributes during a service method
Proccesed the comments of @MartinHjelmare: https://github.com/home-assistant/home-assistant/pull/11543#pullrequestreview-88328659
* indent correction
corrected tab instead of 4 spaces
* Hyperion: Add brightness, HDMI and effect support
- changed 'none' to None
- renamed "self._skip_check" to "self._skip_update"
* Add brightness, HDMI and effect support
changed checking if a list is empty from "list == []" to "not list"
2018-01-13 20:06:34 +00:00
|
|
|
self._effect_list = effect_list
|
|
|
|
self._effect = None
|
|
|
|
self._skip_update = False
|
2015-10-17 17:36:52 +00:00
|
|
|
|
|
|
|
@property
|
|
|
|
def name(self):
|
2017-07-09 22:06:31 +00:00
|
|
|
"""Return the name of the light."""
|
2015-10-17 17:36:52 +00:00
|
|
|
return self._name
|
|
|
|
|
Hyperion: Add brightness, HDMI and effect support (#11543)
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
- fixed some style issues with too long lines
* Hyperion: Add brightness, HDMI and effect support
- fixed some more indentation style issues
* Hyperion: Add brightness, HDMI and effect support
- yet more fixed visuel indent issues
* Hyperion: Add brightness, HDMI and effect support
- more visuel indents
* Hyperion: Add brightness, HDMI and effect support
- fixed invalid variable "A"
* Hyperion: Add brightness, HDMI and effect support
- remove unnececary brackets
- specify specific exceptions
* correct changing state holding attributes during a service method
Proccesed the comments of @MartinHjelmare: https://github.com/home-assistant/home-assistant/pull/11543#pullrequestreview-88328659
* indent correction
corrected tab instead of 4 spaces
* Hyperion: Add brightness, HDMI and effect support
- changed 'none' to None
- renamed "self._skip_check" to "self._skip_update"
* Add brightness, HDMI and effect support
changed checking if a list is empty from "list == []" to "not list"
2018-01-13 20:06:34 +00:00
|
|
|
@property
|
|
|
|
def brightness(self):
|
|
|
|
"""Return the brightness of this light between 0..255."""
|
|
|
|
return self._brightness
|
|
|
|
|
2015-10-17 17:36:52 +00:00
|
|
|
@property
|
2018-03-18 22:00:29 +00:00
|
|
|
def hs_color(self):
|
|
|
|
"""Return last color value set."""
|
|
|
|
return color_util.color_RGB_to_hs(*self._rgb_color)
|
2015-10-17 17:36:52 +00:00
|
|
|
|
|
|
|
@property
|
|
|
|
def is_on(self):
|
2016-07-28 04:11:12 +00:00
|
|
|
"""Return true if not black."""
|
|
|
|
return self._rgb_color != [0, 0, 0]
|
2015-10-17 17:36:52 +00:00
|
|
|
|
Hyperion: Add brightness, HDMI and effect support (#11543)
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
- fixed some style issues with too long lines
* Hyperion: Add brightness, HDMI and effect support
- fixed some more indentation style issues
* Hyperion: Add brightness, HDMI and effect support
- yet more fixed visuel indent issues
* Hyperion: Add brightness, HDMI and effect support
- more visuel indents
* Hyperion: Add brightness, HDMI and effect support
- fixed invalid variable "A"
* Hyperion: Add brightness, HDMI and effect support
- remove unnececary brackets
- specify specific exceptions
* correct changing state holding attributes during a service method
Proccesed the comments of @MartinHjelmare: https://github.com/home-assistant/home-assistant/pull/11543#pullrequestreview-88328659
* indent correction
corrected tab instead of 4 spaces
* Hyperion: Add brightness, HDMI and effect support
- changed 'none' to None
- renamed "self._skip_check" to "self._skip_update"
* Add brightness, HDMI and effect support
changed checking if a list is empty from "list == []" to "not list"
2018-01-13 20:06:34 +00:00
|
|
|
@property
|
|
|
|
def icon(self):
|
|
|
|
"""Return state specific icon."""
|
|
|
|
return self._icon
|
|
|
|
|
|
|
|
@property
|
|
|
|
def effect(self):
|
|
|
|
"""Return the current effect."""
|
|
|
|
return self._effect
|
|
|
|
|
|
|
|
@property
|
|
|
|
def effect_list(self):
|
|
|
|
"""Return the list of supported effects."""
|
|
|
|
return self._effect_list
|
|
|
|
|
2016-08-16 06:07:07 +00:00
|
|
|
@property
|
|
|
|
def supported_features(self):
|
|
|
|
"""Flag supported features."""
|
|
|
|
return SUPPORT_HYPERION
|
|
|
|
|
2015-10-17 17:36:52 +00:00
|
|
|
def turn_on(self, **kwargs):
|
2016-03-07 21:08:21 +00:00
|
|
|
"""Turn the lights on."""
|
2018-03-18 22:00:29 +00:00
|
|
|
if ATTR_HS_COLOR in kwargs:
|
|
|
|
rgb_color = color_util.color_hs_to_RGB(*kwargs[ATTR_HS_COLOR])
|
Hyperion: Add brightness, HDMI and effect support (#11543)
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
- fixed some style issues with too long lines
* Hyperion: Add brightness, HDMI and effect support
- fixed some more indentation style issues
* Hyperion: Add brightness, HDMI and effect support
- yet more fixed visuel indent issues
* Hyperion: Add brightness, HDMI and effect support
- more visuel indents
* Hyperion: Add brightness, HDMI and effect support
- fixed invalid variable "A"
* Hyperion: Add brightness, HDMI and effect support
- remove unnececary brackets
- specify specific exceptions
* correct changing state holding attributes during a service method
Proccesed the comments of @MartinHjelmare: https://github.com/home-assistant/home-assistant/pull/11543#pullrequestreview-88328659
* indent correction
corrected tab instead of 4 spaces
* Hyperion: Add brightness, HDMI and effect support
- changed 'none' to None
- renamed "self._skip_check" to "self._skip_update"
* Add brightness, HDMI and effect support
changed checking if a list is empty from "list == []" to "not list"
2018-01-13 20:06:34 +00:00
|
|
|
elif self._rgb_mem == [0, 0, 0]:
|
|
|
|
rgb_color = self._default_color
|
2016-07-28 04:11:12 +00:00
|
|
|
else:
|
Hyperion: Add brightness, HDMI and effect support (#11543)
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
- fixed some style issues with too long lines
* Hyperion: Add brightness, HDMI and effect support
- fixed some more indentation style issues
* Hyperion: Add brightness, HDMI and effect support
- yet more fixed visuel indent issues
* Hyperion: Add brightness, HDMI and effect support
- more visuel indents
* Hyperion: Add brightness, HDMI and effect support
- fixed invalid variable "A"
* Hyperion: Add brightness, HDMI and effect support
- remove unnececary brackets
- specify specific exceptions
* correct changing state holding attributes during a service method
Proccesed the comments of @MartinHjelmare: https://github.com/home-assistant/home-assistant/pull/11543#pullrequestreview-88328659
* indent correction
corrected tab instead of 4 spaces
* Hyperion: Add brightness, HDMI and effect support
- changed 'none' to None
- renamed "self._skip_check" to "self._skip_update"
* Add brightness, HDMI and effect support
changed checking if a list is empty from "list == []" to "not list"
2018-01-13 20:06:34 +00:00
|
|
|
rgb_color = self._rgb_mem
|
|
|
|
|
2018-07-18 09:54:27 +00:00
|
|
|
brightness = kwargs.get(ATTR_BRIGHTNESS, self._brightness)
|
Hyperion: Add brightness, HDMI and effect support (#11543)
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
- fixed some style issues with too long lines
* Hyperion: Add brightness, HDMI and effect support
- fixed some more indentation style issues
* Hyperion: Add brightness, HDMI and effect support
- yet more fixed visuel indent issues
* Hyperion: Add brightness, HDMI and effect support
- more visuel indents
* Hyperion: Add brightness, HDMI and effect support
- fixed invalid variable "A"
* Hyperion: Add brightness, HDMI and effect support
- remove unnececary brackets
- specify specific exceptions
* correct changing state holding attributes during a service method
Proccesed the comments of @MartinHjelmare: https://github.com/home-assistant/home-assistant/pull/11543#pullrequestreview-88328659
* indent correction
corrected tab instead of 4 spaces
* Hyperion: Add brightness, HDMI and effect support
- changed 'none' to None
- renamed "self._skip_check" to "self._skip_update"
* Add brightness, HDMI and effect support
changed checking if a list is empty from "list == []" to "not list"
2018-01-13 20:06:34 +00:00
|
|
|
|
|
|
|
if ATTR_EFFECT in kwargs:
|
|
|
|
self._skip_update = True
|
|
|
|
self._effect = kwargs[ATTR_EFFECT]
|
2019-07-31 19:25:30 +00:00
|
|
|
if self._effect == "HDMI":
|
|
|
|
self.json_request({"command": "clearall"})
|
|
|
|
self._icon = "mdi:video-input-hdmi"
|
Hyperion: Add brightness, HDMI and effect support (#11543)
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
- fixed some style issues with too long lines
* Hyperion: Add brightness, HDMI and effect support
- fixed some more indentation style issues
* Hyperion: Add brightness, HDMI and effect support
- yet more fixed visuel indent issues
* Hyperion: Add brightness, HDMI and effect support
- more visuel indents
* Hyperion: Add brightness, HDMI and effect support
- fixed invalid variable "A"
* Hyperion: Add brightness, HDMI and effect support
- remove unnececary brackets
- specify specific exceptions
* correct changing state holding attributes during a service method
Proccesed the comments of @MartinHjelmare: https://github.com/home-assistant/home-assistant/pull/11543#pullrequestreview-88328659
* indent correction
corrected tab instead of 4 spaces
* Hyperion: Add brightness, HDMI and effect support
- changed 'none' to None
- renamed "self._skip_check" to "self._skip_update"
* Add brightness, HDMI and effect support
changed checking if a list is empty from "list == []" to "not list"
2018-01-13 20:06:34 +00:00
|
|
|
self._brightness = 255
|
|
|
|
self._rgb_color = [125, 125, 125]
|
|
|
|
else:
|
2019-07-31 19:25:30 +00:00
|
|
|
self.json_request(
|
|
|
|
{
|
|
|
|
"command": "effect",
|
|
|
|
"priority": self._priority,
|
|
|
|
"effect": {"name": self._effect},
|
|
|
|
}
|
|
|
|
)
|
|
|
|
self._icon = "mdi:lava-lamp"
|
Hyperion: Add brightness, HDMI and effect support (#11543)
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
- fixed some style issues with too long lines
* Hyperion: Add brightness, HDMI and effect support
- fixed some more indentation style issues
* Hyperion: Add brightness, HDMI and effect support
- yet more fixed visuel indent issues
* Hyperion: Add brightness, HDMI and effect support
- more visuel indents
* Hyperion: Add brightness, HDMI and effect support
- fixed invalid variable "A"
* Hyperion: Add brightness, HDMI and effect support
- remove unnececary brackets
- specify specific exceptions
* correct changing state holding attributes during a service method
Proccesed the comments of @MartinHjelmare: https://github.com/home-assistant/home-assistant/pull/11543#pullrequestreview-88328659
* indent correction
corrected tab instead of 4 spaces
* Hyperion: Add brightness, HDMI and effect support
- changed 'none' to None
- renamed "self._skip_check" to "self._skip_update"
* Add brightness, HDMI and effect support
changed checking if a list is empty from "list == []" to "not list"
2018-01-13 20:06:34 +00:00
|
|
|
self._rgb_color = [175, 0, 255]
|
|
|
|
return
|
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
cal_color = [int(round(x * float(brightness) / 255)) for x in rgb_color]
|
|
|
|
self.json_request(
|
|
|
|
{"command": "color", "priority": self._priority, "color": cal_color}
|
|
|
|
)
|
2015-10-17 17:36:52 +00:00
|
|
|
|
|
|
|
def turn_off(self, **kwargs):
|
2016-07-28 04:11:12 +00:00
|
|
|
"""Disconnect all remotes."""
|
2019-07-31 19:25:30 +00:00
|
|
|
self.json_request({"command": "clearall"})
|
|
|
|
self.json_request(
|
|
|
|
{"command": "color", "priority": self._priority, "color": [0, 0, 0]}
|
|
|
|
)
|
2015-10-17 17:36:52 +00:00
|
|
|
|
2015-10-20 15:30:23 +00:00
|
|
|
def update(self):
|
Hyperion: Add brightness, HDMI and effect support (#11543)
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
- fixed some style issues with too long lines
* Hyperion: Add brightness, HDMI and effect support
- fixed some more indentation style issues
* Hyperion: Add brightness, HDMI and effect support
- yet more fixed visuel indent issues
* Hyperion: Add brightness, HDMI and effect support
- more visuel indents
* Hyperion: Add brightness, HDMI and effect support
- fixed invalid variable "A"
* Hyperion: Add brightness, HDMI and effect support
- remove unnececary brackets
- specify specific exceptions
* correct changing state holding attributes during a service method
Proccesed the comments of @MartinHjelmare: https://github.com/home-assistant/home-assistant/pull/11543#pullrequestreview-88328659
* indent correction
corrected tab instead of 4 spaces
* Hyperion: Add brightness, HDMI and effect support
- changed 'none' to None
- renamed "self._skip_check" to "self._skip_update"
* Add brightness, HDMI and effect support
changed checking if a list is empty from "list == []" to "not list"
2018-01-13 20:06:34 +00:00
|
|
|
"""Get the lights status."""
|
|
|
|
# postpone the immediate state check for changes that take time
|
|
|
|
if self._skip_update:
|
|
|
|
self._skip_update = False
|
|
|
|
return
|
2019-07-31 19:25:30 +00:00
|
|
|
response = self.json_request({"command": "serverinfo"})
|
2016-07-28 04:11:12 +00:00
|
|
|
if response:
|
2016-08-09 15:46:47 +00:00
|
|
|
# workaround for outdated Hyperion
|
2019-07-31 19:25:30 +00:00
|
|
|
if "activeLedColor" not in response["info"]:
|
2016-08-09 15:46:47 +00:00
|
|
|
self._rgb_color = self._default_color
|
Hyperion: Add brightness, HDMI and effect support (#11543)
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
- fixed some style issues with too long lines
* Hyperion: Add brightness, HDMI and effect support
- fixed some more indentation style issues
* Hyperion: Add brightness, HDMI and effect support
- yet more fixed visuel indent issues
* Hyperion: Add brightness, HDMI and effect support
- more visuel indents
* Hyperion: Add brightness, HDMI and effect support
- fixed invalid variable "A"
* Hyperion: Add brightness, HDMI and effect support
- remove unnececary brackets
- specify specific exceptions
* correct changing state holding attributes during a service method
Proccesed the comments of @MartinHjelmare: https://github.com/home-assistant/home-assistant/pull/11543#pullrequestreview-88328659
* indent correction
corrected tab instead of 4 spaces
* Hyperion: Add brightness, HDMI and effect support
- changed 'none' to None
- renamed "self._skip_check" to "self._skip_update"
* Add brightness, HDMI and effect support
changed checking if a list is empty from "list == []" to "not list"
2018-01-13 20:06:34 +00:00
|
|
|
self._rgb_mem = self._default_color
|
|
|
|
self._brightness = 255
|
2019-07-31 19:25:30 +00:00
|
|
|
self._icon = "mdi:lightbulb"
|
Hyperion: Add brightness, HDMI and effect support (#11543)
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
- fixed some style issues with too long lines
* Hyperion: Add brightness, HDMI and effect support
- fixed some more indentation style issues
* Hyperion: Add brightness, HDMI and effect support
- yet more fixed visuel indent issues
* Hyperion: Add brightness, HDMI and effect support
- more visuel indents
* Hyperion: Add brightness, HDMI and effect support
- fixed invalid variable "A"
* Hyperion: Add brightness, HDMI and effect support
- remove unnececary brackets
- specify specific exceptions
* correct changing state holding attributes during a service method
Proccesed the comments of @MartinHjelmare: https://github.com/home-assistant/home-assistant/pull/11543#pullrequestreview-88328659
* indent correction
corrected tab instead of 4 spaces
* Hyperion: Add brightness, HDMI and effect support
- changed 'none' to None
- renamed "self._skip_check" to "self._skip_update"
* Add brightness, HDMI and effect support
changed checking if a list is empty from "list == []" to "not list"
2018-01-13 20:06:34 +00:00
|
|
|
self._effect = None
|
2016-08-09 15:46:47 +00:00
|
|
|
return
|
Hyperion: Add brightness, HDMI and effect support (#11543)
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
- fixed some style issues with too long lines
* Hyperion: Add brightness, HDMI and effect support
- fixed some more indentation style issues
* Hyperion: Add brightness, HDMI and effect support
- yet more fixed visuel indent issues
* Hyperion: Add brightness, HDMI and effect support
- more visuel indents
* Hyperion: Add brightness, HDMI and effect support
- fixed invalid variable "A"
* Hyperion: Add brightness, HDMI and effect support
- remove unnececary brackets
- specify specific exceptions
* correct changing state holding attributes during a service method
Proccesed the comments of @MartinHjelmare: https://github.com/home-assistant/home-assistant/pull/11543#pullrequestreview-88328659
* indent correction
corrected tab instead of 4 spaces
* Hyperion: Add brightness, HDMI and effect support
- changed 'none' to None
- renamed "self._skip_check" to "self._skip_update"
* Add brightness, HDMI and effect support
changed checking if a list is empty from "list == []" to "not list"
2018-01-13 20:06:34 +00:00
|
|
|
# Check if Hyperion is in ambilight mode trough an HDMI grabber
|
|
|
|
try:
|
2019-07-31 19:25:30 +00:00
|
|
|
active_priority = response["info"]["priorities"][0]["priority"]
|
Hyperion: Add brightness, HDMI and effect support (#11543)
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
- fixed some style issues with too long lines
* Hyperion: Add brightness, HDMI and effect support
- fixed some more indentation style issues
* Hyperion: Add brightness, HDMI and effect support
- yet more fixed visuel indent issues
* Hyperion: Add brightness, HDMI and effect support
- more visuel indents
* Hyperion: Add brightness, HDMI and effect support
- fixed invalid variable "A"
* Hyperion: Add brightness, HDMI and effect support
- remove unnececary brackets
- specify specific exceptions
* correct changing state holding attributes during a service method
Proccesed the comments of @MartinHjelmare: https://github.com/home-assistant/home-assistant/pull/11543#pullrequestreview-88328659
* indent correction
corrected tab instead of 4 spaces
* Hyperion: Add brightness, HDMI and effect support
- changed 'none' to None
- renamed "self._skip_check" to "self._skip_update"
* Add brightness, HDMI and effect support
changed checking if a list is empty from "list == []" to "not list"
2018-01-13 20:06:34 +00:00
|
|
|
if active_priority == self._hdmi_priority:
|
|
|
|
self._brightness = 255
|
|
|
|
self._rgb_color = [125, 125, 125]
|
2019-07-31 19:25:30 +00:00
|
|
|
self._icon = "mdi:video-input-hdmi"
|
|
|
|
self._effect = "HDMI"
|
Hyperion: Add brightness, HDMI and effect support (#11543)
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
- fixed some style issues with too long lines
* Hyperion: Add brightness, HDMI and effect support
- fixed some more indentation style issues
* Hyperion: Add brightness, HDMI and effect support
- yet more fixed visuel indent issues
* Hyperion: Add brightness, HDMI and effect support
- more visuel indents
* Hyperion: Add brightness, HDMI and effect support
- fixed invalid variable "A"
* Hyperion: Add brightness, HDMI and effect support
- remove unnececary brackets
- specify specific exceptions
* correct changing state holding attributes during a service method
Proccesed the comments of @MartinHjelmare: https://github.com/home-assistant/home-assistant/pull/11543#pullrequestreview-88328659
* indent correction
corrected tab instead of 4 spaces
* Hyperion: Add brightness, HDMI and effect support
- changed 'none' to None
- renamed "self._skip_check" to "self._skip_update"
* Add brightness, HDMI and effect support
changed checking if a list is empty from "list == []" to "not list"
2018-01-13 20:06:34 +00:00
|
|
|
return
|
|
|
|
except (KeyError, IndexError):
|
|
|
|
pass
|
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
led_color = response["info"]["activeLedColor"]
|
|
|
|
if not led_color or led_color[0]["RGB Value"] == [0, 0, 0]:
|
Hyperion: Add brightness, HDMI and effect support (#11543)
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
- fixed some style issues with too long lines
* Hyperion: Add brightness, HDMI and effect support
- fixed some more indentation style issues
* Hyperion: Add brightness, HDMI and effect support
- yet more fixed visuel indent issues
* Hyperion: Add brightness, HDMI and effect support
- more visuel indents
* Hyperion: Add brightness, HDMI and effect support
- fixed invalid variable "A"
* Hyperion: Add brightness, HDMI and effect support
- remove unnececary brackets
- specify specific exceptions
* correct changing state holding attributes during a service method
Proccesed the comments of @MartinHjelmare: https://github.com/home-assistant/home-assistant/pull/11543#pullrequestreview-88328659
* indent correction
corrected tab instead of 4 spaces
* Hyperion: Add brightness, HDMI and effect support
- changed 'none' to None
- renamed "self._skip_check" to "self._skip_update"
* Add brightness, HDMI and effect support
changed checking if a list is empty from "list == []" to "not list"
2018-01-13 20:06:34 +00:00
|
|
|
# Get the active effect
|
2019-07-31 19:25:30 +00:00
|
|
|
if response["info"].get("activeEffects"):
|
Hyperion: Add brightness, HDMI and effect support (#11543)
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
- fixed some style issues with too long lines
* Hyperion: Add brightness, HDMI and effect support
- fixed some more indentation style issues
* Hyperion: Add brightness, HDMI and effect support
- yet more fixed visuel indent issues
* Hyperion: Add brightness, HDMI and effect support
- more visuel indents
* Hyperion: Add brightness, HDMI and effect support
- fixed invalid variable "A"
* Hyperion: Add brightness, HDMI and effect support
- remove unnececary brackets
- specify specific exceptions
* correct changing state holding attributes during a service method
Proccesed the comments of @MartinHjelmare: https://github.com/home-assistant/home-assistant/pull/11543#pullrequestreview-88328659
* indent correction
corrected tab instead of 4 spaces
* Hyperion: Add brightness, HDMI and effect support
- changed 'none' to None
- renamed "self._skip_check" to "self._skip_update"
* Add brightness, HDMI and effect support
changed checking if a list is empty from "list == []" to "not list"
2018-01-13 20:06:34 +00:00
|
|
|
self._rgb_color = [175, 0, 255]
|
2019-07-31 19:25:30 +00:00
|
|
|
self._icon = "mdi:lava-lamp"
|
Hyperion: Add brightness, HDMI and effect support (#11543)
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
- fixed some style issues with too long lines
* Hyperion: Add brightness, HDMI and effect support
- fixed some more indentation style issues
* Hyperion: Add brightness, HDMI and effect support
- yet more fixed visuel indent issues
* Hyperion: Add brightness, HDMI and effect support
- more visuel indents
* Hyperion: Add brightness, HDMI and effect support
- fixed invalid variable "A"
* Hyperion: Add brightness, HDMI and effect support
- remove unnececary brackets
- specify specific exceptions
* correct changing state holding attributes during a service method
Proccesed the comments of @MartinHjelmare: https://github.com/home-assistant/home-assistant/pull/11543#pullrequestreview-88328659
* indent correction
corrected tab instead of 4 spaces
* Hyperion: Add brightness, HDMI and effect support
- changed 'none' to None
- renamed "self._skip_check" to "self._skip_update"
* Add brightness, HDMI and effect support
changed checking if a list is empty from "list == []" to "not list"
2018-01-13 20:06:34 +00:00
|
|
|
try:
|
2019-07-31 19:25:30 +00:00
|
|
|
s_name = response["info"]["activeEffects"][0]["script"]
|
|
|
|
s_name = s_name.split("/")[-1][:-3].split("-")[0]
|
|
|
|
self._effect = [
|
|
|
|
x for x in self._effect_list if s_name.lower() in x.lower()
|
|
|
|
][0]
|
Hyperion: Add brightness, HDMI and effect support (#11543)
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
- fixed some style issues with too long lines
* Hyperion: Add brightness, HDMI and effect support
- fixed some more indentation style issues
* Hyperion: Add brightness, HDMI and effect support
- yet more fixed visuel indent issues
* Hyperion: Add brightness, HDMI and effect support
- more visuel indents
* Hyperion: Add brightness, HDMI and effect support
- fixed invalid variable "A"
* Hyperion: Add brightness, HDMI and effect support
- remove unnececary brackets
- specify specific exceptions
* correct changing state holding attributes during a service method
Proccesed the comments of @MartinHjelmare: https://github.com/home-assistant/home-assistant/pull/11543#pullrequestreview-88328659
* indent correction
corrected tab instead of 4 spaces
* Hyperion: Add brightness, HDMI and effect support
- changed 'none' to None
- renamed "self._skip_check" to "self._skip_update"
* Add brightness, HDMI and effect support
changed checking if a list is empty from "list == []" to "not list"
2018-01-13 20:06:34 +00:00
|
|
|
except (KeyError, IndexError):
|
|
|
|
self._effect = None
|
|
|
|
# Bulb off state
|
|
|
|
else:
|
|
|
|
self._rgb_color = [0, 0, 0]
|
2019-07-31 19:25:30 +00:00
|
|
|
self._icon = "mdi:lightbulb"
|
Hyperion: Add brightness, HDMI and effect support (#11543)
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
- fixed some style issues with too long lines
* Hyperion: Add brightness, HDMI and effect support
- fixed some more indentation style issues
* Hyperion: Add brightness, HDMI and effect support
- yet more fixed visuel indent issues
* Hyperion: Add brightness, HDMI and effect support
- more visuel indents
* Hyperion: Add brightness, HDMI and effect support
- fixed invalid variable "A"
* Hyperion: Add brightness, HDMI and effect support
- remove unnececary brackets
- specify specific exceptions
* correct changing state holding attributes during a service method
Proccesed the comments of @MartinHjelmare: https://github.com/home-assistant/home-assistant/pull/11543#pullrequestreview-88328659
* indent correction
corrected tab instead of 4 spaces
* Hyperion: Add brightness, HDMI and effect support
- changed 'none' to None
- renamed "self._skip_check" to "self._skip_update"
* Add brightness, HDMI and effect support
changed checking if a list is empty from "list == []" to "not list"
2018-01-13 20:06:34 +00:00
|
|
|
self._effect = None
|
2016-07-28 04:11:12 +00:00
|
|
|
else:
|
Hyperion: Add brightness, HDMI and effect support (#11543)
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
- fixed some style issues with too long lines
* Hyperion: Add brightness, HDMI and effect support
- fixed some more indentation style issues
* Hyperion: Add brightness, HDMI and effect support
- yet more fixed visuel indent issues
* Hyperion: Add brightness, HDMI and effect support
- more visuel indents
* Hyperion: Add brightness, HDMI and effect support
- fixed invalid variable "A"
* Hyperion: Add brightness, HDMI and effect support
- remove unnececary brackets
- specify specific exceptions
* correct changing state holding attributes during a service method
Proccesed the comments of @MartinHjelmare: https://github.com/home-assistant/home-assistant/pull/11543#pullrequestreview-88328659
* indent correction
corrected tab instead of 4 spaces
* Hyperion: Add brightness, HDMI and effect support
- changed 'none' to None
- renamed "self._skip_check" to "self._skip_update"
* Add brightness, HDMI and effect support
changed checking if a list is empty from "list == []" to "not list"
2018-01-13 20:06:34 +00:00
|
|
|
# Get the RGB color
|
2019-07-31 19:25:30 +00:00
|
|
|
self._rgb_color = led_color[0]["RGB Value"]
|
Hyperion: Add brightness, HDMI and effect support (#11543)
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
- fixed some style issues with too long lines
* Hyperion: Add brightness, HDMI and effect support
- fixed some more indentation style issues
* Hyperion: Add brightness, HDMI and effect support
- yet more fixed visuel indent issues
* Hyperion: Add brightness, HDMI and effect support
- more visuel indents
* Hyperion: Add brightness, HDMI and effect support
- fixed invalid variable "A"
* Hyperion: Add brightness, HDMI and effect support
- remove unnececary brackets
- specify specific exceptions
* correct changing state holding attributes during a service method
Proccesed the comments of @MartinHjelmare: https://github.com/home-assistant/home-assistant/pull/11543#pullrequestreview-88328659
* indent correction
corrected tab instead of 4 spaces
* Hyperion: Add brightness, HDMI and effect support
- changed 'none' to None
- renamed "self._skip_check" to "self._skip_update"
* Add brightness, HDMI and effect support
changed checking if a list is empty from "list == []" to "not list"
2018-01-13 20:06:34 +00:00
|
|
|
self._brightness = max(self._rgb_color)
|
2019-07-31 19:25:30 +00:00
|
|
|
self._rgb_mem = [
|
|
|
|
int(round(float(x) * 255 / self._brightness))
|
|
|
|
for x in self._rgb_color
|
|
|
|
]
|
|
|
|
self._icon = "mdi:lightbulb"
|
Hyperion: Add brightness, HDMI and effect support (#11543)
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
* Hyperion: Add brightness, HDMI and effect support
- added brightness support to dim the hyperion light
- changed the "OFF" command to set the color to [0,0,0] after clearing all priorities.
This is neccesary to keep the light turned off when an HDMI grabber is used for ambilight with hyperion.
- added HDMI ambilight mode recognition and control.
by setting the "hdmi_priority" in your "configuration.yaml" file (defaults to 880), home assistant will now be able to recognize when the hyperion light is in HDMI ambilight mode and will change its icon to an HDMI symbol and set the status to ON.
Switching the hyperion light to HDMI ambilight mode can be done through the effect option (clears all priorities such that the HDMI grabber remains).
- added effect support for the default effects of hyperion, a custom list can be defined in the "configuration.yaml" file by using the "effect_list" option.
- fixed some style issues with too long lines
* Hyperion: Add brightness, HDMI and effect support
- fixed some more indentation style issues
* Hyperion: Add brightness, HDMI and effect support
- yet more fixed visuel indent issues
* Hyperion: Add brightness, HDMI and effect support
- more visuel indents
* Hyperion: Add brightness, HDMI and effect support
- fixed invalid variable "A"
* Hyperion: Add brightness, HDMI and effect support
- remove unnececary brackets
- specify specific exceptions
* correct changing state holding attributes during a service method
Proccesed the comments of @MartinHjelmare: https://github.com/home-assistant/home-assistant/pull/11543#pullrequestreview-88328659
* indent correction
corrected tab instead of 4 spaces
* Hyperion: Add brightness, HDMI and effect support
- changed 'none' to None
- renamed "self._skip_check" to "self._skip_update"
* Add brightness, HDMI and effect support
changed checking if a list is empty from "list == []" to "not list"
2018-01-13 20:06:34 +00:00
|
|
|
self._effect = None
|
2015-10-20 15:30:23 +00:00
|
|
|
|
|
|
|
def setup(self):
|
2016-03-07 21:08:21 +00:00
|
|
|
"""Get the hostname of the remote."""
|
2019-07-31 19:25:30 +00:00
|
|
|
response = self.json_request({"command": "serverinfo"})
|
2015-10-17 17:36:52 +00:00
|
|
|
if response:
|
2017-07-09 22:06:31 +00:00
|
|
|
if self._name == self._host:
|
2019-07-31 19:25:30 +00:00
|
|
|
self._name = response["info"]["hostname"]
|
2015-10-20 15:30:23 +00:00
|
|
|
return True
|
|
|
|
return False
|
2015-10-17 17:36:52 +00:00
|
|
|
|
2016-07-28 04:11:12 +00:00
|
|
|
def json_request(self, request, wait_for_response=False):
|
2016-03-07 21:08:21 +00:00
|
|
|
"""Communicate with the JSON server."""
|
2015-10-20 15:30:23 +00:00
|
|
|
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
|
|
sock.settimeout(5)
|
|
|
|
|
2015-10-17 17:36:52 +00:00
|
|
|
try:
|
|
|
|
sock.connect((self._host, self._port))
|
|
|
|
except OSError:
|
2015-10-25 10:08:59 +00:00
|
|
|
sock.close()
|
2015-10-20 15:30:23 +00:00
|
|
|
return False
|
2015-10-17 17:36:52 +00:00
|
|
|
|
2019-07-31 19:25:30 +00:00
|
|
|
sock.send(bytearray(json.dumps(request) + "\n", "utf-8"))
|
2015-10-17 17:36:52 +00:00
|
|
|
try:
|
|
|
|
buf = sock.recv(4096)
|
|
|
|
except socket.timeout:
|
2016-03-07 21:08:21 +00:00
|
|
|
# Something is wrong, assume it's offline
|
2015-10-25 10:08:59 +00:00
|
|
|
sock.close()
|
2015-10-20 15:30:23 +00:00
|
|
|
return False
|
2015-10-17 17:36:52 +00:00
|
|
|
|
2016-03-07 21:08:21 +00:00
|
|
|
# Read until a newline or timeout
|
2015-10-17 17:36:52 +00:00
|
|
|
buffering = True
|
|
|
|
while buffering:
|
2019-07-31 19:25:30 +00:00
|
|
|
if "\n" in str(buf, "utf-8"):
|
|
|
|
response = str(buf, "utf-8").split("\n")[0]
|
2015-10-17 17:36:52 +00:00
|
|
|
buffering = False
|
|
|
|
else:
|
|
|
|
try:
|
|
|
|
more = sock.recv(4096)
|
|
|
|
except socket.timeout:
|
|
|
|
more = None
|
|
|
|
if not more:
|
|
|
|
buffering = False
|
2019-07-31 19:25:30 +00:00
|
|
|
response = str(buf, "utf-8")
|
2015-10-17 17:36:52 +00:00
|
|
|
else:
|
|
|
|
buf += more
|
|
|
|
|
|
|
|
sock.close()
|
2015-10-20 15:30:23 +00:00
|
|
|
return json.loads(response)
|