Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Device does not update if you make change outside of HA #81

Closed
bsaunder opened this issue Nov 3, 2024 · 11 comments · Fixed by #82
Closed

Device does not update if you make change outside of HA #81

bsaunder opened this issue Nov 3, 2024 · 11 comments · Fixed by #82
Labels
bug Something isn't working

Comments

@bsaunder
Copy link

bsaunder commented Nov 3, 2024

Describe the bug
If you use either the AC Infinity Mobile app, or the Controller directly to change the speed/mode/etc... those changes are not reflected on the device in HA.

To Reproduce
Steps to reproduce the behavior:

  1. Turn on Fan in HA
  2. Verify Fan Turns on to correct speed
  3. Turn off Fan from Controller or AC Infinity mobile app
  4. Verify Fan turns Off
  5. See that "Active Mode" in HA is still set to On.
  6. What 1 Minute (to ensure there is time for the API to Poll)
  7. See that "Active Mode" in HA is still set to On.

Expected behavior
Changing the state outside of HA will sync to and update the device in HA, so that you can still utilize the mobile app and/or physical controller if needed.

Desktop (please complete the following information):

  • OS: Win 11
  • Browser: Chrome

Smartphone (please complete the following information):

  • Device: iPhone 16 Pro Max
  • OS: iOS 18

Additional context
CLOUDLINE PRO T4 with Controller 69 Pro+
Homeassistant 2024.10.4

@bsaunder
Copy link
Author

bsaunder commented Nov 3, 2024

May or may not be related, but any time I change a setting on the Device page for the fan I get an error at the bottom of the page, I looked in the logs, and this is what is being logged.

Logger: homeassistant
Source: custom_components/ac_infinity/select.py:106
integration: AC Infinity (documentation, issues)
First occurred: 9:11:58 PM (264 occurrences)
Last logged: 9:59:40 PM

Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1534, in _async_process_registry_update_or_remove
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1005, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1130, in _async_write_ha_state
self.__async_calculate_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1067, in __async_calculate_state
state = self._stringify_state(available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1011, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/select/init.py", line 145, in state
current_option = self.current_option
^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/ac_infinity/select.py", line 303, in current_option
return self.entity_description.get_value_fn(self, self.port)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/ac_infinity/select.py", line 106, in __get_value_fn_setting_mode
return SETTINGS_MODE_OPTIONS[
^^^^^^^^^^^^^^^^^^^^^^
TypeError: list indices must be integers or slices, not NoneType

@dalinicus
Copy link
Owner

Looks related; looks like its trying to update the Mode selector control, but instead of an integer it got null. I did notice there's a new firmware update that I haven't gotten around to installing yet. I wonder if AC Infinity shook up the data structure a bit.

I'll take a look. Can you confirm for me if you're on the latest firmware for your controller?

@dalinicus
Copy link
Owner

I can't reproduce it, but I think I see the issue based on your logs.

@bsaunder
Copy link
Author

bsaunder commented Nov 3, 2024

Yes, its on the latest Firmware. I just installed it all yesterday and the first thing it did was install a Firmware update. Its on F3.2.56

@dalinicus
Copy link
Owner

This should be fixed in 1.8.0. Let me know if you still have issues and we can continue to troubleshoot.

@bsaunder
Copy link
Author

bsaunder commented Nov 4, 2024

Still getting the same behavior after updating to 1.8.0 of the integration, but a slightly different error in the log.

If I go into the Device and set the Active Mode to On, the Fan will turn On, but then I get an error that says "TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'" at the bottom of the page, Log says:

`
Logger: homeassistant
Source: custom_components/ac_infinity/number.py:175
integration: AC Infinity (documentation, issues)
First occurred: 5:01:31 PM (724 occurrences)
Last logged: 7:03:33 PM

Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 258, in _handle_refresh_interval
await self._async_refresh(log_failures=True, scheduled=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 453, in _async_refresh
self.async_update_listeners()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 168, in async_update_listeners
update_callback()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 533, in _handle_coordinator_update
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1005, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1130, in _async_write_ha_state
self.__async_calculate_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1067, in __async_calculate_state
state = self._stringify_state(available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1011, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/number/init.py", line 359, in state
return self.value
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/number/init.py", line 398, in value
if (native_value := self.native_value) is None:
^^^^^^^^^^^^^^^^^
File "/config/custom_components/ac_infinity/number.py", line 751, in native_value
return self.entity_description.get_value_fn(self, self.port)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/ac_infinity/number.py", line 175, in __get_value_fn_vpd_control
entity.ac_infinity.get_port_control(
TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'
`

And changing anything in the App or on the Controller directly still shows no updates on the device in HA. It will stay on whatever state you last set it to in HA, regardless of if that is the actual state or not.

@dalinicus dalinicus reopened this Nov 4, 2024
@dalinicus
Copy link
Owner

Yeah you're failing during the update call, so I would expect stuff to get out of sync. Looks like we fixed the bug and the select boxes, but you failed later on when the number entities tried to update. Appears to be another enum lookup with a null value.

Might have to update my tests to run through every module testing for Nones.

@dalinicus
Copy link
Owner

Can you give 1.8.1 a go and see if your logs change?

@bsaunder
Copy link
Author

bsaunder commented Nov 5, 2024

Looks like that has resolved it. Just tested it and got no errors in Home Assistant and changing the speed or turning the fan on/off from HA reflects on the Controller and in the mobile app, and vica versa.

@almighty059
Copy link

Mine is working fine as well.

@dalinicus
Copy link
Owner

Awesome. Thanks y'all :) Let me know if you run into anything else.

@dalinicus dalinicus added the bug Something isn't working label Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants