The following lines of code are generating an error and I’m not sure why.
level=ptrdict[sys]["marker"][component]["tonerlow"]["value"]
self.log("component {} - input_boolean level={}".format(component,level),"INFO")
self.set_state(component,state=level) # set ha value for input boolean
Here is the appdaemon.log output related to the error
2017-01-17 15:23:21.532100 INFO printermonitor: component input_boolean.ofhp1tonerlow - input_boolean level=0
2017-01-17 15:23:21.558866 WARNING Logged an error to /home/hass/appdaemon/appdaemon.err
Here are the lines from the appdaemon.err file related to the error.
2017-01-17 15:23:21.557585 WARNING Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/appdaemon/appdaemon.py", line 422, in worker
function()
File "/home/hass/code/appdaemon/printermonitor.py", line 19, in initialize
self.check_printers()
File "/home/hass/code/appdaemon/printermonitor.py", line 96, in check_printers
self.set_state(component,state=level) # set ha value for input boolean
File "/usr/local/lib/python3.4/dist-packages/appdaemon/appapi.py", line 177, in set_state
r.raise_for_status()
File "/usr/local/lib/python3.4/dist-packages/requests/models.py", line 893, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http://localhost:8123/api/states/input_boolean.ofhp1tonerlow
If I enter in the HTTP url in the browser, I get back the information on the appropriate component. So I’m a little confused.