Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- thermostat_id = data.get('thermostat')
- heat_state = data.get('heat_state', 'heat')
- idle_state = data.get('idle_state', 'off')
- idle_heat_temp = data.get('idle_heat_temp', 8)
- if thermostat_id:
- thermostat = hass.states.get(thermostat_id)
- attributes = thermostat.attributes.copy()
- attributes['operation_list'] = '{},{}'.format(heat_state, idle_state)
- if float(attributes['temperature']) > idle_heat_temp:
- state = heat_state
- attributes['operation_mode'] = heat_state
- else:
- state = idle_state
- attributes['operation_mode'] = idle_state
- hass.states.set(thermostat_id, state, attributes)
- else:
- logger.error("Wrong arguments!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement