def _reset_for_demo(): life = _get_life_object() life.do_something('door-lock', 'lock', 'unlocked') life.do_something('contact-sensor', 'arm-state', 'disarmed') life.do_something('thermostat', 'cool-setpoint', str(ATTDigitalLife.f_to_weird_units(72))) life.do_something('thermostat', 'fan-mode', 'auto') life.do_something('thermostat', 'thermostat-mode', 'off') life.do_something('thermostat', 'cool-setpoint', str(ATTDigitalLife.f_to_weird_units(72))) life.do_something('thermostat', 'heat-setpoint', str(ATTDigitalLife.f_to_weird_units(72)))
def set_temperature_intent(request): temperature = request['intent']['slots']['temperature']['value'] output_speech = 'Setting the thermostat to {} degrees'.format(temperature) output_type = 'PlainText' response = {'outputSpeech': {'type': output_type, 'text': output_speech}, 'shouldEndSession': True} # Do the things life = _get_life_object() life.do_something('thermostat', 'cool-setpoint', str(ATTDigitalLife.f_to_weird_units(int(temperature)))) life.do_something('thermostat', 'heat-setpoint', str(ATTDigitalLife.f_to_weird_units(int(temperature)))) life.do_something('thermostat', 'fan-mode', 'on-high') return response
def set_temperature_intent(request): temperature = request['intent']['slots']['temperature']['value'] output_speech = 'Setting the thermostat to {} degrees'.format(temperature) output_type = 'PlainText' response = { 'outputSpeech': { 'type': output_type, 'text': output_speech }, 'shouldEndSession': True } # Do the things life = _get_life_object() life.do_something('thermostat', 'cool-setpoint', str(ATTDigitalLife.f_to_weird_units(int(temperature)))) life.do_something('thermostat', 'heat-setpoint', str(ATTDigitalLife.f_to_weird_units(int(temperature)))) life.do_something('thermostat', 'fan-mode', 'on-high') return response
def bed_time_intent(request): output_speech = 'I am locking the door, and setting the temperature to 65 degrees. Have a good night!' output_type = 'PlainText' response = {'outputSpeech': {'type': output_type, 'text': output_speech}, 'shouldEndSession': True} # Do the things life = _get_life_object() life.do_something('door-lock', 'lock', 'lock') life.do_something('contact-sensor', 'arm-state', 'armed') life.do_something('thermostat', 'cool-setpoint', str(ATTDigitalLife.f_to_weird_units(65))) life.do_something('thermostat', 'fan-mode', 'on-high') life.do_something('thermostat', 'thermostat-mode', 'cool') return response
def bed_time_intent(request): output_speech = 'I am locking the door, and setting the temperature to 65 degrees. Have a good night!' output_type = 'PlainText' response = { 'outputSpeech': { 'type': output_type, 'text': output_speech }, 'shouldEndSession': True } # Do the things life = _get_life_object() life.do_something('door-lock', 'lock', 'lock') life.do_something('contact-sensor', 'arm-state', 'armed') life.do_something('thermostat', 'cool-setpoint', str(ATTDigitalLife.f_to_weird_units(65))) life.do_something('thermostat', 'fan-mode', 'on-high') life.do_something('thermostat', 'thermostat-mode', 'cool') return response
def _get_life_object(): life = ATTDigitalLife(config['user_id'], config['password'], config['app_key']) life.authenticate() return life