def workday(self): weekday = '' vacation = '' if datetime.date.weekday(today) < 5: weekday = "on" else: weekday = "off" if hass.get_state("input_boolean.vacation_mode") == "on": vacation = "on" else: vacation = "off" if weekday == "on" and vacation == "off": return True
def set_setpoint(self, hass, setpoint, force=False): # Thermostat force overrides global force (if any) _force = self.force if self.force is not None else force curval = hass.get_state(entity=self.name, attribute="temperature") offsetted_sp = setpoint + self.offset range_sp = min(max(MIN_TEMP, int(offsetted_sp + 0.5)), MAX_TEMP) # Min, Max + Rounding if _force or not math.isclose(float(curval), float(range_sp)): hass.log( "Calling climate/set_temperature for '{self.name}' with setpoint " "'{range_sp}' (offset='{self.offset}')".format(**locals())) hass.call_service("climate/set_temperature", entity_id=self.name, temperature=range_sp)
def espresso_on(self, entity, attribute, old, new, kwargs): url = self.args['autoremote_url'] + '' + self.args[ "entityID"] + '=:=' + hass.get_state( self.args["entityID"].brightness) requests.get(url)
def current(self, hass): val = hass.get_state(entity=self.entity) return str(val).lower() in ['on', 'true', 'home']