Example #1
0
def events(ctx, args, incomplete):
    _init_ctx(ctx)
    try:
        x = req(ctx, "get", "events")
    except HTTPError:
        x = None

    entities = []

    if x is not None:
        for entity in x:
            entities.append((entity["event"], ''))

        entities.sort()

        return [c for c in entities if incomplete in c[0]]
    else:
        return entities
Example #2
0
def post(ctx, method, json):
    """do a POST against api/<method>"""

    click.echo(format_output(ctx, req(ctx, "post", method, json)))
Example #3
0
def get(ctx, method):
    """do a GET against api/<method>"""

    click.echo(format_output(ctx, req(ctx, "get", method)))
Example #4
0
def cli(ctx):
    """Get basic info from Home Assistant using /api/discovery_info."""

    click.echo(format_output(ctx, req(ctx, "get", "discovery_info")))