Esempio n. 1
0
def Setup_Kettler():
    global kettler

    if len(key) != 16:
        log.warning("Bluetooth KEY value is empty or wrong")
        return False

    kettler = RedmondKettler(mac, key)

    #try:
    log.info("Strating first connect")
    kettler.firstConnect()
    return kettler.ready
    #except:
    log.error("Connect to Kettle %s failed" % (mac))
    log.debug("Unexpected error info:" + str(sys.exc_info()[0]))
    return False
Esempio n. 2
0
#from kettle.kettleclass import RedmondKettler
#from kettle.logclass import logclass
from kettle.logclass import log
import sys

#Use main wrapper library
from kettle_wrappers_lib import *

#Private part

#Init Kettler Object
kettler = Setup_Kettler()

if kettler:
    log.info("Kettle setup was successfully completed, can proceed with commands further")
    mainMethodAnswer = False
    
    if kettler.sendStart():
        log.info ("Kettle switched on successfully")
        mainMethodAnswer = True
    else:
        log.error ("Error switching kettle on")
        mainMethodAnswer = False


    json_data = Make_status_JSON (kettler, mainMethodAnswer)

    print (json_data)
    
    kettler.disconnect()
Esempio n. 3
0
    try:
        dutation_correction = int(sys.argv[3])
    except:
        dutation_correction = 0

#Init Kettler Object
kettler = Setup_Kettler()

if kettler:
    log.info(
        "Kettle setup was successfully completed, can proceed with commands further"
    )
    #kettler.sendStart()

    log.info(
        "Setting kettle parameters: MODE=%s, TARGET_TEMP=%s, DURATION_CORRECTION=%s"
        % (mode, target_temp, dutation_correction))
    mainMethodAnswer = False
    if kettler.sendSetMode(mode, target_temp, dutation_correction):
        log.info("Successfully set")
        mainMethodAnswer = True
    else:
        log.error("Error setting kettle parameters")
        mainMethodAnswer = False

    json_data = Make_status_JSON(kettler, mainMethodAnswer)

    print(json_data)

    kettler.disconnect()