DanielBaulig / vestaboard

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

Integration not starting #6

Closed bitfieldlabs closed 1 year ago

bitfieldlabs commented 1 year ago

First, thank you for writing this integration!

It was working for a long time for me. But now, with recent updates to both homeassistant and the integration, it will not start up anymore.

The log says:

2023-09-13 18:57:16.193 ERROR (MainThread) [custom_components.vestaboard] Unexpected error fetching Vestaboard data: 70
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 293, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/vestaboard/__init__.py", line 180, in _async_update_data
    data = await self.vestaboard.read()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/vestaboard/__init__.py", line 149, in read
    return self.decode_lines(json['message'])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/vestaboard/__init__.py", line 161, in decode_lines
    return [ ''.join([inverted_character_map[code] for code in line]) for line in lines ]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/vestaboard/__init__.py", line 161, in <listcomp>
    return [ ''.join([inverted_character_map[code] for code in line]) for line in lines ]
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/vestaboard/__init__.py", line 161, in <listcomp>
    return [ ''.join([inverted_character_map[code] for code in line]) for line in lines ]
                      ~~~~~~~~~~~~~~~~~~~~~~^^^^^^

I am using homeassistant 2023.9.2 in docker and revision 2e7f05d of the vestaboard integration. I have reinstalled, restarted, reconfigured everything many times. I have verified both host and API key configuration.

Any hint on where to look further would be very much appreciated as I really love to integrate the board.

DanielBaulig commented 1 year ago

Will take a look at this. Feel free to roll back to an early version if you are using git. Simply run git checkout 47a7802a0099671f7736fee8a383600a649cb844 to go back to the version from before the most recent updates.

Can you also verify that you copied the whole error message. I think you might have truncated something, since it's not clear to me what the actual error is from the logs you've shared.

DanielBaulig commented 1 year ago

Without the full error log, I'm not 100% sure if these changes will fix anything, but please update to the most recent version and give it another try.

bitfieldlabs commented 1 year ago

That's the whole entry in the log file when I add the vestaboard configuration.

But I have now managed to get it working by first sending something to the vestaboard via the local API with a different python script directly. Now also homeassistant is able to communicate with the board again...??

No clue what this is but thanks for your help and for sharing your code!

DanielBaulig commented 1 year ago

That's weird. I would have expected some kind of error message about the given code not being a valid key in inverted_character_map. At least that's what I am assuming is happening here and what I based my fix on.

The Vestaboard API added a couple new character codes specifically designed for the white and black versions of Vestaboard. If your board was displaying any of those new characters the decoding of the characters would have failed.

Posting a new message with an external script probably cleared those characters off the board.

I updated the integration to a) know about those characters and handle them correctly and b) to also replace any unknown characters with question marks when reading from the board. So if any new characters get introduced in the future it would at least not entirely fail until the integration was made aware of those new characters.