Skip to content

Instantly share code, notes, and snippets.

@kevin-david
Last active May 21, 2024 20:57
Show Gist options
  • Save kevin-david/f86a46147ef49b3c4d09205436adc7c2 to your computer and use it in GitHub Desktop.
Save kevin-david/f86a46147ef49b3c4d09205436adc7c2 to your computer and use it in GitHub Desktop.
Airthings Wave Radon: ESPHome Sensor / Proxy
##
## See https://github.com/kevin-david/home-assistant-shared/blob/main/esphome/esp32-wave-radon-proxy.yml for future updates
##
substitutions:
name: "<YOUR_DEVICE_NAME_HERE>"
wave_serial: "<YOUR_SERIAL_OR_UNIQUE_ID_HERE>"
# See https://esphome.io/components/sensor/airthings_ble.html for how to find this
# Note: If you have your ESP32 connected to your Wave device, it might cause problems syncing with your phone
# Suggest powering down the ESP device before running firmware updates or attempting to sync with AirThings cloud, if you care about that
wave_bluetooth_mac: "<YOUR_AIRTHINGS_WAVE_RADON_MAC_HERE>"
# Note: This will impact battery life of the Wave device.
# Radon only seems to be updated about every ~hour but temp/humidity can be much more frequent
# Choose according to your needs
airthings_update_interval: "30min"
esphome:
name: $name
esp32:
board: esp32dev
framework:
type: esp-idf
version: recommended
# Enable logging
logger:
level: DEBUG # Required for the tracker to show the device
api:
ota:
esp32_ble_tracker:
bluetooth_proxy:
# Wave2 sensor bytes https://ztroop.github.io/wave-reader-utils/specs/#ti-over-the-air-download-service
sensor:
# Conversion factor for Radon - https://help.airthings.com/en/articles/3119854-radon-what-is-the-difference-between-pci-l-and-bq-m3
- platform: ble_client
type: characteristic
ble_client_id: "airthings_$wave_serial"
update_interval: $airthings_update_interval
name: "Airthings ${wave_serial} Radon: Short Term"
id: "airthings_${wave_serial}_radon"
icon: 'mdi:radioactive'
service_uuid: 'B42E4A8E-ADE7-11E4-89D3-123B93F75CBA'
characteristic_uuid: 'b42e4dcc-ade7-11e4-89d3-123b93f75cba'
unit_of_measurement: "pCi/L"
accuracy_decimals: 2
lambda: |-
uint16_t radon_sta = x[4];
radon_sta += (x[5] << 8);
return (float)(radon_sta / 37.0f);
filters:
- filter_out: nan
- platform: ble_client
type: characteristic
ble_client_id: "airthings_$wave_serial"
update_interval: $airthings_update_interval
name: "Airthings ${wave_serial} Radon: Long Term"
id: "airthings_${wave_serial}_radon_long_term"
icon: 'mdi:radioactive'
service_uuid: 'B42E4A8E-ADE7-11E4-89D3-123B93F75CBA'
characteristic_uuid: 'b42e4dcc-ade7-11e4-89d3-123b93f75cba'
unit_of_measurement: "pCi/L"
accuracy_decimals: 2
lambda: |-
uint16_t radon_lta = x[6];
radon_lta += (x[7] << 8);
return (float)(radon_lta / 37.0f);
filters:
- filter_out: nan
- platform: ble_client
type: characteristic
ble_client_id: "airthings_$wave_serial"
update_interval: $airthings_update_interval
name: "Airthings ${wave_serial} Temperature"
id: "airthings_${wave_serial}_temperature"
icon: 'mdi:thermometer'
service_uuid: 'B42E4A8E-ADE7-11E4-89D3-123B93F75CBA'
characteristic_uuid: 'b42e4dcc-ade7-11e4-89d3-123b93f75cba'
unit_of_measurement: "°F"
accuracy_decimals: 2
lambda: |-
uint16_t temperature = x[8];
temperature += (x[9] << 8);
float temp = temperature / 100.0f;
return (float)((temp * (9.0f/5.0f)) + 32.0f);
filters:
- filter_out: nan
- platform: ble_client
type: characteristic
ble_client_id: "airthings_$wave_serial"
update_interval: $airthings_update_interval
name: "Airthings ${wave_serial} Relative Humidity"
id: "airthings_${wave_serial}_relative_humidity"
icon: 'mdi:water-percent'
service_uuid: 'B42E4A8E-ADE7-11E4-89D3-123B93F75CBA'
characteristic_uuid: 'b42e4dcc-ade7-11e4-89d3-123b93f75cba'
unit_of_measurement: "%"
accuracy_decimals: 1
lambda: |-
uint8_t humidity = x[1];
float humidity_calc = humidity / 2.0f;
return humidity_calc;
filters:
- filter_out: nan
- platform: wifi_signal
name: "$name WiFi Signal"
update_interval: 5min
- platform: uptime
name: "$name Uptime"
id: uptime_sensor
update_interval: 5min
ble_client:
- mac_address: $wave_bluetooth_mac
id: "airthings_$wave_serial"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "$name Flbk"
password: !secret fallback_password
@joetuesday
Copy link

Many thanks for this!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment