DanielBaulig / vestaboard

Vestaboard Home Assistant integration
https://www.rarelyunplugged.com
Other
13 stars 1 forks source link

Unable to post using service: vestaboard.post #9

Closed reisfni closed 9 months ago

reisfni commented 9 months ago

I am unable to post to my Vestaboard using service: vestaboard.post. I have confirmed I am able to post via the local API using CURL but when I try to post in Home Assistant I get the following error: "Failed to call service vestaboard.post. Unknown error"

I noticed that after adding the custom integration it shows "No devices or entities", not sure if that's by design or part of the issue?

Core: 2024.1.2 Supervisor: 2023.12.0 Operating System: 11.3

Thanks!

Full debug log below: 2024-01-08 11:45:52.867 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [547635303872] Error handling message: Unknown error (unknown_error) reisfni from 192.168.1.11 (Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2.1 Safari/605.1.15) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 26, in _handle_async_response await func(hass, connection, msg) File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 782, in handle_execute_script script_result = await script_obj.async_run( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1587, in async_run return await asyncio.shield(run.async_run()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 426, in async_run await self._async_step(log_exceptions=False) File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 479, in _async_step self._handle_exception( File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 502, in _handle_exception raise exception File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 476, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 713, in _async_call_service_step response_data = await self._async_run_long_action( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 675, in _async_run_long_action return long_task.result() ^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2149, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2186, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/vestaboard/init.py", line 217, in post result = await vestaboard.write(lines) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/vestaboard/init.py", line 166, in write async with self.post(self.encode_lines(lines)) as response: ^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/vestaboard/init.py", line 156, in encode_lines normalized_lines = ['{:<22}'.format(line[:22].upper()) for line in lines] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/vestaboard/init.py", line 156, in normalized_lines = ['{:<22}'.format(line[:22].upper()) for line in lines]


TypeError: 'NoneType' object is not subscriptable
2024-01-08 11:45:58.532 DEBUG (MainThread) [custom_components.vestaboard] GET being sent to http://192.168.1.66:7000/local-api/message
2024-01-08 11:45:58.606 DEBUG (MainThread) [custom_components.vestaboard] Finished fetching Vestaboard data in 0.074 seconds (success: True)

![image](https://github.com/DanielBaulig/vestaboard/assets/10733802/da721387-66fd-425d-b81b-7ab0dd0b6cea)
![image](https://github.com/DanielBaulig/vestaboard/assets/10733802/a163d4e3-59e2-464d-817f-304220b65e23)
DanielBaulig commented 9 months ago

Thanks for the report. I believe I have a bug that is triggered by including empty lines in the payload. I will put up a patch to fix this, but until then you can try replacing the empty line with a line including a whitespace (" ").

DanielBaulig commented 9 months ago

Fixed in fe0e49a

reisfni commented 9 months ago

Works now, thank you. Great custom integration, appreciate you creating/maintaining it!