Ac infinity controller 67 Bluetooth temp, humidity, fan pwm

The 67 used to have to be told you want the data then the unit responds with that data

The 69 streams it automatically

@mikeybatoz For that python code you posted while back (ACI_UNI.py, etc.) was that only for the 69 and would it/does it work for the 67? Iā€™d like to try using it but unsure if itā€™s applicable. Also, are those the latest versions (ACI_UNI.py, manifest.json, fan.py, init.py) youā€™re using?

Iā€™ve played around with the other approach of using shell scripts to call bluetoothctl, but they are extremely variable - they might return a value 1/4 of the time (it doesnā€™t usually find the controller, select-attribute and ā€˜readā€™ may or may not display anything), I need to awk the 3rd record rather than the 2nd, and itā€™s the $17 and $18 that seem to equate to temp but even then I get values like ā€œ0x9b0fā€ which certainly arenā€™t centigrade temps! Hereā€™s an example run. Note that the first try produced little, but re-running it immediately produced more data. I believe itā€™s the ā€œ9f 0fā€ values that you indicate are temperature?

moa@sophie:~/scripts/acinfinity$ ./acinfinity_temp_humidity.sh | grep a5
[bluetooth]# write "0xa5 0x00 0x00 0x03 0x02 0xe1 0x7e 0x04 0x00 0x01 0x02 0x03 0x20 0x78 0xe9"
moa@sophie:~/scripts/acinfinity$ ./acinfinity_temp_humidity.sh | grep a5
        8ec90003-f315-4f60-9fb8-838830daea50
[ACI-UniversalController:/service001b/char001c]# write "0xa5 0x00 0x00 0x03 0x02 0xe1 0x7e 0x04 0x00 0x01 0x02 0x03 0x20 0x78 0xe9"
  a5 10 00 11 02 e1 57 5d 00 01 02 05 09 0a 9f 0f  ......W]........
  a5 10 00 11 02 e1 57 5d 00 01 02 05 09 0a 9f 0f  ......W]........
  a5 10 00 11 02 e1 57 5d 00 01 02 05 09 0a 9f 0f  ......W]........
moa@sophie:~/scripts/acinfinity$

So Iā€™d rather use python where I have a better method to deal with errors. Your (demo?) code seems to be all Iā€™ll need so Iā€™m just checking to see if itā€™s current and working for the 67.

Thanks!

Yes it worked for 67, it had an additional send command which made the system return its values

Hexadecimal values need to be changed

Latest version when the post was made, I donā€™t do updates on the system once itā€™s setup so it doesnā€™t throw errors from new programming

In this script youā€™ll notice you notify, that will allow the controller to recognize the system is going to ask for information. Next we ask attribute for the information after notifying other. This worked when we posted, Iā€™ve not changed anything on mine and still relaying information with this script

#!/usr/bin/expect -f

set prompt "#"
set address f0:74:59:49:c0:45
spawn bluetoothctl
expect -re $prompt
send "connect $address\r"
expect "Connection successful"
send "list-attributes\r"
send "menu gatt\r"
send "select-attribute /org/bluez/hci0/dev_F0_74_59_49_C0_45/service001b/char001e\r"
send "notify on\r"
send "select-attribute /org/bluez/hci0/dev_F0_74_59_49_C0_45/service001b/char001c\r"
send "write \"0xa5 0x00 0x00 0x03 0x03 0x49 0x79 0xd7 0x00 0x01 0x02 0x03 0x20 0x78 0xe9\"\r" 
send "select-attribute /org/bluez/hci0/dev_F0_74_59_49_C0_45/service001b/char001e\r"
send "read\r"
sleep 2
send "quit\r"
expect eof

I posted in the thread above, but since I donā€™t own a Controller 67, I could use some beta testers from here as well: GitHub - hunterjm/ac-infinity-hacs: Custom Integration for AC Infinity Controllers

just gave this a shot on a 67 and receive error after hitting submit (it does detect my unit ok)

2023-07-15 20:12:25.948 ERROR (MainThread) [custom_components.ac_infinity.config_flow] Unexpected error
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/ac_infinity_ble/device.py", line 159, in update
    await events[CallbackType.NOTIFICATION].wait()
  File "/usr/local/lib/python3.11/asyncio/locks.py", line 213, in wait
    await fut
asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/config/custom_components/ac_infinity/config_flow.py", line 66, in async_step_user
    await controller.update()
  File "/usr/local/lib/python3.11/site-packages/ac_infinity_ble/device.py", line 158, in update
    async with async_timeout.timeout(5):
  File "/usr/local/lib/python3.11/site-packages/async_timeout/__init__.py", line 129, in __aexit__
    self._do_exit(exc_type)
  File "/usr/local/lib/python3.11/site-packages/async_timeout/__init__.py", line 212, in _do_exit
    raise asyncio.TimeoutError
