aijayadams / hass-blueair Goto Github PK
View Code? Open in Web Editor NEWBlueAir sensor integration for HomeAssistant
BlueAir sensor integration for HomeAssistant
Hello! Thanks for your work on this! I noticed with the 411i Max and 311i Max there is a discrepancy between the fan speed reported in the Blueair app and the attribute reported in HA. For example, when the fan is running at full speed, it is shown as only 91% in HA.
Here is what I found:
App -> HA
0 -> 0
12 -> 11
16 -> 15
21 -> 19
25 -> 23
30 -> 27
34 -> 31
38 -> 35
43 -> 39
47 -> 43
52 -> 47
56 -> 51
60 -> 55
65 -> 59
69 -> 63
74 -> 67
78 -> 71
82 -> 75
87 -> 79
91 -> 83
96 -> 87
100 -> 91
Looks like this integration ran into the dreaded:
Detected integration that called async_setup_platforms instead of awaiting async_forward_entry_setups; this will fail in version 2023.3. Please report issue to the custom integration author for using this method at , line XXX: hass.config_entries.async_setup_platforms(entry, PLATFORMS)
message. :(
Now on HA version 2023.5.0 it fail to start with:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup
result = await component.async_setup_entry(hass, self)
File "/config/custom_components/blueair/init.py", line 50, in async_setup_entry
hass.config_entries.async_setup_platforms(entry, PLATFORMS)
AttributeError: 'ConfigEntries' object has no attribute 'async_setup_platforms'
When I try to turn on my BlueAir Classic 205 and 405, I got this error
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 238, in handle_call_service
response = await hass.services.async_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2067, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2104, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 272, in handle_service
return await service.entity_service_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 878, in entity_service_call
single_response = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 948, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/fan/__init__.py", line 305, in async_handle_turn_on_service
await self.async_turn_on(percentage, preset_mode, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: BlueairFan.async_turn_on() takes 1 positional argument but 3 were given```
However, I can turn off both of them though.
File "/usr/local/lib/python3.12/site-packages/requests/adapters.py", line 517, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='api.blueair.io', port=443): Max retries exceeded with url: /v2/user/[email protected] /homehost/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1000)')))
closed
Hey Folks,
I have HAOS installed under Virtualbox and one of the integrations is to my BlueAir 480i. Until about a few hours ago, it's been great.
I just recently (as in a few hours ago) updated from 2023.2.1 to 2023.2.2. About the same time I noticed that my sensor information wasn't updating with new detail (happens occasionally and I need to restart the device - meh) but I believe the updates stopped coming in from before the update to HAOS.
After restarting both HAOS and the 480i, the integration didn't continue like it normally does. Instead, I got an error about the entity being unavailable. I've since tried to remove and re-add the device but I'm getting the below error showing an SSL Verification error when trying to add my device back and a similar one appears from before I removed the device:
This error originated from a custom integration.
Logger: homeassistant.config_entries
Source: custom_components/blueair/blueair/blueair.py:81
Integration: BlueAir (documentation, issues)
First occurred: 10:38:43 AM (2 occurrences)
Last logged: 12:12:04 PM
Error setting up entry BlueAir [redacted] for blueair
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 386, in _make_request
self._validate_conn(conn)
File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 1042, in _validate_conn
conn.connect()
File "/usr/local/lib/python3.10/site-packages/urllib3/connection.py", line 414, in connect
self.sock = ssl_wrap_socket(
File "/usr/local/lib/python3.10/site-packages/urllib3/util/ssl_.py", line 449, in ssl_wrap_socket
ssl_sock = _ssl_wrap_socket_impl(
File "/usr/local/lib/python3.10/site-packages/urllib3/util/ssl_.py", line 493, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
File "/usr/local/lib/python3.10/ssl.py", line 513, in wrap_socket
return self.sslsocket_class._create(
File "/usr/local/lib/python3.10/ssl.py", line 1071, in _create
self.do_handshake()
File "/usr/local/lib/python3.10/ssl.py", line 1342, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 489, in send
resp = conn.urlopen(
File "/usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py", line 787, in urlopen
retries = retries.increment(
File "/usr/local/lib/python3.10/site-packages/urllib3/util/retry.py", line 592, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.blueair.io', port=443): Max retries exceeded with url: /v2/user/[redacted]/homehost/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 382, in async_setup
result = await component.async_setup_entry(hass, self)
File "/config/custom_components/blueair/__init__.py", line 28, in async_setup_entry
client = await hass.async_add_executor_job(
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/blueair/__init__.py", line 29, in <lambda>
lambda: blueair.BlueAir(
File "/config/custom_components/blueair/blueair/blueair.py", line 66, in __init__
self.home_host = self.get_home_host()
File "/config/custom_components/blueair/blueair/blueair.py", line 81, in get_home_host
response = requests.get(
File "/usr/local/lib/python3.10/site-packages/requests/api.py", line 73, in get
return request("get", url, params=params, **kwargs)
File "/usr/local/lib/python3.10/site-packages/requests/api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.10/site-packages/requests/sessions.py", line 701, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.10/site-packages/requests/adapters.py", line 563, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='api.blueair.io', port=443): Max retries exceeded with url: /v2/user/[redacted]/homehost/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')))
Something worthy of note is that if you access the URL yourself ( https://api.blueair.io/v2/user/[redacted]/homehost/ ) and look at the SSL certificate, it looks like it was created four days ago. Is this addon doing certificate pinning? If so it might need an update. Otherwise, I'm open to suggestions to get HA to talk to the BlueAir API again.
Meep
hi, i get this issue when i try and set my integration up, nyome know why? Thanks!
This error originated from a custom integration.
Logger: homeassistant.config_entries
Source: custom_components/blueair/init.py:50
Integration: BlueAir (documentation, issues)
First occurred: 7:31:00 PM (1 occurrences)
Last logged: 7:31:00 PM
Error setting up entry BlueAir
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup
result = await component.async_setup_entry(hass, self)
File "/config/custom_components/blueair/init.py", line 50, in async_setup_entry
hass.config_entries.async_setup_platforms(entry, PLATFORMS)
AttributeError: 'ConfigEntries' object has no attribute 'async_setup_platforms'
just tried the integration and no devices/entities showed up.
For what it is worth, there has been significant work on the models not supported in HA in the HomeKit plugin. See this issue where they dissected the API. This is only an FYI in case you can benefit from the work they have already done.
Support switching between manual and automatic fan speed mode.
I have a few dustmagnets and am happy to provide whatever API responses you need to add support.
The units are missing from the air quality sensors. This causes the resulting sensors to be charted like attribute data instead of numeric data.
There are a bunch of attributes returned from the API which we are not exposing, these include filter status, wifi status which strike me as immediately useful.
self._device_information:
{'brightness': '4',
'child_lock': '0',
'fan_speed': '2',
'fan_usage': '8;4;6561;0;6565;45275',
'filterType': 'row',
'filter_status': 'OK',
'mode': 'manual',
'wifi_status': '1'}
self._attributes:
{'uuid': 'XXXX',
'name': 'Office',
'timezone': 'America/Los_Angeles',
'compatibility': 'classic_280i',
'model': '1.0.9',
'mac': '98D863XXXXXX',
'firmware': '1.1.38',
'mcuFirmware': '1.0.35',
'wlanDriver': 'V10',
'lastSyncDate': 1631550455,
'installationDate': 1600350827,
'lastCalibrationDate': 1600350827,
'initUsagePeriod': 25629788,
'rebootPeriod': 10975,
'aimSerialNumber': 'S0000000000',
'aimUpdateDate': 1600350827,
'roomLocation': 'office'}
```
Thanks for this integration. I'd like to have the BlueAir turn on higher based on air sensor readings. However, the automation UI doesn't show fan speed, just on/off control. This matches what is seen in the UI:
However, it does look like the speed is available in the entity detail:
Ideally, the fan speed would also show for the device controls
Thanks again
Hi, thanks for sharing this project, I love it!
I purchased 2 blueair HealthProtect 7440i in China. How can I use the ha plug-in and add it? ?
I'm using a plugin and can't view the entities after logging in,
`git clone [email protected]:aijayadams/hass-blueair.git
Cloning into 'hass-blueair'...
The authenticity of host 'github.com (20.205.243.166)' can't be established.
ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'github.com' (ED25519) to the list of known hosts.
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
`
Just wants to inform you that I've tested with both of my Classic 205 and 405 non i model (No sensor and auto mode). All of them are unsupported. All entities shown as unavailable.
Integration stopped working after update.
This error originated from a custom integration.
Logger: homeassistant.config_entries
Source: custom_components/Blueair/init.py:50
Integration: Blueair
First occurred: 16:31:04 (3 occurrences)
Last logged: 18:11:25
Error setting up entry BlueAir [email protected] for blueair
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup
result = await component.async_setup_entry(hass, self)
File "/config/custom_components/Blueair/init.py", line 50, in async_setup_entry
hass.config_entries.async_setup_platforms(entry, PLATFORMS)
AttributeError: 'ConfigEntries' object has no attribute 'async_setup_platforms'
Home Assistant 2023.5.4
Supervisor 2023.04.1
Operating System 10.1
Frontend 20230503.3 - latest
In a configuration where there are no air quality sensors (only an air filter is registered), the component raises an exception during initialization:
2021-07-28 23:40:04 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up blueair platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 250, in _async_setup_platform
await asyncio.shield(task)
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/blueair/sensor.py", line 23, in setup_platform
BlueAirFilter(config=config, uuid=dev["uuid"], name=dev["name"], api=api)
File "/config/custom_components/blueair/sensor.py", line 41, in __init__
self.update()
File "/config/custom_components/blueair/sensor.py", line 67, in update
self._ba_attrs = self._api.get_current_data_point(self._ba_uuid)
File "/config/custom_components/blueair/blueair/blueair.py", line 185, in get_current_data_point
return results[-1]
IndexError: list index out of range
Call to the API returns the following record: {'uuid': <uuid>, 'start': 0, 'end': 0, 'sensors': ['time', 'pm', 'tmp', 'hum', 'co2', 'voc', 'allpollu'], 'units': ['s', 'ugm3', 'C', 'pc', 'ppm', 'ppb', '%'], 'datapoints': []}
results
variable returned by transform_data_point
is an empty list.
blueair
command from the blueair
python package returns the following list of device attributes:
auto_mode_dependency: pm
brightness: 4
child_lock: 0
fan_speed: 0
fan_usage: 2271;158;14196;269;14624;37216
filter_status: OK
mode: manual
wifi_status: 1
Hi does this integration support the smaller air purifiers? Specifically I’m looking at the Blue Pure 411i Max.
Thank you!
I have a three of the Protect 7470i and am happy to provide whatever API responses you need to add support.
I have noticed in the Home Assistant system logs that my blueair VOC sensor shows up because the units are ppb instead of µg/m³. The log entries look like this:
Entity sensor.blueair_office_voc (<class 'custom_components.blueair.sensor.BlueairVOCSensor'>) is using native unit of measurement 'ppb' which is not a valid unit for the device class ('volatile_organic_compounds') it is using; expected one of ['µg/m³']; Please update your configuration if your entity is manually configured, otherwise report it to the custom integration author.
I have had this same warning on a few ESPHome devices that I created with a ccs811 sensor and I fixed those by assigning the device_class
to volatile_organic_compound_parts
(which allows for ppm or ppb units) instead of the default: volatile_organic_compound
(which only has the µg/m³ units).
See the valid Home Assistant device_classes here: https://www.home-assistant.io/integrations/sensor/
I don't know the answer, so please don't interpret the question as being opposed to the correct units, I just noticed that there is some translation to ascii happening in other components and couldn't quickly find guidance on the homeassistant developer page.
eg, µg/m³ becomes u0xb5g_per_mu0xb3 on export through the Prometheus integration (presumably because on the Prometheus side the Unicode characters arn't supported?)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.