json.load expects a file object but it appears to be receiving a string instead.
Debug log
2024-07-03 18:51:51.891 ERROR (MainThread) [homeassistant.util.logging] Exception in lwt_message_received when handling msg on 'hasp/hallway_panel/LWT': 'online'
Traceback (most recent call last):
File "/config/custom_components/openhasp/__init__.py", line 479, in lwt_message_received
await self.async_load_page(self._pages_jsonl)
File "/config/custom_components/openhasp/__init__.py", line 658, in async_load_page
json_data = json.load(pages_file)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/json/__init__.py", line 293, in load
return loads(fp.read(),
^^^^^^^
AttributeError: 'str' object has no attribute 'read'
Version of the custom_component
0.7.3
Configuration
yaml not relevant.
OpenHASP is configured to send a json file (not jsonl). The json file is correctly formatted and is in HA's allowed external directories.
Describe the bug
The following handler fails to load the json file correctly. https://github.com/HASwitchPlate/openHASP-custom-component/blob/24f071cb510f3da0e5c801ccd52eb5abad9c4d6b/custom_components/openhasp/__init__.py#L656-L667
json.load expects a file object but it appears to be receiving a string instead.
Debug log