#!/usr/bin/python3 import hassapi as hass from actions import run_action class HttpApi(hass.Hass): def initialize(self): self.register_endpoint(self.api_request, '4button') def api_request(self, data, kwargs): if 'sequence' not in data: return 'Missing sequence', 400 # Let AppDaemon handle API response on error if (run_action(self,data['sequence'])): return 'Success', 200 else: return 'No match', 400