GithubHelp home page GithubHelp logo

airthings / airthings-ble Goto Github PK

View Code? Open in Web Editor NEW
18.0 18.0 9.0 285 KB

Library to control Airthings devices through BLE, primarily meant to be used in Home Assistant.

License: MIT License

Python 100.00%
airthings ble home-assistant python

airthings-ble's People

Contributors

actions-user avatar bdraco avatar github-actions[bot] avatar hormcodes avatar igorbernstein avatar joe248 avatar lastrada avatar rsiv avatar vincegio avatar vqvu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

airthings-ble's Issues

Failed to connect with Ugreen BT Dongle

Whenever i try to add Airthings BLE with my Ugreen BT Dongle I just get a short error message "Failed to connect"
And in the logs it says:
Error connecting to and getting data from A0:E6:F8:01:00:20: A0:E6:F8:01:00:20 - A0:E6:F8:01:00:20: Failed to connect after 4 attempt(s): [org.bluez.Error.Failed] Software caused connection abort

It doesnt give me much to work from.

The USB looks like this in HA:

image

It is possible for me to add the integration with the RPI4 internal BT
BUT this is not usable for me because of the awful range on the internal BT. Like 1m awful range.

Long living PRs

@vincegio, I know you have a lot on your plate right now, but do you have some time to discuss the future of this repository in the near future? We've had a few long-lived pull requests recently. I work for Airthings and would like to ensure that we can ship bug fixes more quickly, even though I mainly work on this in my spare time.

I'm on Discord with the same username if you want to reach out.

To the end line!

Is your feature request related to a problem? Please describe.

No problem, just thanks.

Describe the solution you'd like

I want to support this effort โ€” especially as it gets reviewed by Home Assistant developers, and introduces important code-design questions on that project.

Additional context

I just bought my first Airthings device and was concerned if it would operate within Home Assistant, since HA 2022.8 changed everything about Bluetooth.

I knew the Home Assistant community would figure this out eventually. (It's one of the few Radon detectors that is locally controllable.) But I never thought I'd Google my problem on the day my device was delivered and see a 'pull request' into home-assistant/core that already appears to be 90 percent completed.

That's quite impressive to me, and it seems like your work is causing the core Home Assistant folks to consider a whole new class of nuance more than they've encountered in the past. So this seems like a win-win scenario to me.

I hope we can see you get this 'pull request' into home-assistant/core โ€” because it will help me specifically, but more importantly, because it is already making Home Assistant better as a concept.

So thank you for your work, and I am crossing my fingers that you're able to venture on and get this ready to merge into home-assistant/core. Even if it takes a couple months, I think it will be worth it to expand HA capabilities in the future.

Relative vs absolute pressure?

Describe the bug
Looking at the code (

data["rel_atm_pressure"] = val[7] / 50.0
) suggests that the sensor is reporting "relative" pressure. It is then converted into "absolute" pressure here:
def get_absolute_pressure(elevation: int, data: float) -> float:

I don't think this is correct. According to https://ambientweather.com/faqs/question/view/id/1591/ the raw sensor data is the "absolute" pressure, and the altitude-corrected pressure is the relative one.

If I understand correctly, the sensor is reporting the absolute pressure, and your function is converting it to the relative pressure.

While I've seen some sensors report relative pressure, they report it along with absolute pressure as a different entity. So while it's ok to have both, it's important to report the absolute pressure.

Also: The airthings dashboard reports the absolute pressure.

I would suggest dropping the absolute->relative conversion and report the absolute pressure with the existing entity. If the sensor itself was computing the relative pressure, you could report it but since you're computing it in this code, it doesn't seem necessary. I'm not sure if just changing this is the right thing to do for compatibility reasons, but I'm also not sure of the best way to migrate the use.

View Plus Support

Hello!

I am looking into adding View Plus support (to have local integration instead of cloud) and I was wondering if you had any insight into why this may not be supported under the current integration. I have not worked with Bluetooth before so any guidance would be appreciated.

The current behavior in Home Assistant OS is:
Home Assistant discovers the device using airthings-ble and presents it in the UI. After adding it, no configuration or wizard pops up, and no devices or entities are recognized.

Thank you in advance!

Bluetooth Proxy Support?

Does this support bluetooth proxies? I have a wave+ that isn't being detected. I have no actual bluetooth adapter attached to home assistant, just the proxies. When trying to add the integration it shows no devices found on network.
A clear and concise description of what the bug is.

To Reproduce
Only use bluetooth proxies, try to setup integration.

Additional context
Thanks for all your hard work.

Support for View Plus

Hi,

is there any timeline for support of the View Plus device series in homeassistant/airthings_ble?
Internally, the Model ID is 2960, but the service UUIDs I'm reading from the device aren't mentioned in the repository here, so creating support for this device probably requires internal access to the specification.

Wave+ reads incorrect pressure in Home Assistant

Describe the bug
The Wave+ sensor reads the incorrect pressure by about 0.8inHg below actual when upgrading to latest home assistant version.

To Reproduce
Steps to reproduce the behavior:
Upgrade home assistant from a January release to the latest release and the pressure reported by the sensor changes to an incorrect value.

Additional context
This appears to be a result of the following change: #32
See #32 (comment) for additional details

AirThings hardware sometimes omits data

Describe the bug
Sometimes the airthings hardware does not include a given data point in a polling cycle with Home Assistant that it previously has, which causes a key not to be populated and raises an uncaught exception within in Home Assistant. It's relatively uncommon and does not persist long, but it does happen.

To Reproduce
Steps to reproduce the behavior:

  1. Let an Airthings BLE device run and observe it until it randomly happens.

Additional context
Claimed to be a library bug although I don't really think it is, and I believe it could be handled gracefully (and trivially) within HA by a simple try/except when returning native_value for the sensor.

Ref: home-assistant/core#96735

Logs:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 229, in _handle_refresh_interval
await self._async_refresh(log_failures=True, scheduled=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 374, in _async_refresh
self.async_update_listeners()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 164, in async_update_listeners
update_callback()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 431, in _handle_coordinator_update
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 742, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 810, in _async_write_ha_state
state = self._stringify_state(available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 748, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 478, in state
value = self.native_value
^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/airthings_ble/sensor.py", line 186, in native_value
return self.coordinator.data.sensors[self.entity_description.key]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'illuminance'
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 229, in _handle_refresh_interval
await self._async_refresh(log_failures=True, scheduled=True)
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 374, in _async_refresh
self.async_update_listeners()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 164, in async_update_listeners
update_callback()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 431, in _handle_coordinator_update
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 742, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 810, in _async_write_ha_state
state = self._stringify_state(available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 748, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 478, in state
value = self.native_value
^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/airthings_ble/sensor.py", line 186, in native_value
return self.coordinator.data.sensors[self.entity_description.key]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'radon_1day_level'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.