Desktop og Tablet cover

Robotstøvsuger – garasje

esphome:
  name: robot-vacuum-garage
  friendly_name: Robot vacuum garage

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:


sensor:
  - platform: wifi_signal
    name: "WiFi Signal"
    update_interval: 60s
   
  - platform: uptime
    name:  "Uptime"


binary_sensor:
  - platform: gpio
    pin:
      inverted: true
      number: GPIO25
      mode:
        input: true
        pullup: true
    name: "Gate open"
    device_class: GARAGE_DOOR

  - platform: gpio
    pin:
      inverted: true
      number: GPIO23
      mode:
        input: true
        pullup: true
    filters:
      - delayed_on_off:
          time_on: 1s
          time_off: 1s
    name: "Dock busy"
    device_class: OCCUPANCY

text_sensor:
  - platform: wifi_info
    ip_address:
      name: "IP Address"

# Enable Home Assistant API
api:
  encryption:
    key: "REMOVED"
  services:
    - service: control_robot_vacuum_gate_servo_left
      variables:
        level: float
      then:
        - servo.write:
            id: robot_vacuum_gate_servo_left
            level: !lambda 'return level / 100.0;'
    - service: control_robot_vacuum_gate_servo_rigth
      variables:
        level: float
      then:
        - servo.write:
            id: robot_vacuum_gate_servo_rigth
            level: !lambda 'return level / 100.0;'


ota:
  platform: esphome
  password: "REMOVED"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Robot-Vacuum-Garage"
    password: "REMOVED"

captive_portal:

button:
  - platform: restart
    name: "Restart Device"

servo:
  - id: robot_vacuum_gate_servo_left
    output: robot_vacuum_gate_output_left
    transition_length: 8s

  - id: robot_vacuum_gate_servo_rigth
    output: robot_vacuum_gate_output_rigth
    transition_length: 8s


light:

  - platform: partition
    name: "under_cabinet_light_rigth 90"
    segments:
      # Dust bin 90% empty
      - id: under_cabinet_light_rigth
        from: 3
        to: 20
  - platform: partition
    name: "under_cabinet_light_rigth 70"
    segments:
      # Dust bin 70% empty
      - id: under_cabinet_light_rigth
        from: 6
        to: 20
  - platform: partition
    name: "under_cabinet_light_rigth 50"
    segments:
      # Dust bin 50% empty
      - id: under_cabinet_light_rigth
        from: 9
        to: 20
  - platform: partition
    name: "under_cabinet_light_rigth 30"
    segments:
      # Dust bin 30% empty
      - id: under_cabinet_light_rigth
        from: 12
        to: 20
  - platform: partition
    name: "under_cabinet_light_rigth 20"
    segments:
      # Dust bin 20% empty
      - id: under_cabinet_light_rigth
        from: 15
        to: 20
  - platform: partition
    name: "under_cabinet_light_rigth 5"
    segments:
      # Dust bin 5% empty
      - id: under_cabinet_light_rigth
        from: 17
        to: 20



  - platform: partition
    name: "under_cabinet_light_left 5"
    segments:
      # Water tank 5% full
      - id: under_cabinet_light_left
        from: 0
        to: 3
  - platform: partition
    name: "under_cabinet_light_left 20"
    segments:
      # Water tank 20% full
      - id: under_cabinet_light_left
        from: 0
        to: 6
  - platform: partition
    name: "under_cabinet_light_left 30"
    segments:
      # Water tank 30% full
      - id: under_cabinet_light_left
        from: 0
        to: 9
  - platform: partition
    name: "under_cabinet_light_left 50"
    segments:
      # Water tank 50% full
      - id: under_cabinet_light_left
        from: 0
        to: 12
  - platform: partition
    name: "under_cabinet_light_left 70"
    segments:
      # Water tank 70% full
      - id: under_cabinet_light_left
        from: 0
        to: 15
  - platform: partition
    name: "under_cabinet_light_left 90"
    segments:
      # Water tank 90% full
      - id: under_cabinet_light_left
        from: 0
        to: 18


  - platform: fastled_clockless
    chipset: WS2812
    pin: 18
    num_leds: 21
    rgb_order: GRB
    id: under_cabinet_light_rigth
    name: "Under cabinet light rigth"
    effects:
      - addressable_scan:
          name: Scan
          move_interval: 20ms
          scan_width: 5
      - pulse:
          name: "Fast Pulse"
          transition_length: 0.5s
          update_interval: 0.7s
          min_brightness: 40%
          max_brightness: 100%
      - addressable_lambda:
          name: "Wipe In"
          update_interval: 15ms
          lambda: |-
            static int x = 0;
            if (initial_run) {
              x = 0;
              it.all() = ESPColor(0,0,0);
            }
            if (x < it.size()) {
              it[x] = current_color;
              x += 1;
            }
      - addressable_lambda:
          name: "Wipe Out"
          update_interval: 15ms
          lambda: |-
            static int x = 0;
            if (initial_run) {
              x = it.size();
            }
            if (x > 0) {
              x -= 1; 
              it[x] = ESPColor(0,0,0);
            }
      - addressable_lambda:
          name: "Static Rainbow"
          lambda: |-
           for (int i = 1; i < it.size(); i+=7) {
               it[i] = light::ESPColor(0, 0, 0);
            }
           for (int i = 0; i < it.size(); i+=7) {
               it[i] = light::ESPColor(0, 0, 0);
            }
           for (int i = 1; i < it.size(); i+=7) {
               it[i] = light::ESPColor(0, 0, 0);
            }
           for (int i = 0; i < it.size(); i+=7) {
               it[i] = light::ESPColor(0, 255, 0);
            }
           for (int i = 1; i < it.size(); i+=7) {
               it[i] = light::ESPColor(255, 255, 0);
            }
           for (int i = 0; i < it.size(); i+=7) {
               it[i] = light::ESPColor(255, 127, 0);
            }
           for (int i = 0; i < it.size(); i+=7) {
               it[i] = light::ESPColor(255, 0, 0);
            }

  - platform: fastled_clockless
    chipset: WS2812
    pin: 5
    num_leds: 21
    rgb_order: GRB
    id: under_cabinet_light_left
    name: "Under cabinet light left"
    effects:
      - addressable_scan:
          name: Scan
          move_interval: 20ms
          scan_width: 5
      - pulse:
          name: "Fast Pulse"
          transition_length: 0.5s
          update_interval: 0.7s
          min_brightness: 40%
          max_brightness: 100%
      - addressable_lambda:
          name: "Wipe In"
          update_interval: 15ms
          lambda: |-
            static int x = 0;
            if (initial_run) {
              x = 0;
              it.all() = ESPColor(0,0,0);
            }
            if (x < it.size()) {
              it[x] = current_color;
              x += 1;
            }
      - addressable_lambda:
          name: "Wipe Out"
          update_interval: 15ms
          lambda: |-
            static int x = 0;
            if (initial_run) {
              x = it.size();
            }
            if (x > 0) {
              x -= 1; 
              it[x] = ESPColor(0,0,0);
            }

  - platform: fastled_clockless
    chipset: WS2812
    pin: 17
    num_leds: 30
    rgb_order: GRB
    id: robot_vacuum_light_left
    name: "Robot vacuum light left"
    effects:
      - addressable_scan:
          name: Scan
          move_interval: 20ms
          scan_width: 5
      - pulse:
          name: "Fast Pulse"
          transition_length: 0.5s
          update_interval: 0.7s
          min_brightness: 40%
          max_brightness: 100%
      - addressable_lambda:
          name: "Wipe In"
          update_interval: 18ms
          lambda: |-
            static int x = 0;
            if (initial_run) {
              x = 0;
              it.all() = ESPColor(0,0,0);
            }
            if (x < it.size()) {
              it[x] = current_color;
              x += 1;
            }
      - addressable_lambda:
          name: "Wipe Out"
          update_interval: 18ms
          lambda: |-
            static int x = 0;
            if (initial_run) {
              x = it.size();
            }
            if (x > 0) {
              x -= 1; 
              it[x] = ESPColor(0,0,0);
            }


output:
  - platform: ledc
    id: robot_vacuum_gate_output_left
    pin: GPIO32
    frequency: 50 Hz

  - platform: ledc
    id: robot_vacuum_gate_output_rigth
    pin: GPIO33
    frequency: 50 Hz
Top