Skip to content

Commit

Permalink
fix: #173 call homeassistant.turn_on for groups
Browse files Browse the repository at this point in the history
  • Loading branch information
danobot authored Sep 1, 2020
1 parent 67ec478 commit afab88f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions custom_components/entity_controller/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1096,7 +1096,7 @@ def config_other(self, config):
self.log.debug("Config other")

self.do_draw = config.get("draw", False)

self.homeassistant_turn_on_domains = ['group'] # domains that do not have their own turn_on service and rely on homeassistant.turn_on
# if CONF_TRIGGER_ON_DEACTIVATE in config:
# self.entityOff = config.get(CONF_TRIGGER_ON_DEACTIVATE)
# if CONF_TRIGGER_ON_ACTIVATE in config:
Expand Down Expand Up @@ -1472,8 +1472,12 @@ def prepare_service_data(self):

def call_service(self, entity, service, **kwargs):
""" Helper for calling HA services with the correct parameters """
self.log.debug("Calling service " + entity + " " + service)
self.log.debug("Calling service " + service + " on " + entity)
domain, e = entity.split(".")
if e == 'turn_on' and domain in homeassistant_turn_on_domains:
domain = "homeassistant"
service = "homeassistant.turn_on"
self.log.debug("Actualy calling service " + service + " on " + entity + " because the domain requires it.")
params = {}
if kwargs is not None:
params = kwargs
Expand Down

0 comments on commit afab88f

Please sign in to comment.