StephanJoubert / home_assistant_solarman

Home Assistant component for Solarman collectors used with a variety of inverters.
Apache License 2.0
508 stars 190 forks source link

Update solarman.py #550

Open nedyarrd opened 2 months ago

nedyarrd commented 2 months ago

Repair python 3.12 issue. Now it works but without logging. After something about 21 march 2024, changes to HA core made this component unusable. That little fix will work, but without logging from pySolarmanv5

Milinator commented 2 months ago

Without logging means I don't get the current power?

nedyarrd commented 2 months ago

No it means that You will not have logging from PySolarmanv5, debug and normal messages. Sensors will start to work. If You are not programmer developer You don't need that.

Milinator commented 2 months ago

No it means that You will not have logging from PySolarmanv5, debug and normal messages. Sensors will start to work. If You are not programmer developer You don't need that.

Thanks for your work and your reply. Sadly this fix is not working for me either. Does this integration work at all if you use the intermediate relay from deye in addition to the inverter?

Milinator commented 2 months ago

No it means that You will not have logging from PySolarmanv5, debug and normal messages. Sensors will start to work. If You are not programmer developer You don't need that.

Thanks for your work and your reply. Sadly this fix is not working for me either. Does this integration work at all if you use the intermediate relay from deye in addition to the inverter?

Solved it by downgrading to 1.4.3. My inverter is deye sun-m80g3-eu-q0.

bdeluca commented 2 months ago

So I tried this fix but I still have an error about a read only filesystem. I added some more handling to see the exception.

Traceback (most recent call last): File "/config/custom_components/solarman/solarman.py", line 83, in get_statistics self.connect_to_server() File "/config/custom_components/solarman/solarman.py", line 39, in connect_to_server self._modbus = PySolarmanV5(self._host, self._serial, port=self._port, mb_slave_id=self._mb_slaveid, logger=None, auto_reconnect=True, socket_timeout=15) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pysolarmanv5/pysolarmanv5.py", line 118, in __init__ self._socket_setup(kwargs.get("socket"), kwargs.get("auto_reconnect", False)) File "/usr/local/lib/python3.12/site-packages/pysolarmanv5/pysolarmanv5.py", line 415, in _socket_setup self._data_queue = Queue(maxsize=1) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/multiprocessing/context.py", line 103, in Queue return Queue(maxsize, ctx=self.get_context()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/multiprocessing/queues.py", line 43, in __init__ self._rlock = ctx.Lock() ^^^^^^^^^^ File "/usr/local/lib/python3.12/multiprocessing/context.py", line 68, in Lock return Lock(ctx=self.get_context()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/multiprocessing/synchronize.py", line 169, in __init__ SemLock.__init__(self, SEMAPHORE, 1, 1, ctx=ctx) File "/usr/local/lib/python3.12/multiprocessing/synchronize.py", line 57, in __init__ sl = self._semlock = _multiprocessing.SemLock( ^^^^^^^^^^^^^^^^^^^^^^^^^ OSError: [Errno 30] Read-only file system

psykokwak-com commented 2 months ago

I fixed this issue by forking https://github.com/jmccrohan/pysolarmanv5/blob/main/pysolarmanv5/pysolarmanv5.py from the package to the local plugin directory and replacing the "multiprocessing Queue" with the standard python Queue.

bdeluca commented 2 months ago

I fixed this issue by forking https://github.com/jmccrohan/pysolarmanv5/blob/main/pysolarmanv5/pysolarmanv5.py from the package to the local plugin directory and replacing the "multiprocessing Queue" with the standard python Queue.

the issue with /dev/shm? I traced it back to a change in docker-ce, I reverted docker-ce to the version 24 and It works again. I dont think this is meant to be read-only. But its not resolved in the homeassistant image yet.