itchannel / apex-ha

Local Neptune Apex HA Integration (Aquarium Controller)
GNU General Public License v3.0
22 stars 3 forks source link

Firmware versions don't match, update doesn't work. #42

Closed ScrewLooseDan closed 1 year ago

ScrewLooseDan commented 1 year ago

Home Assistant is telling me there is an upgrade for the firmware:

Installed version 5.11L_6A23 Latest version 5.11_6A23

I'm not sure where the "L" comes from in the "Installed Version" as when I check in Fusion or the device itself, it shows:

Apex Operating System AOS Update This Apex is currently running the latest AOS.

Installed AOS 5.11 6A23

Available AOS 5.11 6A23

If I try to do the firmware upgrade through HA, I get a generic "failed to call service". Looking in the logs after that, shows:

Logger: homeassistant.components.websocket_api.http.connection Source: custom_components/apex/update.py:55 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: 3:54:12 PM (2 occurrences) Last logged: 3:54:45 PM

[140308371904704] Error while updating firmware Traceback (most recent call last): File "/config/custom_components/apex/update.py", line 53, in async_install await self.coordinator.apex.update_firmware() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/apex/apex.py", line 190, in update_firmware config = self.config() ^^^^^^^^^^^^^ File "/config/customcomponents/apex/apex.py", line 124, in config r = requests.get("http://" + self.deviceip + "/rest/config?=" + str(round(time.time())), headers=headers) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 73, in get return request("get", url, params=params, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 59, in request return session.request(method=method, url=url, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 589, in request resp = self.send(prep, send_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 703, in send r = adapter.send(request, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 486, in send resp = conn.urlopen( ^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 714, in urlopen httplib_response = self._make_request( ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 415, in _make_request conn.request(method, url, httplib_request_kw) File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 244, in request super(HTTPConnection, self).request(method, url, body=body, headers=headers) File "/usr/local/lib/python3.11/http/client.py", line 1286, in request self._send_request(method, url, body, headers, encode_chunked) File "/usr/local/lib/python3.11/http/client.py", line 1297, in _send_request self.putrequest(method, url, skips) File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 219, in putrequest return HTTPConnection.putrequest(self, method, url, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/util/async.py", line 166, in protected_loop_func checkloop(func, strict=strict) File "/usr/src/homeassistant/homeassistant/util/async.py", line 153, in check_loop raise RuntimeError( RuntimeError: Blocking calls must be done in the executor or a separate thread; Use await hass.async_add_executor_job(); at customcomponents/apex/apex.py, line 124: r = requests.get("http://" + self.deviceip + "/rest/config?=" + str(round(time.time())), headers=headers)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 226, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1974, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2011, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service return await service.entity_service_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 870, in entity_service_call response_data = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 942, in _handle_entity_call result = await task ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/update/init.py", line 157, in async_install await entity.async_install_with_progress(version, backup) File "/usr/src/homeassistant/homeassistant/components/update/init.py", line 421, in async_install_with_progress await self.async_install(version, backup) File "/config/custom_components/apex/update.py", line 55, in async_install raise HomeAssistantError("Error while updating firmware") homeassistant.exceptions.HomeAssistantError: Error while updating firmware

Edit: Should have included, running HA 2023.8.0, Apex HA Version 1.13.

itchannel commented 1 year ago

@ScrewLooseDan Thanks for the error output, makes my life a lot easier.

The update feature may have a few bugs as it's hard to test when my Apex only lets me update once :)

I can fix that executor error fairly easy, my concern is it reporting a weird version with an L in it. Could you please check what version is reported on the integration device page. I currently use the version inside the config json but wondering on certain models if it reports with a L for like Lite versions?

image

ScrewLooseDan commented 1 year ago

It is showing the "L" ApexInfo

I do see the "L" listed on the /cgi-bin/status.xml:

<status software="5.11L_6A23" hardware="1.0">

This is a A3 Apex Controller (not a Pro).

itchannel commented 1 year ago

Thanks. Could you also check on the "apex/config/network" on the actual Apex web interface itself and tell me what it says for the current version and installed version.

image

ScrewLooseDan commented 1 year ago

Yep, no "L" there (I included the text of that in my first post)

ApexAOS

itchannel commented 1 year ago

1.14 Should fix the version and update issues. Looking at the JavaScript on the Apex web interface they just strip out the "L".

ScrewLooseDan commented 1 year ago

Thank you very much for the quick fix! I deployed it and it shows as "Up-to-date".

I'll open another issue if there is an issue with the next update.