Hi,
I’m using a python_script that gets called from a WIFI switch I built with micropython on an ESP8266. The call from the ESP8266 simply calls the python_script with the name of the button that was pushed using the Services API.
url = 'https://<UR>:<PORT>/api/services/python_script/{}'.format(self.script_name) headers = {'x-ha-access': Switch.API_PASSWORD, 'content-type': 'application/json'} data = {'button_name': self.name} resp = urequests.post(url, headers=headers, data=json.dumps(data))
The python_script maps the name of the button to a Script that should be called.
What I’d like to do is reply with some data (name of Script) to the ESP8266 so it can be displayed on a small screen. Is returning data from a python_script called from the Services API possible?