TimeoutError
2023-07-15 20:12:42.628 WARNING (MainThread) [ac_infinity_ble.device] A-EZNF4: Device unexpectedly disconnected; RSSI: -127
2023-07-15 20:12:42.630 WARNING (MainThread) [ac_infinity_ble.device] A-EZNF4: Device unexpectedly disconnected; RSSI: -127

Right, I think I saw somewhere that the 67 doesnā€™t send those notification messages. After sleeping on it, I donā€™t think we even need them, as we can get the fan speed, tmp, and hum from the advertisement packets and so only have to connect when changing the speed.

Can you enable debug level logging for ā€œac_infinity_bleā€ in your configuration? Iā€™d like to see what the device info response looks like.

Let me test that out and Iā€™ll let you know when I update.

Added

 logger:
   logs:
     custom_components.ac_infinity_ble: debug

to my logger, but not getting any extra output

The entry should just be:

logger:
   logs:
     ac_infinity_ble: debug

That being said, I just released v1.0.2 on HACS which should hopefully fix this issue. If itā€™s not showing, navigate to the integration and click the 3 dots on the top to choose ā€œredownloadā€.

1.0.2 is operational, nice work!

I did receive one error in the log


2023-07-16 08:20:20.898 DEBUG (MainThread) [ac_infinity_ble.device] A-EZNF4: Notification received: a5100004000434270003100012009e74
2023-07-16 08:20:20.899 ERROR (MainThread) [custom_components.ac_infinity] C9:E4:CE:B5:3B:BB: Failure while polling
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/bluetooth/active_update_coordinator.py", line 129, in _async_poll
    self.data = await self._async_poll_data(self._last_service_info)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/bluetooth/active_update_coordinator.py", line 122, in _async_poll_data
    return await self._poll_method(last_service_info)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/ac_infinity/coordinator.py", line 69, in _async_update
    await self.controller.update()
  File "/usr/local/lib/python3.11/site-packages/ac_infinity_ble/device.py", line 148, in update
    if data := await self._send_command(command):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/ac_infinity_ble/device.py", line 367, in _send_command
    return await self._send_command_while_connected(command, retry)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/ac_infinity_ble/device.py", line 386, in _send_command_while_connected
    return await self._send_command_locked(command)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/bleak_retry_connector/__init__.py", line 454, in _async_wrap_bluetooth_connection_error_retry
    return await func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/ac_infinity_ble/device.py", line 341, in _send_command_locked
    return await self._execute_command_locked(command)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/ac_infinity_ble/device.py", line 412, in _execute_command_locked
    assert self._client is not None  # nosec
           ^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError

Iā€™ll need to release a new version to fix that error. Iā€™ve been working on this for a while now though, so it may not be until tomorrow. Thank you for the logs! Does setting the fan speed work? (I noticed it takes a few seconds for it to reflect in HA after changing)

Yes fan speed works, but you are right that it doesnā€™t update all that quickly in the UI - seems great tho.

Appreciate all the work you have put into this, and all the research everyone else in the thread has provided. Sorry I had to bail out a few months ago, I didnā€™t have the time to dig in much further. Looks like we are well on a way to a complete solution tho!

Iā€™ll keep an eye on the thread, happy to test for you with this 67 unit.

Just jumping back in here after a month. I was waiting for some Bluetooth proxy dongles (Atom Lite) to arrive so that I could make sure the relatively weak BLE signal from the 67 controller would be seen by my Pi in the other room. Iā€™m still getting my head around how these proxy things are supposed to work ā€œtransparentlyā€ in HA, so Iā€™ll park those dongles for now.

In the meantime I installed the new ac infinity integration version 1.02 and it seems to work. I got a few errors that I just put down to the weak signal and the dropouts I was seeing when I last posted.
I then tried out changing fan speeds and for the most part this works, though it requires a bit of patience not just in the delay but in the confusion that happens if I change speeds too quickly. The log files fill up with noise so Iā€™ve now enabled debug logging and will record a few tests and post a link to the log files shortly.

Hereā€™s the logs. The sequence of activities was:

2023-07-30 21:12      HA freshly rebooted
2023-07-30 21:26      Speed changed to 5/50%
2023-07-30 21:31      Fan turned off
2023-07-30 21:33:58   Fan button pressed
2023-07-30 21:34:40   Fan speed slider: slid upwards; no feedback acknowledging action so I tried pressing fan button again; just then the speed slider indicated the previous attempt, showing 30%, but then the button press got acknowledged and the fan speed went to 0.

I was going to try plugging in a bluetooth USB dongle on the end of a USB cable to get a better signal, but that raises the question of how HA or the integration would know which bluetooth controller to use as thereā€™d now be 2 of them.