Comments (85)
Hi there, It's made for continuous connection.. So it goes crazy when it can't reach the inverter.
I will think about a way how it could be done without affecting current working state. But can't make any promises as I'm really busy lately.
I wish I could help you more.
from ha-solarman.
I cloned the repo manually and enabled extensive debug logging. Lets wait and see.
from ha-solarman.
Hi @Floppe so I just committed prob final changes regarding "our issue" so could you maybe update the integration and go through the debug logging with me once more again so I can check the flow?
This latest version should quiet the logging! (With debug disabled of course)
If there won't be any other issues consider this matter as done!
Have fun!
from ha-solarman.
Tested and it does not log, so that's good. But it did not connect after sunrise. Could it be because I restarted after sunset. π€
All sensors are now unavailable.And what if you enable debug log? And let it run "over night" how does the log look like in the morning?
Enabled debug and let it run over night. This time it worked/started after the inverter came online. The only difference now is that debugging is enabled and I restarted while the inverter was online.
Try it one more time then. But without touching the inverter if possible...
Debug enabled/disable should really don't have any impact on the inner workings it just simply show some more massages in the flow along the way I don't do there any flow changes based on debugging...
from ha-solarman.
For my part it has worked really great now. It has connected again two mornings in a row. So I still have no debug logs when it fails in the morning.
from ha-solarman.
I'll grab a log when it goes offline tonight.
from ha-solarman.
A possible temporary work around for this is to install the Frenck integration Spook. This provides several useful advanced service calls including the ability to enable/disable the polling for an integration. I'm testing this and will report back. I'll also try and increase my knowledge of the HA integrations to see if/how this functionality could be built into the integration.
Note: the config_entry_id for Solarman is found for your system when you build the automation using the GUI so don't copy this code verbatim.
alias: PV - Control Polling
description: Enables inverter polling after sunrise
trigger:
- platform: sun
event: sunrise
- platform: sun
event: sunset
- platform: homeassistant
event: start
condition: []
action:
- if:
- condition: sun
after: sunset
after_offset: "-00:01:00"
then:
- service: homeassistant.disable_polling
data:
config_entry_id: 8e29598c8e01390f2cf499a1eca7443a
else:
- service: homeassistant.enable_polling
data:
config_entry_id: 8e29598c8e01390f2cf499a1eca7443a
mode: single
from ha-solarman.
I can only assume that each inverter goes offline in a different way? I know my Solis keeps working for a good while once generation has stopped by using grid power before it finally decides to go to sleep. It may be that in that state you can make a connection but it doesnβt respond to modbus/solarman?
from ha-solarman.
Okay now there is obvious it's not trying to connect back again after disconnect and sure it can't work like that...
Edit2: No that was wrong, there is just simply not enough of the log cause you have longer interval...
BTW nice pic
Edit: Also can you check for me if new diag sensor Update Interval shows you the true and correct interval?
Edit3: Can you update to yesterday pre-release version? There are some changes in the flow which could result at least in better understanding of the matter....
Cheers!
from ha-solarman.
I have updated to latest version and the Update_Interval is now correct at around 30 secs before it recording 5-6 secs. I'll capture more log tomorrow morning if it has the same issue as I won't be dashing out....Will report back.
from ha-solarman.
Ou it looks like I forgot to commit some changes, sorry 'bout that: 321e9e4
from ha-solarman.
It's reassuring to be human and forget things π
All working will report back in 24hr....
Cheers
Rich
from ha-solarman.
It worked!! So using the automation provided earlier the inverter polling was successfully stopped at sunset and started at sunrise with no errors. Interestingly the connection sensor went off line very briefly when the polling was disabled but then reconnected. I'll run the debug log around sunset time tonight so we can see what is happening.
from ha-solarman.
Here's the log from last night without changing the enable_polling state via an automation so the integration was just free running. On the positive side it kept working and recovered in the morning although it did raise a few log messages which I have attached. So I will go back to using the Spook integration to disable polling and have a think about how that stop polling functionality could be added to this integration.
home-assistant_2024-07-31T07-29-44.541Z.log
Edit: Meant to say the inverter state remain connected even though it was off-line.
from ha-solarman.
The config above should replace the one in the Repro as it is syntactically correct unlike the existing one. I am working on getting myself a working dev environment so I can start testing and debugging and pushing things but there's a lot to get my head around....
from ha-solarman.
After several days of running I can confirm using Spook to disable/enable polling on the integration works fine and zero errors or warnings are generated by the integration. One gotcha is to add an offset to sunrise before enabling polling. Just because the sun has risen doesn't mean that inverter is on-line as it depends on which way your panels are facing. I have some East facing panels so energy comes on 5 minutes after sunrise so a 10 offset is safe. For a South facing array you may need 30 minutes or longer.
from ha-solarman.
So would you maybe mind to add it here then? :) for others.
I don't mind. Glad to help others, so please add it. Someone have changed start end registries last in the gist, but me myself have not tested that version.
from ha-solarman.
I made some changes which should help both of you guys in overall: refactor: Asyncio timeout handling moved to api.py (It's not part of any release yet though so manual installation - copy code over - is required)
Would love if both of you tried it (meaning w/ and also w/o turning off polling in the night).
Edit: Small improvement to the commit above: feat: Don't raise TimeoutError immediately
from ha-solarman.
HA GUI but I can live with the more correct unavailable
i know! But #65 :-/
from ha-solarman.
What inverter are we talking about?
from ha-solarman.
It's a Sofar KTLX-G3
from ha-solarman.
Hi. I understand that. Here are some log snippets incase you do find some time.
2024-07-12 04:26:06.656 ERROR (MainThread) [custom_components.solarman.api] OSError: [Errno 113] Connect call failed ('192.168.10.159', 8899)
Traceback (most recent call last):
File "/config/custom_components/solarman/api.py", line 47, in reconnect
self.reader, self.writer = await asyncio.open_connection(self.address, self.port)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/asyncio/streams.py", line 48, in open_connection
transport, _ = await loop.create_connection(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1120, in create_connection
raise exceptions[0]
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1102, in create_connection
sock = await self._connect_sock(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1005, in _connect_sock
await self.sock_connect(sock, address)
File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 641, in sock_connect
return await fut
^^^^^^^^^
File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 681, in _sock_connect_cb
raise OSError(err, f'Connect call failed {address}')
OSError: [Errno 113] Connect call failed ('192.168.10.159', 8899)
2024-07-12 04:26:06.658 WARNING (MainThread) [asyncio] socket.send() raised exception.
2024-07-12 04:26:06.658 ERROR (MainThread) [custom_components.solarman.api] [2358423359] Send/Receive error: [Errno 113] Host is unreachable
Traceback (most recent call last):
File "/config/custom_components/solarman/api.py", line 69, in _send_receive_v5_frame
await self.writer.drain()
File "/usr/local/lib/python3.12/asyncio/streams.py", line 380, in drain
raise exc
File "/config/custom_components/solarman/api.py", line 199, in async_get
await self.async_read(code, params, start, end)
File "/config/custom_components/solarman/api.py", line 133, in async_read
await self._read_registers(code, params, start, end)
File "/config/custom_components/solarman/api.py", line 125, in _read_registers
response = await self.read_holding_registers(register_addr = start, quantity = length)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pysolarmanv5/pysolarmanv5_async.py", line 283, in read_holding_registers
modbus_values = await self._get_modbus_response(mb_request_frame)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pysolarmanv5/pysolarmanv5_async.py", line 246, in _get_modbus_response
mb_response_frame = await self._send_receive_modbus_frame(mb_request_frame)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pysolarmanv5/pysolarmanv5_async.py", line 233, in _send_receive_modbus_frame
v5_response_frame = await self._send_receive_v5_frame(v5_request_frame)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/solarman/api.py", line 69, in _send_receive_v5_frame
await self.writer.drain()
File "/usr/local/lib/python3.12/asyncio/streams.py", line 380, in drain
raise exc
File "/config/custom_components/solarman/api.py", line 199, in async_get
await self.async_read(code, params, start, end)
File "/config/custom_components/solarman/api.py", line 133, in async_read
await self._read_registers(code, params, start, end)
File "/config/custom_components/solarman/api.py", line 125, in _read_registers
response = await self.read_holding_registers(register_addr = start, quantity = length)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pysolarmanv5/pysolarmanv5_async.py", line 283, in read_holding_registers
modbus_values = await self._get_modbus_response(mb_request_frame)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pysolarmanv5/pysolarmanv5_async.py", line 246, in _get_modbus_response
mb_response_frame = await self._send_receive_modbus_frame(mb_request_frame)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pysolarmanv5/pysolarmanv5_async.py", line 233, in _send_receive_modbus_frame
v5_response_frame = await self._send_receive_v5_frame(v5_request_frame)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/solarman/api.py", line 69, in _send_receive_v5_frame
await self.writer.drain()
File "/usr/local/lib/python3.12/asyncio/streams.py", line 380, in drain
raise exc
File "/config/custom_components/solarman/api.py", line 199, in async_get
await self.async_read(code, params, start, end)
File "/config/custom_components/solarman/api.py", line 133, in async_read
await self._read_registers(code, params, start, end)
File "/config/custom_components/solarman/api.py", line 125, in _read_registers
response = await self.read_holding_registers(register_addr = start, quantity = length)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pysolarmanv5/pysolarmanv5_async.py", line 283, in read_holding_registers
modbus_values = await self._get_modbus_response(mb_request_frame)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pysolarmanv5/pysolarmanv5_async.py", line 246, in _get_modbus_response
mb_response_frame = await self._send_receive_modbus_frame(mb_request_frame)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/pysolarmanv5/pysolarmanv5_async.py", line 233, in _send_receive_modbus_frame
v5_response_frame = await self._send_receive_v5_frame(v5_request_frame)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/solarman/api.py", line 69, in _send_receive_v5_frame
await self.writer.drain()
File "/usr/local/lib/python3.12/asyncio/streams.py", line 380, in drain
raise exc
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 312, in _async_refresh
self.data = await self._async_update_data()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/solarman/coordinator.py", line 33, in _async_update_data
return await self.inverter.async_get(self._accounting())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/solarman/api.py", line 225, in async_get
await self.async_get_failed(f"Querying {self.serial} at {self.address}:{self.port} failed during connection start. [{format_exception(e)}]")
File "/config/custom_components/solarman/api.py", line 173, in async_get_failed
await self.async_disconnect()
File "/config/custom_components/solarman/api.py", line 113, in async_disconnect
await self.writer.wait_closed()
File "/usr/local/lib/python3.12/asyncio/streams.py", line 364, in wait_closed
await self._protocol._get_close_waiter(self)
OSError: [Errno 113] Host is unreachable
2024-07-12 04:26:06.662 WARNING (MainThread) [custom_components.solarman.api] Querying (1028 - 1070) failed. #0 [OSError: [Errno 113] Host is unreachable]
2024-07-12 04:26:10.663 ERROR (MainThread) [custom_components.solarman.coordinator] Unexpected error fetching Solarman data
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 312, in _async_refresh
self.data = await self._async_update_data()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/solarman/coordinator.py", line 33, in _async_update_data
return await self.inverter.async_get(self._accounting())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/solarman/api.py", line 225, in async_get
await self.async_get_failed(f"Querying {self.serial} at {self.address}:{self.port} failed during connection start. [{format_exception(e)}]")
File "/config/custom_components/solarman/api.py", line 173, in async_get_failed
await self.async_disconnect()
File "/config/custom_components/solarman/api.py", line 113, in async_disconnect
await self.writer.wait_closed()
File "/usr/local/lib/python3.12/asyncio/streams.py", line 364, in wait_closed
await self._protocol._get_close_waiter(self)
OSError: [Errno 113] Host is unreachable
....
....snip....
....
2024-07-12 04:26:18.614 ERROR (MainThread) [custom_components.solarman.api] OSError: [Errno 113] Connect call failed ('192.168.10.159', 8899)
from ha-solarman.
Hi there, I added in the fix: Try for extended handling for EHOSTUNREACH some extended error handling to try to debug our way into some solution. Could you please try it? Enable debug logging and post the logs here?
You will have to manually overwrite the code from the repo in your HA as this is not as part of latest release.
Thanks and have fun!
from ha-solarman.
Here is a snippet from when the inverter did go offline. Hope it's enough.
2024-07-17 23:20:37.980 DEBUG (MainThread) [custom_components.solarman.parser] Default update_interval: 60, min_span: 25, digits: 6
2024-07-17 23:20:37.980 DEBUG (MainThread) [custom_components.solarman.api] Scheduling 4 query requests. #-5
2024-07-17 23:20:37.980 DEBUG (MainThread) [custom_components.solarman.api] Querying (1028 - 1070) ...
2024-07-17 23:20:37.980 DEBUG (MainThread) [custom_components.solarman.api] Reader Task done: False, cancelled: False.
2024-07-17 23:20:37.980 DEBUG (MainThread) [custom_components.solarman.api] [2358423359] SENT: a5 17 00 10 45 1d 00 3f af 92 8c 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 03 04 04 00 2
b 45 24 37 15
2024-07-17 23:20:51.981 WARNING (MainThread) [custom_components.solarman.api] Querying (1028 - 1070) failed. #-5 [TimeoutError]
2024-07-17 23:20:54.983 DEBUG (MainThread) [custom_components.solarman.api] Querying attempts left: 4
2024-07-17 23:20:54.983 DEBUG (MainThread) [custom_components.solarman.api] Reader Task done: False, cancelled: False.
2024-07-17 23:20:54.983 DEBUG (MainThread) [custom_components.solarman.api] [2358423359] SENT: a5 17 00 10 45 1e 00 3f af 92 8c 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 03 04 04 00 2
b 45 24 38 15
2024-07-17 23:21:07.980 DEBUG (MainThread) [custom_components.solarman.coordinator] Finished fetching Solarman data in 30.000 seconds (success: False)
2024-07-17 23:21:12.968 DEBUG (MainThread) [custom_components.solarman.parser] Default update_interval: 60, min_span: 25, digits: 6
2024-07-17 23:21:12.968 DEBUG (MainThread) [custom_components.solarman.api] Scheduling 4 query requests. #-5
2024-07-17 23:21:12.968 DEBUG (MainThread) [custom_components.solarman.api] Querying (1028 - 1070) ...
2024-07-17 23:21:12.968 DEBUG (MainThread) [custom_components.solarman.api] Reader Task done: False, cancelled: False.
2024-07-17 23:21:12.968 DEBUG (MainThread) [custom_components.solarman.api] [2358423359] SENT: a5 17 00 10 45 1f 00 3f af 92 8c 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 03 04 04 00 2
b 45 24 39 15
2024-07-17 23:21:26.971 WARNING (MainThread) [custom_components.solarman.api] Querying (1028 - 1070) failed. #-5 [TimeoutError]
2024-07-17 23:21:29.971 DEBUG (MainThread) [custom_components.solarman.api] Querying attempts left: 4
2024-07-17 23:21:29.971 DEBUG (MainThread) [custom_components.solarman.api] Reader Task done: True, cancelled: False.
2024-07-17 23:21:29.972 DEBUG (MainThread) [custom_components.solarman.api] [2358423359] SENT: a5 17 00 10 45 20 00 3f af 92 8c 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 03 04 04 00 2
b 45 24 3a 15
2024-07-17 23:21:29.972 DEBUG (MainThread) [custom_components.solarman.api] [2358423359] EHOSTUNREACH error: [Errno 113] Host is unreachable
2024-07-17 23:21:29.972 DEBUG (MainThread) [custom_components.solarman.api] [2358423359] Send/Receive error: [Errno 113] Host is unreachable
2024-07-17 23:21:29.972 WARNING (MainThread) [custom_components.solarman.api] Querying (1028 - 1070) failed. #-5 [TimeoutError]
2024-07-17 23:21:32.973 DEBUG (MainThread) [custom_components.solarman.api] Querying attempts left: 3
2024-07-17 23:21:32.973 DEBUG (MainThread) [custom_components.solarman.api] Reader Task done: True, cancelled: False.
2024-07-17 23:21:32.973 DEBUG (MainThread) [custom_components.solarman.api] [2358423359] SENT: a5 17 00 10 45 21 00 3f af 92 8c 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 03 04 04 00 2
b 45 24 3b 15
2024-07-17 23:21:32.973 DEBUG (MainThread) [custom_components.solarman.api] [2358423359] EHOSTUNREACH error: [Errno 113] Host is unreachable
2024-07-17 23:21:32.973 DEBUG (MainThread) [custom_components.solarman.api] [2358423359] Send/Receive error: [Errno 113] Host is unreachable
2024-07-17 23:21:32.973 WARNING (MainThread) [custom_components.solarman.api] Querying (1028 - 1070) failed. #-5 [TimeoutError]
2024-07-17 23:21:35.974 DEBUG (MainThread) [custom_components.solarman.api] Querying attempts left: 2
2024-07-17 23:21:35.974 DEBUG (MainThread) [custom_components.solarman.api] Reader Task done: True, cancelled: False.
2024-07-17 23:21:35.974 DEBUG (MainThread) [custom_components.solarman.api] [2358423359] SENT: a5 17 00 10 45 22 00 3f af 92 8c 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 03 04 04 00 2
b 45 24 3c 15
2024-07-17 23:21:35.974 DEBUG (MainThread) [custom_components.solarman.api] [2358423359] EHOSTUNREACH error: [Errno 113] Host is unreachable
2024-07-17 23:21:35.974 DEBUG (MainThread) [custom_components.solarman.api] [2358423359] Send/Receive error: [Errno 113] Host is unreachable
2024-07-17 23:21:35.974 WARNING (MainThread) [custom_components.solarman.api] Querying (1028 - 1070) failed. #-5 [TimeoutError]
2024-07-17 23:21:38.975 DEBUG (MainThread) [custom_components.solarman.api] Querying attempts left: 1
2024-07-17 23:21:38.975 DEBUG (MainThread) [custom_components.solarman.api] Reader Task done: True, cancelled: False.
2024-07-17 23:21:38.975 DEBUG (MainThread) [custom_components.solarman.api] [2358423359] SENT: a5 17 00 10 45 23 00 3f af 92 8c 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 03 04 04 00 2
b 45 24 3d 15
2024-07-17 23:21:38.975 DEBUG (MainThread) [custom_components.solarman.api] [2358423359] EHOSTUNREACH error: [Errno 113] Host is unreachable
2024-07-17 23:21:38.975 DEBUG (MainThread) [custom_components.solarman.api] [2358423359] Send/Receive error: [Errno 113] Host is unreachable
2024-07-17 23:21:38.975 WARNING (MainThread) [custom_components.solarman.api] Querying (1028 - 1070) failed. #-5 [TimeoutError]
2024-07-17 23:21:41.977 DEBUG (MainThread) [custom_components.solarman.api] Querying attempts left: 0, aborting.
2024-07-17 23:21:41.977 DEBUG (MainThread) [custom_components.solarman.api] Request failed. [Previous Status: Connected]
```2024-07-17 23:20:37.980 DEBUG (MainThread) [custom_components.solarman.parser] Default update_interval: 60, min_span: 25, digits: 6
2024-07-17 23:20:37.980 DEBUG (MainThread) [custom_components.solarman.api] Scheduling 4 query requests. #-5
2024-07-17 23:20:37.980 DEBUG (MainThread) [custom_components.solarman.api] Querying (1028 - 1070) ...
2024-07-17 23:20:37.980 DEBUG (MainThread) [custom_components.solarman.api] Reader Task done: False, cancelled: False.
2024-07-17 23:20:37.980 DEBUG (MainThread) [custom_components.solarman.api] [2358423359] SENT: a5 17 00 10 45 1d 00 3f af 92 8c 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 03 04 04 00 2
b 45 24 37 15
2024-07-17 23:20:51.981 WARNING (MainThread) [custom_components.solarman.api] Querying (1028 - 1070) failed. #-5 [TimeoutError]
2024-07-17 23:20:54.983 DEBUG (MainThread) [custom_components.solarman.api] Querying attempts left: 4
2024-07-17 23:20:54.983 DEBUG (MainThread) [custom_components.solarman.api] Reader Task done: False, cancelled: False.
2024-07-17 23:20:54.983 DEBUG (MainThread) [custom_components.solarman.api] [2358423359] SENT: a5 17 00 10 45 1e 00 3f af 92 8c 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 03 04 04 00 2
b 45 24 38 15
2024-07-17 23:21:07.980 DEBUG (MainThread) [custom_components.solarman.coordinator] Finished fetching Solarman data in 30.000 seconds (success: False)
2024-07-17 23:21:12.968 DEBUG (MainThread) [custom_components.solarman.parser] Default update_interval: 60, min_span: 25, digits: 6
2024-07-17 23:21:12.968 DEBUG (MainThread) [custom_components.solarman.api] Scheduling 4 query requests. #-5
2024-07-17 23:21:12.968 DEBUG (MainThread) [custom_components.solarman.api] Querying (1028 - 1070) ...
2024-07-17 23:21:12.968 DEBUG (MainThread) [custom_components.solarman.api] Reader Task done: False, cancelled: False.
2024-07-17 23:21:12.968 DEBUG (MainThread) [custom_components.solarman.api] [2358423359] SENT: a5 17 00 10 45 1f 00 3f af 92 8c 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 03 04 04 00 2
b 45 24 39 15
2024-07-17 23:21:26.971 WARNING (MainThread) [custom_components.solarman.api] Querying (1028 - 1070) failed. #-5 [TimeoutError]
2024-07-17 23:21:29.971 DEBUG (MainThread) [custom_components.solarman.api] Querying attempts left: 4
2024-07-17 23:21:29.971 DEBUG (MainThread) [custom_components.solarman.api] Reader Task done: True, cancelled: False.
2024-07-17 23:21:29.972 DEBUG (MainThread) [custom_components.solarman.api] [2358423359] SENT: a5 17 00 10 45 20 00 3f af 92 8c 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 03 04 04 00 2
b 45 24 3a 15
2024-07-17 23:21:29.972 DEBUG (MainThread) [custom_components.solarman.api] [2358423359] EHOSTUNREACH error: [Errno 113] Host is unreachable
2024-07-17 23:21:29.972 DEBUG (MainThread) [custom_components.solarman.api] [2358423359] Send/Receive error: [Errno 113] Host is unreachable
2024-07-17 23:21:29.972 WARNING (MainThread) [custom_components.solarman.api] Querying (1028 - 1070) failed. #-5 [TimeoutError]
2024-07-17 23:21:32.973 DEBUG (MainThread) [custom_components.solarman.api] Querying attempts left: 3
2024-07-17 23:21:32.973 DEBUG (MainThread) [custom_components.solarman.api] Reader Task done: True, cancelled: False.
2024-07-17 23:21:32.973 DEBUG (MainThread) [custom_components.solarman.api] [2358423359] SENT: a5 17 00 10 45 21 00 3f af 92 8c 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 03 04 04 00 2
b 45 24 3b 15
2024-07-17 23:21:32.973 DEBUG (MainThread) [custom_components.solarman.api] [2358423359] EHOSTUNREACH error: [Errno 113] Host is unreachable
2024-07-17 23:21:32.973 DEBUG (MainThread) [custom_components.solarman.api] [2358423359] Send/Receive error: [Errno 113] Host is unreachable
2024-07-17 23:21:32.973 WARNING (MainThread) [custom_components.solarman.api] Querying (1028 - 1070) failed. #-5 [TimeoutError]
2024-07-17 23:21:35.974 DEBUG (MainThread) [custom_components.solarman.api] Querying attempts left: 2
2024-07-17 23:21:35.974 DEBUG (MainThread) [custom_components.solarman.api] Reader Task done: True, cancelled: False.
2024-07-17 23:21:35.974 DEBUG (MainThread) [custom_components.solarman.api] [2358423359] SENT: a5 17 00 10 45 22 00 3f af 92 8c 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 03 04 04 00 2
b 45 24 3c 15
2024-07-17 23:21:35.974 DEBUG (MainThread) [custom_components.solarman.api] [2358423359] EHOSTUNREACH error: [Errno 113] Host is unreachable
2024-07-17 23:21:35.974 DEBUG (MainThread) [custom_components.solarman.api] [2358423359] Send/Receive error: [Errno 113] Host is unreachable
2024-07-17 23:21:35.974 WARNING (MainThread) [custom_components.solarman.api] Querying (1028 - 1070) failed. #-5 [TimeoutError]
2024-07-17 23:21:38.975 DEBUG (MainThread) [custom_components.solarman.api] Querying attempts left: 1
2024-07-17 23:21:38.975 DEBUG (MainThread) [custom_components.solarman.api] Reader Task done: True, cancelled: False.
2024-07-17 23:21:38.975 DEBUG (MainThread) [custom_components.solarman.api] [2358423359] SENT: a5 17 00 10 45 23 00 3f af 92 8c 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 03 04 04 00 2
b 45 24 3d 15
2024-07-17 23:21:38.975 DEBUG (MainThread) [custom_components.solarman.api] [2358423359] EHOSTUNREACH error: [Errno 113] Host is unreachable
2024-07-17 23:21:38.975 DEBUG (MainThread) [custom_components.solarman.api] [2358423359] Send/Receive error: [Errno 113] Host is unreachable
2024-07-17 23:21:38.975 WARNING (MainThread) [custom_components.solarman.api] Querying (1028 - 1070) failed. #-5 [TimeoutError]
2024-07-17 23:21:41.977 DEBUG (MainThread) [custom_components.solarman.api] Querying attempts left: 0, aborting.
2024-07-17 23:21:41.977 DEBUG (MainThread) [custom_components.solarman.api] Request failed. [Previous Status: Connected]
2024-07-17 23:21:41.977 INFO (MainThread) [custom_components.solarman.api] Disconnecting from 192.168.10.159:8899
2024-07-17 23:21:41.977 DEBUG (MainThread) [custom_components.solarman.api] [Errno 113] Host is unreachable can be during closing ignored.
2024-07-17 23:21:41.977 DEBUG (MainThread) [custom_components.solarman.api] Request failed. [Previous Status: Connected]
2024-07-17 23:21:41.977 INFO (MainThread) [custom_components.solarman.api] Disconnecting from 192.168.10.159:8899
2024-07-17 23:21:41.977 DEBUG (MainThread) [custom_components.solarman.api] [Errno 113] Host is unreachable can be during closing ignored.
2024-07-17 23:21:41.977 ERROR (MainThread) [custom_components.solarman.coordinator] Unexpected error fetching Solarman data
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 312, in _async_refresh
self.data = await self._async_update_data()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/solarman/coordinator.py", line 30, in _async_update_data
return await self.inverter.async_get(self._accounting())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/solarman/api.py", line 216, in async_get
await self.async_get_failed(f"Querying {self.serial} at {self.address}:{self.port} failed. [{format_exception(e)}]")
File "/config/custom_components/solarman/api.py", line 164, in async_get_failed
await self.async_disconnect()
File "/config/custom_components/solarman/api.py", line 114, in async_disconnect
await self.writer.wait_closed()
File "/usr/local/lib/python3.12/asyncio/streams.py", line 364, in wait_closed
await self._protocol._get_close_waiter(self)
OSError: [Errno 113] Host is unreachable
2024-07-17 23:21:42.075 DEBUG (MainThread) [custom_components.solarman.coordinator] Finished fetching Solarman data in 29.107 seconds (success: False)
2024-07-17 23:21:46.857 DEBUG (MainThread) [custom_components.solarman.parser] Default update_interval: 60, min_span: 25, digits: 6
2024-07-17 23:21:46.857 DEBUG (MainThread) [custom_components.solarman.api] Scheduling 4 query requests. #-5
2024-07-17 23:21:46.857 DEBUG (MainThread) [custom_components.solarman.api] Querying (1028 - 1070) ...
2024-07-17 23:21:46.857 DEBUG (MainThread) [custom_components.solarman.api] Reader Task done: True, cancelled: False.
from ha-solarman.
Great! So it looks like I was able to successfully catch and filter out the Errno 113.
So I guess we could make them completely silent...
Thanks for your help and I let you know when it will be ready. ;)
from ha-solarman.
I have been watching this issue with interest as I have the same problem with a Solis Inverter. My current solution is to stop the integration polling and instead do it from an automation that starts after sunrise and stops at sunset. Would an improved solution be to have an option in the configuration to "only poll during daylight"? As far as I'm aware all solar inverters shut down at night unless they are a hybrid version with an attached battery.
from ha-solarman.
Tested and it does not log, so that's good. But it did not connect after sunrise. Could it be because I restarted after sunset. π€
All sensors are now unavailable.
from ha-solarman.
I have been watching this issue with interest as I have the same problem with a Solis Inverter. My current solution is to stop the integration polling and instead do it from an automation that starts after sunrise and stops at sunset. Would an improved solution be to have an option in the configuration to "only poll during daylight"? As far as I'm aware all solar inverters shut down at night unless they are a hybrid version with an attached battery.
That is really good idea! I look into it!
from ha-solarman.
Tested and it does not log, so that's good. But it did not connect after sunrise. Could it be because I restarted after sunset. π€
All sensors are now unavailable.
And what if you enable debug log? And let it run "over night" how does the log look like in the morning?
from ha-solarman.
There is a big problem with this addon, my HA cpu usage normaly is under 1%, cpu usage growing up to 10% from sunset to midnight, central europe (21:00 to 00:00 3 hours). Sofar Solar with LSW3. Debug log size about 490 MB and a milions of lines...
from ha-solarman.
Okay but what it logs though? What does the log look like? There is a possibility that it does not behave correctly when is the inverter offline. Are you turning off the inverter?
from ha-solarman.
Tested and it does not log, so that's good. But it did not connect after sunrise. Could it be because I restarted after sunset. π€
All sensors are now unavailable.
And what if you enable debug log? And let it run "over night" how does the log look like in the morning?
Enabled debug and let it run over night. This time it worked/started after the inverter came online. The only difference now is that debugging is enabled and I restarted while the inverter was online.
from ha-solarman.
No I am not turning off my inverter, it do automaticly turn off after sunset like a lot of other inverter models. I think addon should be prepared for that situation. "Turn off addon after sunset" it is not resolving issue. Maybe ping command to check inverter availability? . Error logs are the same as up
from ha-solarman.
No I am not turning off my inverter, it do automaticly turn off after sunset like a lot of other inverter models. I think addon should be prepared for that situation. "Turn off addon after sunset" it is not resolving issue. Maybe ping command to check inverter availability? . Error logs are the same as up
I was asking in general if you inverter runs over night or not.
So it does not okay.
My inverter never goes offline, cause I'm charging batteries in off-peak hours and so. So this integration is mainly written to work in that scenario.
You said that your log increased in size during night and now are you saying that it has the same messages as during the day? I don't follow...
If you want to resolve any issues you have to be more specific (provide logs, or better provide debug logs). Just by simply stating: "It does not work, fix it." Does not help at all and my hands are tied.
Adapting flow based on ping would be really bad Idea cause some are connecting to the inverters trough the WAN and there is not guaranteed that ping would be allowed.
Btw I don't think the increased CPU load is caused by this integration. When i turn off the inverter. It does not happen. But I can be mistaken. That's why is crucial that you provide more info. :-)
Cheers!
from ha-solarman.
Tested and it does not log, so that's good. But it did not connect after sunrise. Could it be because I restarted after sunset. π€
All sensors are now unavailable.And what if you enable debug log? And let it run "over night" how does the log look like in the morning?
Enabled debug and let it run over night. This time it worked/started after the inverter came online. The only difference now is that debugging is enabled and I restarted while the inverter was online.
Try it one more time then. But without touching the inverter if possible...
Debug enabled/disable should really don't have any impact on the inner workings it just simply show some more massages in the flow along the way I don't do there any flow changes based on debugging...
If I recall correctly this happened once before also with the original version. So I guess it's not related to this issue that silences the logging.
from ha-solarman.
Yeah sure I was just wondering if this changes did not somehow broke the "coming up" after night off. Cause what could happen is that logging of the messages can slow down that reconnecting intervals and thus without logging them the integration could just do it more frequently. But that's just shooting in the dark again.
I'll try playing with turning off the inverter tonight and I'll see what comes from it.
from ha-solarman.
Yes good. So installed this addon again. First night was everything good with cpu usage. Second night, today, cpu again growing up, few minutes log is huge. Graph cpu usage with this addon and next few minutes with uninstaled addon.
File "/config/custom_components/solarman/api.py", line 64, in _send_receive_v5_frame await self.writer.drain() File "/usr/local/lib/python3.12/asyncio/streams.py", line 380, in drain raise exc File "/config/custom_components/solarman/api.py", line 181, in async_get await self.async_read(params, code, start, end) File "/config/custom_components/solarman/api.py", line 116, in async_read response = await self.read_holding_registers(register_addr = start, quantity = length) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pysolarmanv5/pysolarmanv5_async.py", line 283, in read_holding_registers modbus_values = await self._get_modbus_response(mb_request_frame) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pysolarmanv5/pysolarmanv5_async.py", line 246, in _get_modbus_response mb_response_frame = await self._send_receive_modbus_frame(mb_request_frame) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pysolarmanv5/pysolarmanv5_async.py", line 233, in _send_receive_modbus_frame v5_response_frame = await self._send_receive_v5_frame(v5_request_frame) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/solarman/api.py", line 64, in _send_receive_v5_frame await self.writer.drain() File "/usr/local/lib/python3.12/asyncio/streams.py", line 380, in drain raise exc File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 312, in _async_refresh self.data = await self._async_update_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/solarman/coordinator.py", line 33, in _async_update_data return await self.inverter.async_get(self._accounting()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/solarman/api.py", line 207, in async_get await self.async_get_failed(f"Querying {self.serial} at {self.address}:{self.port} failed. [{format_exception(e)}]") File "/config/custom_components/solarman/api.py", line 155, in async_get_failed await self.async_disconnect() File "/config/custom_components/solarman/api.py", line 107, in async_disconnect await self.writer.wait_closed() File "/usr/local/lib/python3.12/asyncio/streams.py", line 364, in wait_closed await self._protocol._get_close_waiter(self) OSError: [Errno 113] Host is unreachable 2024-07-22 22:15:03.766 WARNING (MainThread) [custom_components.solarman.api] Querying (0 - 39) failed. #0 [OSError: [Errno 113] Host is unreachable]
from ha-solarman.
I will really need whole log with debug enabled (It can even be just enabled when this happens for few minutes not whole time) cause I'm really not able to replicate it in my setup.
Don't forget to obfuscate serial number.
Edit: Did you installed it manually or through HACS?
Cheers!
from ha-solarman.
The more I think about this the more I believe this is not the way to go. Suppressing warnings/errors is never a good idea as when an inverter is off-line with a genuine problem then it will be masked. There is no way of knowing whether an inverter is down because of a fault or because it's turned off. Either way a fault log should be raised.
Can I suggest a much easier and cleaner way to achieve this and that is to provide a control input to the integration. This is a simple run/stop control that can then be used by a HA automation to stop the inverter at sunset and then start at sunrise. An automation to trigger at sunrise and sunset is extremely simple to do.
from ha-solarman.
The more I think about this the more I believe this is not the way to go. Suppressing warnings/errors is never a good idea as when an inverter is off-line with a genuine problem then it will be masked. There is no way of knowing whether an inverter is down because of a fault or because it's turned off. Either way a fault log should be raised.
Can I suggest a much easier and cleaner way to achieve this and that is to provide a control input to the integration. This is a simple run/stop control that can then be used by a HA automation to stop the inverter at sunset and then start at sunrise. An automation to trigger at sunrise and sunset is extremely simple to do.
Yeah the thing is I don't know about simple way how to accomplish this.. Even HA itself does not have feature like this. You just simply can't turn integration on/off on demand...
from ha-solarman.
And I'm not really hiding it. I'm just masking it as a TimeoutError which should in theory raise but not so much.
from ha-solarman.
For my part it has worked really great now. It has connected again two mornings in a row. So I still have no debug logs when it fails in the morning.
No worries, just post it here when it happens. ;)
from ha-solarman.
Yeah the thing is I don't know about simple way how to accomplish this.. Even HA itself does not have feature like this. You just simply can't turn integration on/off on demand...
Fair do's. The Home Assistant recorder allows you enable disable recording via a service call. I also have an integration that allows you to change the polling interval from a service call, but have no idea how. If I find anything that looks useful I'll share the code.
I could also go back to my previous way of working with Stephans integration, we'll see how it goes.
https://www.home-assistant.io/common-tasks/general/
section: Defining a custom polling interval
from ha-solarman.
Yeah the thing is I don't know about simple way how to accomplish this.. Even HA itself does not have feature like this. You just simply can't turn integration on/off on demand...
Fair do's. The Home Assistant recorder allows you enable disable recording via a service call. I also have an integration that allows you to change the polling interval from a service call, but have no idea how. If I find anything that looks useful I'll share the code.
I could also go back to my previous way of working with Stephans integration, we'll see how it goes.
https://www.home-assistant.io/common-tasks/general/
section: Defining a custom polling interval
Yes I know about this one but if I understand it correctly this just tweaks it from HA side into DataUpdateCoordinator.data which is filled by polling interval defined in the integration.
So in short It doesn't change how often it tries to connect to the inverter.
But maybe I'm wrong...
I could try to add some conditional polling mechanism but I'm just worried that it would just overcomplicate things and only bring more issues...
Edit: lol so maybe it does turn off the polling completely, hah. I just tried it and was able to turn off the integration by that toggle. But I would promise that it did not work like that before, huh. So if is possible to toggle that polling from an automation it should be theoretically possible to turn the integration "off" like that.
from ha-solarman.
For my part it has worked really great now. It has connected again two mornings in a row. So I still have no debug logs when it fails in the morning.
No worries, just post it here when it happens. ;)
One thing though. The "Connection status" sensor says it is connected 3 days now, which is not true!
And all other sensors freezes, but should really be unavailable.
from ha-solarman.
For my part it has worked really great now. It has connected again two mornings in a row. So I still have no debug logs when it fails in the morning.
No worries, just post it here when it happens. ;)
One thing though. The "Connection status" sensor says it is connected 3 days now, which is not true!
And all other sensors freezes, but should really be unavailable.
Hmm that's bad! Could you maybe post log from a time when inverter goes offline? (a debug one)
A fifth TimeoutError should switch the integration into disconnected state. If that does not happen that's a bug then.
It would be really awesome if I could just try this whole flow with my installation but it just behaves for some reason so differently!
Don't forget to obfuscate!
from ha-solarman.
When the inverter is offline my logs are filled continuously with warning messages.
Edit from @davidrapan: Removed the log cause of an exposed serial. :P
from ha-solarman.
And what about connection state?
Edit: Also how does the log look like without debug enabled?
from ha-solarman.
Here we go, rather a lot of logging....
home-assistant_2024-07-24T21-03-15.464Z.log
from ha-solarman.
Mh, I'm really not sure what can be done with this one as it originates from [asyncio] π
from ha-solarman.
It also failed to make the connection when the inverter came back on line. I had to reload the config to get it to connect. Overnight there were quite a few logs.....
This error originated from a custom integration.
Logger: asyncio
Source: custom_components/solarman/api.py:63
integration: Solarman (documentation, issues)
First occurred: 24 July 2024 at 21:34:30 (4911 occurrences)
Last logged: 07:07:20
socket.send() raised exception.
from ha-solarman.
It just baffles me how on four installations it behaves in four different ways...
And the important part is Logger: asyncio, that mens it logs directly into log outside of my reach. The only way how to prevent it is to not trigger that exception I think...
I was some time ago making some PR into pysolarmanv5 lib we are using here so I can get rid of the changes I do in this integration. So will see when they release new version and I will be able to remove those forced changes!
from ha-solarman.
Not sure if this is worth a look?
StephanJoubert/home_assistant_solarman#535
from ha-solarman.
That's basically what I did. Logging suppression. But Stephan is using synchronous flow so very different approach and sadly it won't help in any way in our asynchronous implementation. As the "socket.send() raised exception" exception comes from asyncio library which is not present in Stephans integration.
from ha-solarman.
It also failed to make the connection when the inverter came back on line. I had to reload the config to get it to connect. Overnight there were quite a few logs.....
This error originated from a custom integration. Logger: asyncio Source: custom_components/solarman/api.py:63 integration: Solarman (documentation, issues) First occurred: 24 July 2024 at 21:34:30 (4911 occurrences) Last logged: 07:07:20 socket.send() raised exception.
Does it also stop writing into logs then? Cause it would not make any sense otherwise...
from ha-solarman.
No, still writing into the logs but didn't pick up that the inverter was on-line π
To be honest there's been several changes to my system over the last few days so I need to let it run for a few days and get a true picture of what's happening. The inverter going off-line also generates a problem if HA is restarted when it's dark as the integration can't initialise and fails, no idea whether it will recover from this when the inverter comes back on-line? It's hard to test when you only have one shutdown event per day...
from ha-solarman.
No, still writing into the logs but didn't pick up that the inverter was on-line π
That is really strange... cause according to the logs it follows the proper flow of disconnecting and reconnecting... It's not like it's stuck or something... can you maybe try to also look at what wireshark shows during that time? If it sends packets?
It's hard to test when you only have one shutdown event per day...
Yeah exactly. It's the same with trying to guess how to mitigate this by shooting in the dark as I really don't know how to test this scenarios... My inverter runs 24/7 and every try to turn it off or even just interfere with the connection behaves very differently than what you guys describing :(
One of my latest attempts to help you guys out was to add clearing of the variables handling the reading and writing into the socket cause I thought that maybe because they are still holding an instances after disconnect flow and consecutive try to connect fails then maybe the socket.send() exception was cause of that... But it is yet another shot in the dark...
from ha-solarman.
My automation failed to work. It successfully turned off polling and no errors reported however, when polling was enabled in the morning it failed to get a data although did seem to start trying to reconnect. Reloading the integration immediately connected and restored the data flow...
Polling was enabled at 5:07 and debug turned on for a bit from 7.29....
home-assistant_solarman_2024-07-27T06-30-42.075Z.log
PS. I'm also debugging another integration so ignore the other errors...
from ha-solarman.
Whoops seems to be a coding issue. You can replicate by going to system options and disable polling. Needed a reboot to recover.
home-assistant_solarman_2024-07-28T06-00-49.451Z.log
from ha-solarman.
Updated to 24.07.28 and worked fine again overnight with the Polling Enable/Disable. I'll disable to the automation tonight and see how it behaves going off-line without changing the polling state. Interestingly after disabling the polling the logs indicate that the integration still reconnects to the inverter and then goes off-line but the Connection State sensor still says connected. Probably now a low priority but here are the debug logs around the events.
home-assistant_solarman_2024-07-30T05-57-19.308Z.log
from ha-solarman.
Yeah it proly won't change state on its own cause it's stateless as it needs to fail to connect first and then it will change connection state.
Edit: And the most important factor is that it needs coordinator (polling) running to even change the state of the sensor which tells you the Connection State...
from ha-solarman.
@Floppe can I have little OT question? What definition profile file are you using with your device? (For Supported inverters in Wiki)
And also you @gedger, what combination of device model (full model name/number please) and definition file are you running?
When comes to the feature of enable/disable of polling directly in the integration I'm all for it if we find an elegant solution, but I would also find a nice and workable solution even without it... I think we are getting there.
from ha-solarman.
@Floppe can I have little OT question? What definition profile file are you using with your device? (For Supported inverters in Wiki)
And also you @gedger, what combination of device model (full model name/number please) and definition file are you running?
When comes to the feature of enable/disable of polling directly in the integration I'm all for it if we find an elegant solution, but I would also find a nice and workable solution even without it... I think we are getting there.
Hello. I'm using this one.
https://gist.github.com/Floppe/83365483954d8bcee8d8854eeb3fa818
from ha-solarman.
Is it based on any particular one which is in this repo or it's totally different?
from ha-solarman.
Sure, the inverter is a Solis-1P8K-5G Inverter. I now have the official Modbus spec. from Solis but it's generic and not all Modbus registers work on all Inverters which means you still have to try and see if it works.
https://www.solisinverters.com/global/1p_inverter4/34588.html
The repro config file for my inverter solis_1p8k-5g.yaml currently has an issue in that the parameters: section has been offset one to the right so doesn't work plus there is an incorrect section which I've removed.
I haven't submitted an update yet as there is still some odd timing issues I'm trying to get to the root cause of. I'll raise an another issue rather than pollute this thread....
I did have some odd messages this morning when polling was enabled.
home-assistant_2024-08-01T07-18-23.697Z.log
from ha-solarman.
Is it based on any particular one which is in this repo or it's totally different?
Uhm, I think it's done from scratch in August 2022. Don't remember, but I did look up the specs and entered the registries myself.
from ha-solarman.
So would you maybe mind to add it here then? :) for others.
from ha-solarman.
And how you have setup the going offline flow? I mentioning it cause of the connection state indication.
from ha-solarman.
The connection state remains connected. I presume the integration makes the connection after polling has been disabled and then never uses the connection to discover whether it's online or not?
Here's a couple of graphs of the connection and update interval when polling is enabled and then disable. You can see a brief unavailable on the connection whilst the integration reloads.
from ha-solarman.
I presume the integration makes the connection after polling has been disabled and then never uses the connection to discover whether it's online or not?
Exactly. You would have to wait for the integration to discover that device is offline and then disable polling. For it to show correct state.
What is proly happening is that class which handles api connections have status = -1 thus disconnected. But by disabling polling HA never refreshes the connection state sensor to load that state and just displays cached value.
I'll try that Spook thing when I'll have some spare time and I'll look what is integration doing when is spook used to disabled the polling.
Edit: So yeah I just confirmed my theory. You are not just disabling the actual connection to the inverter but also update of the entity values thus it never shows disconnect afterwards.
from ha-solarman.
Edit: So yeah I just confirmed my theory. You are not just disabling the actual connection to the inverter but also update of the entity values thus it never shows disconnect afterwards.
I guess a better solution would be have a service call or a boolean sensor on the integration to enable/disable. That way when disabled it can disconnect cleanly and sleep until such time as it's enabled again....
from ha-solarman.
If you then after call this service over connection state it should change the state to disconnected π:
service: homeassistant.update_entity
data: {}
target:
entity_id: sensor.inverter_connection_status
from ha-solarman.
There is an edge case issue, if HA is restarted during the hours of darkness with polling disabled then it raises an error some 2 hours later. Re-enabling the polling in the morning did not fix but doing a complete reload did.
home-assistant_solarman_2024-08-06T06-55-54.397Z.log
from ha-solarman.
Ou, I have no idea what that could mean :-/ I'll try to investigate.
from ha-solarman.
Will switch over and report back.
For info I have been running the last few days without turning the polling off to see how things behave with 24.08.04. We do get a single error report when the inverter goes off-line.
2024-08-07 21:13:21.743 ERROR (MainThread) [custom_components.solarman.coordinator] Timeout fetching Solis data
When coming on-line in the morning then if it's a clear sunny morning then there's no report (*1) the inverter just comes on line. However, if it's a dull morning the inverter seems to come on-line for a connection but not enough to deal with solarman requests. However, I stupidly overwrote the log so I was waiting for it to happen again....doh!
*1 - Interestingly monitoring the inverter working status it does flag that it's going into standby before shutting down. When waking up in the morning the update_interval reports the time when the last update occurred π The connection status doesn't change. Here's the graph for info.
from ha-solarman.
2024-08-07 21:13:21.743 ERROR (MainThread) [custom_components.solarman.coordinator] Timeout fetching Solis data
When coming on-line in the morning then if it's a clear sunny morning then there's no report (*1) the inverter just comes on line.
Wow, that's the kind of a behavior I was trying to achieve!
update_interval reports the time when the last update occurred π
It's not a bug but a feature! π
The connection status doesn't change. Here's the graph for info.
Exactly. Those recent changes are more or less mainly about proper state reporting (Connected/Disconnected) and properly set all entities into Unavailable state when Disconnected.
from ha-solarman.
I can't speak for other inverters but when mine goes into standby all the reported values are set to zero before it shuts down. Although reporting zero is incorrect as it is technically it is off-line or unavailable, zero looks better on the HA GUI but I can live with the more correct unavailable.
Thanks for your continued effort on this and I'll report back in a couple of days or sooner if something is obviously not working.
from ha-solarman.
First feedback, works but is raising a few more errors. In particular I haven't seen the connection refused error before.
home-assistant_2024-08-09T12-07-41.618Z.log
from ha-solarman.
Yeah it has to sometime tell you that though otherwise you wouldn't know when something goes wrong. But not sure why it prints also the traceback... :-/
from ha-solarman.
2nd day with nice clean shutdown, one error logged which is great. However, coming back on-line is very messy....
home-assistant_2024-08-10T08-08-48.539Z.log
PS. The new passthrough option needs a default value assigned on the configuration form as it won't let you save without enabling and then disabling...
from ha-solarman.
log for the last 24 hours
home-assistant_2024-08-11T07-21-41.731Z.log
from ha-solarman.
fix: Silencing Errno 111 during reconnects
from ha-solarman.
So would you maybe mind to add it here then? :) for others.
I don't mind. Glad to help others, so please add it. Someone have changed start end registries last in the gist, but me myself have not tested that version.
I've been on vacation, but now I pulled latest changes from git and restarted. Also created a pull request for the inverter definition file.
from ha-solarman.
Having now monitored this for a few days I think this issue can be closed. I get one message when the inverter shuts down and 2 messages when it wakes up which is about as clean as you can get without implementing #72
2024-08-16 21:01:13.307 ERROR (MainThread) [custom_components.solarman.coordinator] Error fetching Solis data: [4065021742] Querying 192.168.1.40:8899 failed.
2024-08-17 05:46:45.321 ERROR (MainThread) [custom_components.solarman.coordinator] Error fetching Solis data: [4065021742] Querying 192.168.1.40:8899 failed.
2024-08-17 05:48:37.289 ERROR (MainThread) [custom_components.solarman.coordinator] Error fetching Solis data: [4065021742] Querying 192.168.1.40:8899 failed.
from ha-solarman.
Sure think! It's getting long here anyway!
So guys, let me know if anything changes in the future.
from ha-solarman.
Related Issues (20)
- Today and total loss sensors show non-monotonic growth HOT 2
- Production Values & Alert Entities not working anymore HOT 24
- Total Battery Life Cycles and Battery SOH show low/high values HOT 20
- Integration stays disconnected after the inverter goes back online HOT 1
- Deye Microinverter is sending the same data with update period of 60s or 5m HOT 73
- TOU settings with ME3000SP HOT 1
- Error setting up entry Sofar for solarman HOT 5
- Can we keep last known data after device disconnects? HOT 27
- v24.08.14 - Failed to Setup HOT 14
- The sensors do not update automatically HOT 8
- Update of data not working HOT 7
- 24.08.17 Connection Issue File __init__.py", line 70, in async_setup_entry HOT 9
- Exception when loading new kstar_hybrid profile HOT 2
- Solis Hybrid - Inverter configuration from integration (Moved from StephanJoubert's) HOT 161
- Ethernet Logger LSE-3: Failed to Setup HOT 9
- HA keeps restarting when Integration starts up with no active inverter HOT 2
- Energy Dashboard - Inverter Today's Production negative in the mornings HOT 13
- Error: Expected Bool when selecting configuration.YAML HOT 1
- Empty _attr_native_value throws ValueError HOT 3
- Battery SOH: Too many digits for Y-axis on sensor detail page HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ha-solarman.