Advertisement
xangin

D1 multisensor ESPhome yaml

Sep 28th, 2022
1,132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 2.08 KB | None | 0 0
  1. substitutions:
  2.   device_name: d1-multi-sensor
  3.  
  4. esphome:
  5.   name: ${device_name}
  6.   platform: ESP8266
  7.   board: d1_mini
  8.  
  9. # Enable logging
  10. logger:
  11. # Enable Home Assistant API
  12. api:
  13.   services:
  14.     - service: mhz19_calibrate_zero
  15.       then:
  16.         - mhz19.calibrate_zero: co2_sensor
  17.  
  18. ota:
  19.   password: !secret ota_password
  20.  
  21. wifi:
  22.   networks:
  23.     - ssid: !secret my_ap_ssid
  24.       password: !secret my_ap_password
  25.     - ssid: !secret my_phone_ap_ssid
  26.       password: !secret my_phone_ap_password
  27.  
  28.   # Enable fallback hotspot (captive portal) in case wifi connection fails
  29.   ap:
  30.     ssid: "d1-multi-sensor"
  31.     password: "12345678"
  32.  
  33. captive_portal:
  34. web_server:
  35. i2c:
  36.   sda: D5
  37.   scl: D6
  38.   scan: true
  39.    
  40. uart:
  41.   - id: pm_bus #for pm1006
  42.     rx_pin: D2
  43.     baud_rate: 9600
  44.  
  45.   - id: co2_bus
  46.     rx_pin: D4   #to MHZ19 TXD
  47.     tx_pin: D3   #to MHZ19 RXD
  48.     baud_rate: 9600
  49.  
  50. sensor:
  51.   - platform: pm1006
  52.     uart_id: pm_bus
  53.     pm_2_5:
  54.       name: "${device_name} PM2.5 sensor"
  55.  
  56.   - platform: sht3xd
  57.     temperature:
  58.       name: "${device_name} Temperature"
  59. #      filters:
  60. #        - calibrate_polynomial:
  61. #            degree: 2
  62. #            datapoints:
  63. #              - 0.0 -> 0.0    
  64. #              - 31.9 -> 29.2
  65. #              - 31.4 -> 28.3
  66.  
  67.     humidity:
  68.       name: "${device_name} Humidity"
  69. #      filters:
  70. #        - calibrate_polynomial:
  71. #            degree: 2
  72. #            datapoints:
  73. #              - 0.0 -> 0.0
  74. #              - 60.6 -> 71
  75. #              - 51 -> 62
  76. #              - 49.7 -> 61
  77.              
  78.     address: 0x44  
  79.     update_interval: 30s
  80.  
  81.   - platform: mhz19
  82.     id: co2_sensor
  83.     co2:
  84.       name: "${device_name} CO2"
  85.     uart_id: co2_bus
  86.     update_interval: 30s
  87.     automatic_baseline_calibration: false
  88.      
  89.   - platform: wifi_signal
  90.     name: "${device_name} WiFi Signal"
  91.     update_interval: 60s
  92.  
  93. binary_sensor:
  94.   - platform: gpio
  95.     id: motion
  96.     pin: D7
  97.     name: "${device_name} Motion"
  98.     device_class: motion  
  99.    
  100.   - platform: status
  101.     name: "${device_name} WiFi Status"    
  102.  
  103.  
  104.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement