このガイドでは、Unit ENV-IV センサープラットフォームを Home Assistant に連携させるための設定方法と実践手順について説明します。
Unit ENV-IV は単独のセンサープラットフォームです。Home Assistant に統合するには、Atom シリーズ・Stamp シリーズ・Stick シリーズ・Core/Basic シリーズなどの別途コントローラーデバイスが必要です。
# Example configuration entry for ESP32
i2c:
sda: GPIOXX
scl: GPIOXX
scan: true GPIO ピンは使用するコントローラーデバイスによって異なります。たとえば Atom Lite をコントローラーとして使用する場合:
# I2C Bus on Grove Port (HY2.0-4P)
i2c:
sda: GPIO26
scl: GPIO32 Unit ENV-IV の設定例:
sensor:
- platform: sht4x
temperature:
id: sht40_temp
name: "Temperature"
humidity:
id: sht40_humi
name: "Relative Humidity"
address: 0x44
- platform: bmp280_i2c
temperature:
name: "BMP280 Temperature"
id: bmp280_temp
oversampling: 16x
pressure:
name: "BMP280 Pressure"
id: bmp_pressure
address: 0x76また、以下の経験式に基づいて標高、絶対湿度、露点(温度)を計算することも可能です(計算結果は参考値です):
sensor:
...
# add the following under the previous sensor declarations
- platform: template
name: "Altitude"
lambda: |-
const float STANDARD_SEA_LEVEL_PRESSURE = 1013.25; //in hPa, see note
return ((id(bmp280_temp).state + 273.15) / 0.0065) *
(powf((STANDARD_SEA_LEVEL_PRESSURE / id(bmp_pressure).state), 0.190234) - 1); // in meter
update_interval: 15s
icon: 'mdi:signal'
unit_of_measurement: 'm'
- platform: absolute_humidity
name: "Absolute Humidity"
temperature: sht40_temp
humidity: sht40_humi
- platform: template
name: "Dew Point"
lambda: |-
return (243.5*(log(id(sht40_humi).state/100)+((17.67*id(sht40_humi).state)/
(243.5+id(sht40_temp).state)))/(17.67-log(id(sht40_humi).state/100)-
((17.67*id(sht40_temp).state)/(243.5+id(sht40_temp).state))));
unit_of_measurement: °C
icon: 'mdi:thermometer-alert'STANDARD_SEA_LEVEL_PRESSURE を置き換えることで対応可能です。たとえば、インターネットからリアルタイムで値を取得したり、MQTT プロトコルを通じて固定センサーから取得したりする方法があります。