DeerMaximum / Technische-Alternative-CoE

Custom Home Assistant integration to read data from a C.M.I. via CoE
MIT License
11 stars 2 forks source link

Data cannot be shown by the Integration #60

Closed dbuchber closed 5 months ago

dbuchber commented 5 months ago

Version of the custom_component

CoE to HTTP server Current version: 2.1.0 (Änderungsprotokoll)

read Values from C.M.I v1.4.0

Describe the bug

After upgrading to CoE_v2 the integration doesn't detect any sensors at all. The connection to CoE works, the server running on HA is shown properly in the CMI CAN overview. The values are being received properly, but the Technische Alternative CoE Integration can't show/access them. I also tried to use v1 instead, but it wont work again.

Nevertheless: Big thanks for your great work, the previous version was such a smooth way to monitor and control the TA-Hardware.

Debug log

2024-04-16 13:33:22.633 DEBUG (MainThread) [custom_components.ta_coe] Update all states 2024-04-16 13:33:22.633 DEBUG (MainThread) [custom_components.ta_coe] Send all 0 values to server 2024-04-16 13:33:22.636 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry CoE for ta_coe Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 551, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/ta_coe/init.py", line 70, in async_setup_entry await observer.get_all_states() File "/config/custom_components/ta_coe/state_observer.py", line 83, in get_all_states await self._sender.update() File "/config/custom_components/ta_coe/state_sender.py", line 173, in update await self._coe.send_analog_values( File "/usr/local/lib/python3.12/site-packages/ta_cmi/coe.py", line 102, in send_analog_values await self._api.send_analog_values(data, page) File "/usr/local/lib/python3.12/site-packages/ta_cmi/coe_api.py", line 119, in send_analog_values await self._make_request_post(url, data) File "/usr/local/lib/python3.12/site-packages/ta_cmi/api.py", line 36, in _make_request_post await self._make_request_no_json(url, method="POST", body=body) File "/usr/local/lib/python3.12/site-packages/ta_cmi/api.py", line 56, in _make_request_no_json raise ApiError( ta_cmi.api.ApiError: Invalid response from a824d5a9-ta-coe: 409

CoE_Server: 16.04.24-13:59:41 DEBUG coeserver_v1(44): Received new CAN-Message: b'\n\x03\xf6\x02\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00' 16.04.24-13:59:41 DEBUG coeserver_v1(48): Parsed message: Analog(Node: 10, Page: 3, IP: 192.168.8.130, Content: ((75.8, 1), (0.0, 0), (0.0, 0), (0.0, 0)))

DeerMaximum commented 5 months ago

Can you send me the debug logs with this configuration? This also activates the debug logs for the Python library used.

logger:
  default: info
  logs:
    custom_components.ta_coe: debug
    ta_cmi: debug
dbuchber commented 5 months ago

Yes of course, give me a couple of minutes and i will send them to you.

dbuchber commented 5 months ago

Is that what it should look like, if I added the logger to my configuration yaml?

2024-04-17 17:28:55.597 DEBUG (MainThread) [custom_components.ta_coe] Try to stop refresh task 2024-04-17 17:28:55.600 DEBUG (MainThread) [custom_components.ta_coe] Used update interval: 0:01:00 2024-04-17 17:28:55.600 DEBUG (MainThread) [custom_components.ta_coe] Try to update CoE 2024-04-17 17:28:55.619 DEBUG (MainThread) [custom_components.ta_coe] Finished fetching ta_coe data in 0.019 seconds (success: True) 2024-04-17 17:28:55.620 DEBUG (MainThread) [custom_components.ta_coe] Update all states 2024-04-17 17:28:55.620 DEBUG (MainThread) [custom_components.ta_coe] Send all 0 values to server 2024-04-17 17:28:55.649 DEBUG (MainThread) [custom_components.ta_coe] Try to start refresh task

DeerMaximum commented 5 months ago

Almost, there should also be lines like this:

2023-01-23 19:55:55.857 DEBUG (MainThread) [ta_cmi] Receive data from CoE server:
2023-01-23 19:55:55.857 DEBUG (MainThread) [ta_cmi] Receive current version from CoE server:
dbuchber commented 5 months ago

Must I install the CMI Integration too?

DeerMaximum commented 5 months ago

No, ta_cmi is the name of the Python library that is used for both integrations.

If it doesn't work with the logs, it's no big deal, I have a guess why the problem occurs. The integration is currently not fully compatible with CoE V2. This will be fixed in the next version. In the meantime, it should be sufficient if you use CoE V1 and also set the server addon to CoE V1.

dbuchber commented 5 months ago

Oh ok, thanks. But i tried switching back, but as mentioned in the first post, it won't work with the old version.

DeerMaximum commented 5 months ago

If you have made a backup of the addon before the upgrade, you can restore the old backup and downgrade the server until I have updated the integration.

dbuchber commented 5 months ago

Unfortunately I haven't made a backup. I'll just wait until the next update will be available. Again, thank you for your great effort :)