You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
478 B

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
return 'No match', 400