edekeijzer / OctoPrint-PSUControl-HomeAssistant

GNU Affero General Public License v3.0
30 stars 8 forks source link

Restarting Home Assistant pauses Print #16

Closed edalquist closed 1 year ago

edalquist commented 1 year ago

I'm not really sure how or why but I'm experiencing a situation where when I restart Home Assistant my print pauses.

Similar to: https://community.home-assistant.io/t/print-halts-upon-system-restart-octoprint/138107/2

edalquist commented 1 year ago
2023-06-15 14:55:21,386 - octoprint.plugins.psucontrol_homeassistant - ERROR - Exception while making API call
Traceback (most recent call last):
  File "/home/pi/oprint/lib/python3.7/site-packages/octoprint_psucontrol_homeassistant/__init__.py", line 67, in send
    response = requests.get(url, headers=headers, verify=verify_certificate)
  File "/home/pi/oprint/lib/python3.7/site-packages/requests/api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "/home/pi/oprint/lib/python3.7/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/pi/oprint/lib/python3.7/site-packages/requests/sessions.py", line 528, in request
    prep = self.prepare_request(req)
  File "/home/pi/oprint/lib/python3.7/site-packages/requests/sessions.py", line 466, in prepare_request
    hooks=merge_hooks(request.hooks, self.hooks),
  File "/home/pi/oprint/lib/python3.7/site-packages/requests/models.py", line 316, in prepare
    self.prepare_url(url, params)
  File "/home/pi/oprint/lib/python3.7/site-packages/requests/models.py", line 390, in prepare_url
    raise MissingSchema(error)
requests.exceptions.MissingSchema: Invalid URL '/api/states/switch.prusa_mk3s': No schema supplied. Perhaps you meant http:///api/states/switch.prusa_mk3s?
edekeijzer commented 1 year ago

@edalquist do you have Automatically turn PSU ON enabled?

edalquist commented 1 year ago

I did have that option on, I missed it in the original readme. Does that cause the printer to pause when HA becomes unavailable?

edekeijzer commented 1 year ago

@edalquist since it tries to turn on the printer, it will wait for the printer to turn on. PSU Control initially just supported GPIO pins, which can't really go offline during a print. Home Assistant can, as well as pretty much every external power switch supported by PSU Control plugins. I'll emphasize this warning even more, since you're surely not the first who mentions a stop or very slow response from Octoprint when HA becomes unavailable.

edalquist commented 1 year ago

Interesting, so is the underlying issue in the parent PSU Control plugin not handling unavailable switches gracefully?