Exemplo n.º 1
0
    def _async_call_service(self,
                            service_name,
                            service_data=None,
                            allow_override=False):
        """Call either a specified or active child's service."""
        if service_data is None:
            service_data = {}

        if allow_override and service_name in self._cmds:
            yield from async_call_from_config(self.hass,
                                              self._cmds[service_name],
                                              variables=service_data,
                                              blocking=True)
            return

        active_child = self._child_state
        if active_child is None:
            # No child to call service on
            return

        service_data[ATTR_ENTITY_ID] = active_child.entity_id

        yield from self.hass.services.async_call(DOMAIN,
                                                 service_name,
                                                 service_data,
                                                 blocking=True)
Exemplo n.º 2
0
    def _async_call_service(self, action, variables):
        """Call the service specified in the action.

        This method is a coroutine.
        """
        self.last_action = action.get(CONF_ALIAS, 'call service')
        self._log("Executing step %s" % self.last_action)
        yield from service.async_call_from_config(
            self.hass, action, True, variables, validate_config=False)
Exemplo n.º 3
0
    def _async_call_service(self, action, variables):
        """Call the service specified in the action.

        This method is a coroutine.
        """
        self.last_action = action.get(CONF_ALIAS, 'call service')
        self._log("Executing step %s" % self.last_action)
        yield from service.async_call_from_config(
            self.hass, action, True, variables, validate_config=False)
Exemplo n.º 4
0
    def _async_call_service(self, service_name, service_data=None,
                            allow_override=False):
        """Call either a specified or active child's service."""
        if service_data is None:
            service_data = {}

        if allow_override and service_name in self._cmds:
            yield from async_call_from_config(
                self.hass, self._cmds[service_name],
                variables=service_data, blocking=True)
            return

        active_child = self._child_state
        if active_child is None:
            # No child to call service on
            return

        service_data[ATTR_ENTITY_ID] = active_child.entity_id

        yield from self.hass.services.async_call(
            DOMAIN, service_name, service_data, blocking=True)