Ejemplo n.º 1
0
def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the ephember thermostat."""
    username = config.get(CONF_USERNAME)
    password = config.get(CONF_PASSWORD)

    try:
        ember = EphEmber(username, password)
        zones = ember.get_zones()
        for zone in zones:
            add_entities([EphEmberThermostat(ember, zone)])
    except RuntimeError:
        _LOGGER.error("Cannot connect to EphEmber")
        return

    return
Ejemplo n.º 2
0
def setup_platform(hass, config, add_entities, discovery_info=None):
    """Set up the ephember thermostat."""
    from pyephember.pyephember import EphEmber

    username = config.get(CONF_USERNAME)
    password = config.get(CONF_PASSWORD)

    try:
        ember = EphEmber(username, password)
        zones = ember.get_zones()
        for zone in zones:
            add_entities([EphEmberThermostat(ember, zone)])
    except RuntimeError:
        _LOGGER.error("Cannot connect to EphEmber")
        return

    return
Ejemplo n.º 3
0
def setup_platform(
    hass: HomeAssistant,
    config: ConfigType,
    add_entities: AddEntitiesCallback,
    discovery_info: DiscoveryInfoType | None = None,
) -> None:
    """Set up the ephember thermostat."""
    username = config.get(CONF_USERNAME)
    password = config.get(CONF_PASSWORD)

    try:
        ember = EphEmber(username, password)
        zones = ember.get_zones()
        for zone in zones:
            add_entities([EphEmberThermostat(ember, zone)])
    except RuntimeError:
        _LOGGER.error("Cannot connect to EphEmber")
        return

    return
Ejemplo n.º 4
0
def main():
    # global params
    parser = argparse.ArgumentParser(prog='example',
                                     description='Example of using pyephember')
    parser.add_argument("--email", type=str,
                        help="Email Address for your account")
    parser.add_argument('--password', type=str, default="",
                        help="Password for your account")
    parser.add_argument('--zone_name', type=str, default="heating",
                        help="Zone Name to check")
    parser.add_argument('--cache_home', type=bool, default=False, 
                        help="use a new HTTP request per api request or cache data between requests")
    args = parser.parse_args()

    password = args.password
    if password is None or password == "":
        try:
            password = getpass.getpass()
        except:
            print("Unable to get password")

    try:
        t = EphEmber(args.email, password, cache_home=args.cache_home)
    except:
        print("Unable to login")
        return 1

    # Get the full home information
    print(json.dumps(t.get_home(), indent=4, sort_keys=True))
    print("----------------------------------")
    # Get only zone information
    print(json.dumps(t.get_zones(), indent=4, sort_keys=True))
    print("----------------------------------")
    # Get a zone by name
    print(json.dumps(t.get_zone(args.zone_name), indent=4, sort_keys=True))
    print("----------------------------------")
    # Get information about a zone
    print("{} current temperature is {}".format(args.zone_name, t.get_zone_temperature(args.zone_name)))
    print("{} active : {}".format(args.zone_name, t.is_zone_active(args.zone_name)))
    print("{} mode : {}".format(args.zone_name, t.get_zone_mode(args.zone_name).name))
    return 0
Ejemplo n.º 5
0
                    default=False,
                    help="cache data between API requests")
parser.add_argument('--target',
                    type=float,
                    help="Set new target temperature for the named Zone")
parser.add_argument('--advance',
                    type=str,
                    choices=("on", "off"),
                    help="Set advance state for named Zone")
args = parser.parse_args()

password = args.password
if not password:
    password = getpass.getpass()

t = EphEmber(args.email, password, cache_home=args.cache_home)

# Get the full home information
print(json.dumps(t.get_home(), indent=4, sort_keys=True))
print("----------------------------------")
# Get only zone information
print(json.dumps(t.get_zones(), indent=4, sort_keys=True))
print("----------------------------------")
# Get a zone by name
print(json.dumps(t.get_zone(args.zone_name), indent=4, sort_keys=True))
print("----------------------------------")
# Get information about a zone
print("{} current temperature is {}".format(
    args.zone_name, t.get_zone_temperature(args.zone_name)))
print("{} target temperature is {}".format(
    args.zone_name, t.get_zone_target_temperature(args.zone_name)))
Ejemplo n.º 6
0
parser.add_argument('--show-log',
                    action='store_true',
                    help="Show MQTT client log")
parser.add_argument('--show-raw-messages',
                    action='store_true',
                    help="Show undecoded messages")
args = parser.parse_args()

##################################################
# start

password = args.password
if not password:
    password = getpass.getpass()

t = EphEmber(args.email, password)
POINTDATA_TOPIC_UPLOAD = "/".join([
    t.get_home_details()['homes']['productId'],
    t.get_home_details()['homes']['uid'], "upload/pointdata"
])

st = t.messenger.start(
    callbacks={
        'on_connect': on_connect,
        'on_log': on_log,
        'on_message': on_message,
        'on_subscribe': on_subscribe
    })

while True:
    t.messenger.client.loop()