大金空气传感器刷机

AB款
# Based on louliangsheng/daikin-air-sensor, BRY88AB151K (no HCHO expansion).
# https://github.com/louliangsheng/daikin-air-sensor
substitutions:
  # 银色金属外壳选 PM2005,黑色塑料外壳选 PM2105。
  pm_sensor: "PM2105"

esphome:
  name: daikin-air-sensor
  project:
    name: "DAIKIN.BRY88AB151K"
    version: "${pm_sensor}"
  name_add_mac_suffix: true

esp32:
  board: nodemcu-32s
  framework:
    type: esp-idf

wifi:
  # 可取消以下两行的注释并填写 Wi-Fi,或刷入后用配网热点设置。
  # ssid: "YOUR_WIFI_SSID"
  # password: "YOUR_WIFI_PASSWORD"
  ap:
    ssid: "DAIKIN Fallback Hotspot"

captive_portal:

api:
  reboot_timeout: 0s

ota:
  - platform: esphome

web_server:
  port: 80
logger:
  logs:
    hdc1080: WARN
    sgp30: WARN
    sensor: WARN
    component: ERROR
# bluetooth_proxy:  #需要蓝牙代理功能可以打开
#   active: true
# esp32_ble_tracker:

uart:
- id: cm1106_uart
  rx_pin: 16
  tx_pin: 17
  baud_rate: 9600

i2c:
- id: pm25_bus
  sda: 23
  scl: 22
  scan: true
- id: th_bus
  sda: 19
  scl: 21
  scan: true
sensor:
- platform: cm1106
  id: cm1106_device
  uart_id: cm1106_uart
  update_interval: 10s
  co2:
    name: "DAIKIN CO2 Sensor"
    id: co2sensor
- platform: pm2005
  type: ${pm_sensor}
  i2c_id: pm25_bus
  update_interval: 1s
  pm_2_5:
    name: "DAIKIN PM2.5 Sensor"
    id: pm25sensor
- platform: sgp30
  i2c_id: th_bus
  compensation:
    temperature_source: temperature
    humidity_source: humidity
  eco2:
    id: eco2sensor
    internal: true
  tvoc:
    name: "DAIKIN TVOC Sensor"
    id: tvocsensor
    device_class: volatile_organic_compounds
    unit_of_measurement: "µg/m³"
    filters:
      - throttle: 15s
      - lambda: |-
          if (x * id(tvocmultiply).state > id(tvocmax).state) {
            return id(tvocmax).state;
          } else {
            return x * id(tvocmultiply).state;
          }
- platform: hdc1080
  i2c_id: th_bus
  update_interval: 15s
  temperature:
    name: "DAIKIN Temperature Sensor"
    id: temperature
    filters:
      - lambda: return x - id(temperatureoffset).state;
  humidity:
    name: "DAIKIN Humidity Sensor"
    id: humidity
    filters:
      - lambda: return x * id(humiditymultiply).state;
      - clamp:
          max_value: 100
- platform: wifi_signal
  name: "DAIKIN Signal"
switch:
- platform: template
  name: "DAIKIN LED Indicator"
  restore_mode: RESTORE_DEFAULT_OFF
  icon: mdi:led-off
  id: indicator
  optimistic: true

- platform: gpio
  pin: 4
  id: co2led
  internal: true
- platform: gpio
  pin: 32
  id: tvocch2oled
  internal: true
- platform: gpio
  pin: 33
  id: pm25led
  internal: true
status_led:
  pin: 25
number:
- platform: template
  name: "DAIKIN Threshold CO2"
  entity_category: "config"
  id: co2threshold
  optimistic: true
  unit_of_measurement: "ppm"
  min_value: 400
  max_value: 5000
  step: 100
  initial_value: 1000
  restore_value: true
- platform: template
  name: "DAIKIN Threshold PM2.5"
  entity_category: "config"
  id: pm25threshold
  optimistic: true
  unit_of_measurement: "µg/m³"
  min_value: 0
  max_value: 200
  step: 10
  initial_value: 50
  restore_value: true
- platform: template
  name: "DAIKIN Threshold TVOC"
  entity_category: "config"
  id: tvocthreshold
  optimistic: true
  unit_of_measurement: "µg/m³"
  min_value: 0
  max_value: 20000
  step: 1000
  initial_value: 1000
  restore_value: true
- platform: template
  name: "DAIKIN TVOC MAX"
  entity_category: "config"
  id: tvocmax
  optimistic: true
  unit_of_measurement: "µg/m³"
  min_value: 5000
  max_value: 20000
  step: 1000
  initial_value: 10000
  restore_value: true
- platform: template
  name: "DAIKIN TVOC Multiply"
  entity_category: "config"
  id: tvocmultiply
  optimistic: true
  min_value: 1
  max_value: 5
  step: 0.1
  initial_value: 3
  restore_value: true
- platform: template
  name: "DAIKIN Humidity Multiply"
  entity_category: "config"
  id: humiditymultiply
  optimistic: true
  min_value: 1
  max_value: 1.6
  step: 0.01
  initial_value: 1.4
  restore_value: true
- platform: template
  name: "DAIKIN Temperature Offset"
  entity_category: "config"
  id: temperatureoffset
  optimistic: true
  min_value: 0
  max_value: 10
  step: 0.1
  initial_value: 6
  restore_value: true
binary_sensor:
- platform: template
  internal: true
  id: tvocch2olambda
  lambda: |-
    if (id(indicator).state == true) {
      if (id(tvocsensor).state > id(tvocthreshold).state) {
        return true;
      } else {
        return false;
    }
    } else {
      return false;
    }
  on_press:
    then:
      - switch.turn_on: tvocch2oled
  on_release:
    then:
      - switch.turn_off: tvocch2oled
- platform: template
  internal: true
  id: co2lambda
  lambda: |-
    if (id(indicator).state == true) {
      if (id(co2sensor).state > id(co2threshold).state) {
        return true;
      } else {
        return false;
    }
    } else {
      return false;
    }
  on_press:
    then:
      - switch.turn_on: co2led
  on_release:
    then:
      - switch.turn_off: co2led
- platform: template
  internal: true
  id: pm25lambda
  lambda: |-
    if (id(indicator).state == true) {
      if (id(pm25sensor).state > id(pm25threshold).state) {
        return true;
      } else {
        return false;
    }
    } else {
      return false;
    }
  on_press:
    then:
      - switch.turn_on: pm25led
  on_release:
    then:
      - switch.turn_off: pm25led

- platform: gpio
  pin: 34
  id: RESET
  internal: true
  on_press:
    then:
      - button.press: reset
button:
- platform: restart
  name: "DAIKIN Restart"
  entity_category: "diagnostic"
- platform: factory_reset
  id: reset
  internal: true
- platform: template
  # 仅在已知稳定的 400 ppm 环境中运行至少 20 分钟后执行。
  name: "DAIKIN CO2 Calibration"
  entity_category: "diagnostic"
  on_press:
    then:
      - cm1106.calibrate_zero: cm1106_device

external_components:
  - source:
      type: local
      path: components
    components: [daikin_history]

daikin_history:
  co2: co2sensor
  temperature: temperature
  humidity: humidity
  pm25: pm25sensor
  tvoc: tvocsensor
AA款
# Based on louliangsheng/daikin-air-sensor, BRY88AA151K (no HCHO expansion).
# https://github.com/louliangsheng/daikin-air-sensor
substitutions:
  # 银色金属外壳选 PM2005,黑色塑料外壳选 PM2105。
  pm_sensor: "PM2005"

esphome:
  name: "daikin-air-sensor"
  project:
    name: "DAIKIN.BRY88AA151K"
    version: "${pm_sensor}"
  name_add_mac_suffix: true

esp32:
  board: nodemcu-32s

wifi:
  # 可取消以下两行的注释并填写 Wi-Fi,或刷入后用配网热点设置。
  # ssid: "YOUR_WIFI_SSID"
  # password: "YOUR_WIFI_PASSWORD"
  ap:
    ssid: "DAIKIN Fallback Hotspot"

captive_portal:

api:
  reboot_timeout: 0s

ota:
  - platform: esphome

web_server:
  port: 80

logger:
  logs:
    hdc1080: WARN
    sensor: WARN
    component: ERROR

# bluetooth_proxy:  #需要蓝牙代理功能可以打开
#   active: true
# esp32_ble_tracker:

uart:
- id: cm1106_uart
  rx_pin: 16
  tx_pin: 17
  baud_rate: 9600

i2c:
- id: pm25_bus
  sda: 23
  scl: 22
  scan: true
sensor:
- platform: cm1106
  id: cm1106_device
  uart_id: cm1106_uart
  update_interval: 10s
  co2:
    name: "DAIKIN CO2 Sensor"
    id: co2sensor
- platform: pm2005
  type: ${pm_sensor}
  i2c_id: pm25_bus
  update_interval: 1s
  pm_2_5:
    name: "DAIKIN PM2.5 Sensor "
    id: pm25sensor
- platform: adc
  pin: 34
  attenuation: auto
  name: "DAIKIN TVOC Sensor"
  id: tvocsensor
  device_class: volatile_organic_compounds
  unit_of_measurement: "µg/m³"
  accuracy_decimals: 0
  update_interval: 3s
  filters:
    - skip_initial: 12 #tgs2602传感器需要约30s以上预热时间
    - median:
    - lambda: |-
        static float min_value = x;
        if (x < min_value) {
          min_value = x;
        }
        float diff = x - min_value;
        if (diff * 3000 * id(tvocmultiply).state > id(tvocmax).state) {
          return id(tvocmax).state;
        } else {
          return diff * 3000 * id(tvocmultiply).state;
        }
