Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- esphome:
- name: pillebeholder
- friendly_name: Pillebeholder
- esp32:
- board: esp32dev
- framework:
- type: esp-idf
- # Enable logging
- logger:
- # Enable Home Assistant API
- api:
- encryption:
- key: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
- ota:
- - platform: esphome
- password: "xxxxxxxxxxxxxxxxxxxx"
- wifi:
- ssid: !secret wifi_ssid
- password: !secret wifi_password
- manual_ip:
- static_ip: xxx.xxx.xxx.xxx
- gateway: xxx.xxx.xxx.xxx
- subnet: xxx.xxx.xxx.xxx
- dns1: xxx.xxx.xxx.xxx
- # Enable fallback hotspot (captive portal) in case wifi connection fails
- ap:
- ssid: "Pillebeholder Fallback Hotspot"
- password: "xxxxxxx"
- captive_portal:
- web_server:
- port: 80
- i2c:
- sda: GPIO16
- scl: GPIO17
- scan: true
- id: bus_a
- sensor:
- - platform: vl53l0x
- address: 0x29
- name: "Afstand"
- id: distance
- update_interval: 30s
- long_range: false
- - platform: template
- id: level
- name: Pilletop
- unit_of_measurement: '%'
- update_interval: 30s
- lambda: |-
- if (isnan(id(distance).state)) return 0;
- auto r = (id(distance).state - 0.75) * (100.0 - 0.0) / (0.1 - 0.75) + 0.0;
- if (r > 100) return 100;
- if (r < 0) return 0;
- return r;
- ## auto r = (id(distance).state - 0.55) * (100.0 - 0.0) / (0.1 - 0.55) + 0.0; ## 0.55 TIL 0.7 VISER 0%
- ## auto r = (id(distance).state - 0.8) * (100.0 - 0.0) / (0.1 - 0.8) + 0.0; ## VISER 15%
- ## auto r = (id(distance).state - 0.75) * (100.0 - 0.0) / (0.1 - 0.75) + 0.0; ## VISER 7,5-9,5%
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement