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
def post(ctx, method, json): """do a POST against api/<method>""" click.echo(format_output(ctx, req(ctx, "post", method, json)))
def get(ctx, method): """do a GET against api/<method>""" click.echo(format_output(ctx, req(ctx, "get", method)))
def cli(ctx): """Get basic info from Home Assistant using /api/discovery_info.""" click.echo(format_output(ctx, req(ctx, "get", "discovery_info")))