- platform: hdc1080
  update_interval: 15s
  temperature:
    name: "DAIKIN Temperature Sensor"
    id: temperature
    filters:
      - lambda: return x - id(temperatureoffset).state;
  humidity:
    name: "DAIKIN Humidity Sensor"
    id: humidity
    filters:
      - lambda: return x * id(humiditymultiply).state;
      - clamp:
          max_value: 100
- platform: wifi_signal
  name: "DAIKIN Signal"
switch:
- platform: template
  name: "DAIKIN LED Indicator"
  restore_mode: RESTORE_DEFAULT_OFF
  icon: mdi:led-off
  id: indicator
  optimistic: true

- platform: gpio
  pin: 5
  id: co2led
  internal: true
- platform: gpio
  pin: 32
  id: tvocled
  internal: true
- platform: gpio
  pin: 33
  id: pm25led
  internal: true
status_led:
  pin: 25
number:
- platform: template
  name: "DAIKIN Threshold CO2"
  entity_category: "config"
  id: co2threshold
  optimistic: true
  unit_of_measurement: "ppm"
  min_value: 400
  max_value: 5000
  step: 100
  initial_value: 1000
  restore_value: true
- platform: template
  name: "DAIKIN Threshold PM2.5"
  entity_category: "config"
  id: pm25threshold
  optimistic: true
  unit_of_measurement: "µg/m³"
  min_value: 0
  max_value: 200
  step: 10
  initial_value: 50
  restore_value: true
- platform: template
  name: "DAIKIN Threshold TVOC"
  entity_category: "config"
  id: tvocthreshold
  optimistic: true
  unit_of_measurement: "µg/m³"
  min_value: 0
  max_value: 10000
  step: 1000
  initial_value: 1000
  restore_value: true
- platform: template
  name: "DAIKIN TVOC MAX"
  entity_category: "config"
  id: tvocmax
  optimistic: true
  unit_of_measurement: "µg/m³"
  min_value: 3000
  max_value: 10000
  step: 1000
  initial_value: 5000
  restore_value: true
- platform: template
  name: "DAIKIN TVOC Multiply"
  entity_category: "config"
  id: tvocmultiply
  optimistic: true
  min_value: 0.3
  max_value: 3
  step: 0.05
  initial_value: 1
  restore_value: true
- platform: template
  name: "DAIKIN Humidity Multiply"
  entity_category: "config"
  id: humiditymultiply
  optimistic: true
  min_value: 0.9
  max_value: 1.1
  step: 0.01
  initial_value: 1
  restore_value: true
- platform: template
  name: "DAIKIN Temperature Offset"
  entity_category: "config"
  id: temperatureoffset
  optimistic: true
  min_value: -2
  max_value: 3
  step: 0.1
  initial_value: 1
  restore_value: true
binary_sensor:
- platform: template
  internal: true
  id: tvoclambda
  lambda: |-
    if (id(indicator).state == true) {
      if (id(tvocsensor).state > id(tvocthreshold).state) {
        return true;
      } else {
        return false;
    }
    } else {
      return false;
    }
  on_press:
    then:
      - switch.turn_on: tvocled
  on_release:
    then:
      - switch.turn_off: tvocled
- platform: template
  internal: true
  id: co2lambda
  lambda: |-
    if (id(indicator).state == true) {
      if (id(co2sensor).state > id(co2threshold).state) {
        return true;
      } else {
        return false;
    }
    } else {
      return false;
    }
  on_press:
    then:
      - switch.turn_on: co2led
  on_release:
    then:
      - switch.turn_off: co2led
- platform: template
  internal: true
  id: pm25lambda
  lambda: |-
    if (id(indicator).state == true) {
      if (id(pm25sensor).state > id(pm25threshold).state) {
        return true;
      } else {
        return false;
    }
    } else {
      return false;
    }
  on_press:
    then:
      - switch.turn_on: pm25led
  on_release:
    then:
      - switch.turn_off: pm25led

- platform: gpio
  pin: 19
  id: RESET
  internal: true
  on_press:
    then:
      - button.press: reset
button:
- platform: restart
  name: "DAIKIN Restart"
  entity_category: "diagnostic"
- platform: factory_reset
  id: reset
  internal: true
- platform: template
  # 仅在已知稳定的 400 ppm 环境中运行至少 20 分钟后执行。
  name: "DAIKIN CO2 Calibration"
  entity_category: "diagnostic"
  on_press:
    then:
      - cm1106.calibrate_zero: cm1106_device
打赏支持

支付宝扫一扫

支付宝打赏二维码

感谢您的支持!让我有持续更新的动力

© 版权声明
THE END
点赞0 分享
评论 抢沙发
头像-小陈折腾日记
欢迎您留下宝贵的见解!
提交
头像-小陈折腾日记

昵称

取消
昵称表情代码图片快捷回复

    暂无评论内容