コード例 #1
0
ファイル: echo.py プロジェクト: Lucy246/Mirror-Mirror
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)))
コード例 #2
0
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)))
コード例 #3
0
ファイル: echo.py プロジェクト: Lucy246/Mirror-Mirror
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
コード例 #4
0
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
コード例 #5
0
ファイル: echo.py プロジェクト: Lucy246/Mirror-Mirror
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
コード例 #6
0
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
コード例 #7
0
def _get_life_object():
    life = ATTDigitalLife(config['user_id'], config['password'],
                          config['app_key'])
    life.authenticate()

    return life
コード例 #8
0
ファイル: echo.py プロジェクト: Lucy246/Mirror-Mirror
def _get_life_object():
    life = ATTDigitalLife(config['user_id'], config['password'], config['app_key'])
    life.authenticate()

    return life