Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- esphome:
- name: vindriktning
- friendly_name: Vindriktning
- on_boot:
- priority: 600.0
- then:
- - light.turn_on:
- id: ikea_light
- effect: "Effect1"
- red: 0%
- green: 0%
- blue: 100%
- esp32:
- board: esp32dev
- framework:
- type: arduino
- logger:
- baud_rate: 0
- # Enable Home Assistant API
- api:
- encryption:
- key: "Rh+s/Wj6EN61vecPYib5qnFwb7qnBiYC6Z4Ru2kVuS0="
- ota:
- password: "ee51b15d8570c640dfc67e6a00675e90"
- wifi:
- ssid: !secret wifi_ssid
- password: !secret wifi_password
- # Enable fallback hotspot (captive portal) in case wifi connection fails
- ap:
- ssid: "Vindriktning Fallback Hotspot"
- password: "MvF9FCTn6aI6"
- on_connect:
- - light.turn_off: ikea_light
- on_disconnect:
- - light.turn_on:
- id: ikea_light
- effect: "Effect1"
- red: 0%
- green: 0%
- blue: 100%
- captive_portal:
- web_server:
- port: 80
- time: # Время берем из Home Assistant
- - platform: homeassistant
- id: homeassistant_time
- switch:
- - platform: restart # Переключатель перезагрузки устройства
- name: "Restart_Ikea"
- i2c:
- sda: 21
- scl: 22
- scan: true
- id: bus_a
- uart:
- rx_pin: GPIO26
- baud_rate: 9600
- # id: uart_rx
- # debug:
- # direction: RX
- # dummy_receiver: true
- # after:
- # delimiter: "\r\n"
- # sequence:
- # - lambda: |-
- # UARTDebug::log_string(direction, bytes); //Still log the data
- # uint8_t checksum = 0;
- # for (int i=0; i < bytes.size(); i++) {
- # checksum+= bytes[i];
- # }
- # if (checksum==0){
- # ESP_LOGD("UART","PM1006|PM1006k checksum validated, have %d", checksum);
- # if (bytes.size()==20 and (bytes[0]==22 and bytes[1]==17 and bytes[2]==11)) {
- # ESP_LOGD("UART", "Correct PM1006 response recieved. Updating sensors");
- # id(ikea_pm2).publish_state(bytes[5]*256+bytes[6]);
- # id(ikea_pm1).publish_state(bytes[9]*256+bytes[10]);
- # id(ikea_pm10).publish_state(bytes[13]*256+bytes[14]);
- # }
- # if (bytes.size()==16 and (bytes[0]==22 and bytes[1]==13 and bytes[2]==2)) {
- # ESP_LOGD("UART", "Correct PM1006K response recieved. Updating sensors");
- # id(ikea_pm2).publish_state(bytes[5]*256+bytes[6]);
- # id(ikea_pm1).publish_state(bytes[9]*256+bytes[10]);
- # id(ikea_pm10).publish_state(bytes[13]*256+bytes[14]);
- # }
- # }
- # else{
- # ESP_LOGW("UART","PM1006|PM1006k checksum is wrong: %02x, expected zero. Sensors will not be updated", checksum);
- # }
- light:
- - platform: neopixelbus
- type: GRB
- variant: WS2812
- pin: GPIO14
- num_leds: 7
- name: "ikea_color"
- id: "ikea_light"
- internal: true
- effects:
- - pulse:
- name: "Effect1"
- transition_length: 0.5s
- update_interval: 0.5s
- min_brightness: 10%
- max_brightness: 60%
- - platform: partition
- name: "ikea_partition1"
- id: "ikea_light1"
- internal: true
- segments:
- # Use first 3 LEDs from the light with ID light1
- - id: ikea_light
- from: 0
- to: 2
- - platform: partition
- name: "ikea_partition2"
- id: "ikea_light2"
- internal: true
- segments:
- # Use LEDs 3-6 from the light with ID light1
- - id: ikea_light
- from: 3
- to: 6
- effects:
- - pulse:
- name: "Effect3"
- transition_length: 1s
- update_interval: 1s
- min_brightness: 20%
- max_brightness: 50%
- sensor:
- - platform: pm1006
- pm_2_5:
- name: "IKEA-BD 2.5µm Concentration"
- id: ikea_pm_2
- # - platform: template
- # name: "Ikea PM25"
- # icon: "mdi:blur"
- # id: "ikea_pm2"
- # device_class: PM25
- # accuracy_decimals: 0
- # unit_of_measurement: µg/m³
- # - platform: template
- # name: "Ikea PM10 "
- # icon: "mdi:blur"
- # id: "ikea_pm10"
- # device_class: PM10
- # accuracy_decimals: 0
- # unit_of_measurement: µg/m³
- - platform: uptime
- name: "Uptime_Ikea"
- #### scd41 CO2
- - platform: scd4x
- automatic_self_calibration: false
- temperature_offset: 4
- id: "ikea_scd41"
- co2:
- name: "Ikea CO2"
- id: "ikea_co2"
- temperature:
- name: "Ikea CO2 Temperature"
- accuracy_decimals: 1
- humidity:
- name: "Ikea CO2 Humidity"
- accuracy_decimals: 0
- #### bme280
- - platform: bme280_i2c
- temperature:
- name: "Ikea Temperature"
- oversampling: 16x
- pressure:
- name: "Ikea Pressure"
- humidity:
- name: "Ikea Humidity"
- address: 0x76
- update_interval: 60s
- #### LD2410
- # ld2410:
- # uart_id: uart_0
- binary_sensor:
- - platform: gpio
- pin: 5
- name: IKEA-BD Presence
- device_class: presence
- # - platform: ld2410
- # has_target:
- # name: "presence_IKEA"
- # has_moving_target:
- # name: "moving_target_IKEA"
- # has_still_target:
- # name: "still_target_IKEA"
- #number:
- # - platform: ld2410
- # timeout:
- # name: timeout_IKEA
- # internal : false
- # light_threshold:
- # name: light_threshold_IKEA
- # internal : false
- # max_move_distance_gate:
- # name: max_move_distance_gate_IKEA
- # internal : false
- # max_still_distance_gate:
- # name: max_still_distance_gate_IKEA
- # internal : false
- #select:
- # - platform: ld2410
- # distance_resolution:
- # name: "distance_resolution_IKEA"
- # internal : false
- # baud_rate:
- # name: "baud rate_IKEA"
- # internal : false
- # light_function:
- # name: light_function_IKEA
- # internal : false
- # out_pin_level:
- # name: out_pin_level_IKEA
- # internal : false
- button:
- # - platform: ld2410
- # factory_reset:
- # name: "factory_reset_IKEA"
- # internal : false
- # restart:
- # name: "restart_IKEA"
- # internal : false
- # query_params:
- # name: query_params_IKEA
- # internal : false
- - platform: safe_mode
- name: "IKEA-BD (Safe Mode)"
- - platform: restart
- name: "IKEA-BD Restart"
- interval:
- - interval: 60s
- then:
- - if:
- condition:
- sensor.in_range:
- id: ikea_co2
- above: 0
- below: 800
- then:
- - light.turn_on:
- id: ikea_light2
- red: 0%
- green: 100%
- blue: 0%
- brightness: 20%
- effect: None
- color_mode: RGB
- - if:
- condition:
- sensor.in_range:
- id: ikea_co2
- above: 800
- below: 1000
- then:
- - light.turn_on:
- id: ikea_light2
- red: 98%
- green: 78%
- blue: 47%
- brightness: 20%
- effect: None
- color_mode: RGB
- - if:
- condition:
- sensor.in_range:
- id: ikea_co2
- above: 1000
- below: 1500
- then:
- - light.turn_on:
- id: ikea_light2
- red: 100%
- green: 0%
- blue: 0%
- brightness: 20%
- effect: None
- color_mode: RGB
- - if:
- condition:
- sensor.in_range:
- id: ikea_co2
- above: 1500
- then:
- - light.turn_on:
- id: ikea_light2
- effect: "Effect3"
- red: 100%
- green: 0%
- blue: 0%
- - if:
- condition:
- sensor.in_range:
- id: ikea_pm_2
- above: 0
- below: 35
- then:
- - light.turn_on:
- id: ikea_light1
- red: 0%
- green: 100%
- blue: 0%
- brightness: 20%
- effect: None
- - if:
- condition:
- sensor.in_range:
- id: ikea_pm_2
- above: 0
- below: 35
- then:
- - light.turn_on:
- id: ikea_light1
- red: 0%
- green: 100%
- blue: 0%
- brightness: 20%
- effect: None
- - if:
- condition:
- sensor.in_range:
- id: ikea_pm_2
- above: 35
- below: 85
- then:
- - light.turn_on:
- id: ikea_light1
- red: 98%
- green: 78%
- blue: 47%
- brightness: 20%
- effect: None
- - if:
- condition:
- sensor.in_range:
- id: ikea_pm_2
- above: 85
- then:
- - light.turn_on:
- id: ikea_light1
- red: 100%
- green: 0%
- blue: 0%
- brightness: 20%
- effect: None
Advertisement
Add Comment
Please, Sign In to add comment