# 3v3 en svp sun 34 35 32 33 25 26 27 14 12 gnd 13 sd2 sd3 gnd 5v substitutions: devicename: water-softener-multisensor entity_name: water_softener_multisensor friendly_name: Water Softener MultiSensor comment: Clever Water Softener MultiSensor board: nodemcuv2 static_ip: !secret water-softener-multisensor-ip door_pin: D5 # For the ultrasonic sensor trigger_pin: D7 echo_pin: D6 packages: # network: !include common/ethernet.yaml network: !include common/wifi.yaml device_base: !include common/device_base.yaml esphome: name: ${devicename} friendly_name: ${friendly_name} name_add_mac_suffix: false esp8266: board: ${board} # Enable logging logger: api: # Using settings from common/device_base.yaml ota: # Using settings from common/device_base.yaml sensor: - platform: ultrasonic trigger_pin: ${trigger_pin} echo_pin: ${echo_pin} id: ultrasonic_source update_interval: 1s internal: True filters: - sliding_window_moving_average: window_size: 5 send_every: 5 send_first_at: 1 - lambda: 'return round( x * 10.0) / 10.0;' - clamp: min_value: 0.0 max_value: 150.0 on_value: then: - sensor.template.publish: id: distance_from_bottom state: !lambda 'return id(ultrasonic_source).state;' - sensor.template.publish: id: distance_from_top state: !lambda 'return id(ultrasonic_source).state;' - platform: template unit_of_measurement: "cm" state_class: measurement id: distance_from_bottom name: "Salt Level in CM" icon: mdi:arrow-collapse-up disabled_by_default: true #update_interval: 5s filters: - lambda: 'return (0.94 - x) * 100;' - clamp: min_value: 0.0 max_value: 150.0 on_value: then: - sensor.template.publish: id: level_in_bags state: !lambda 'return id(distance_from_bottom).state;' - platform: template unit_of_measurement: "cm" state_class: measurement id: distance_from_top name: "Salt Level From Top in CM" icon: mdi:arrow-collapse-down disabled_by_default: true #update_interval: 5s filters: - lambda: 'return x * 100;' - round: 1 - clamp: min_value: 0.0 max_value: 150.0 - platform: template unit_of_measurement: "bags" state_class: measurement id: level_in_bags name: "Salt Level in Bags" icon: mdi:counter disabled_by_default: true #update_interval: 5s filters: - lambda: 'return x / 17.5;' - round: 1 - clamp: min_value: 0.0 max_value: 10.0 binary_sensor: - platform: gpio name: "Door" device_class: door pin: number: ${door_pin} mode: INPUT_PULLUP # filters: # - invert: