airfresher moved to esphome
This commit is contained in:
@@ -19,7 +19,7 @@ watchdog_wemos_uptime:
|
||||
module: watchdog
|
||||
constraint: input_boolean.watchdog_report
|
||||
entities:
|
||||
- sensor.uptime_airfresher
|
||||
# - sensor.uptime_airfresher
|
||||
- sensor.uptime_bath
|
||||
- sensor.uptime_domofon
|
||||
- sensor.uptime_kitchen_led
|
||||
|
||||
@@ -66,4 +66,5 @@ class AirFresher(hass.Hass):
|
||||
return
|
||||
|
||||
self.log('freshing in {}'.format(self.fresh_times))
|
||||
self.call_service("mqtt/publish", topic = "home/airfresher/airfresher/fresh/set", payload = "1")
|
||||
self.turn_on(self.args['entity_id'])
|
||||
# self.call_service("mqtt/publish", topic = "home/airfresher/airfresher/fresh/set", payload = "1")
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
airfresher:
|
||||
module: airfresher
|
||||
class: AirFresher
|
||||
# on_time: "09:00:00"
|
||||
# off_time: "22:00:00"
|
||||
# entity: switch.ledstrip
|
||||
entity_id: switch.airfresher_fresh
|
||||
global_dependencies:
|
||||
- globals
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
# Need to turn off logging because senseair uses uart and have conflicts with logging
|
||||
logger:
|
||||
|
||||
esphome:
|
||||
name: airfresher
|
||||
platform: ESP8266
|
||||
board: d1_mini
|
||||
|
||||
wifi:
|
||||
ssid: !secret wifi_24_name
|
||||
password: !secret wifi_24_pass
|
||||
|
||||
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
||||
ap:
|
||||
ssid: "Airfresher Fallback Hotspot"
|
||||
password: !secret esphome_captive_pass
|
||||
|
||||
captive_portal:
|
||||
|
||||
# Enable Home Assistant API
|
||||
api:
|
||||
password: !secret esphome_pass
|
||||
|
||||
ota:
|
||||
password: !secret esphome_pass
|
||||
|
||||
|
||||
globals:
|
||||
- id: remain
|
||||
type: int
|
||||
restore_value: yes
|
||||
initial_value: '2000'
|
||||
|
||||
sensor:
|
||||
- platform: uptime
|
||||
name: Airfresher Uptime
|
||||
|
||||
- platform: template
|
||||
name: "Airfresher Remain"
|
||||
icon: "mdi:battery-80"
|
||||
lambda: |-
|
||||
return id(remain);
|
||||
update_interval: 60s
|
||||
|
||||
switch:
|
||||
- platform: gpio
|
||||
pin: D1
|
||||
id: fresh_motor
|
||||
|
||||
- platform: template
|
||||
name: "Airfresher fresh"
|
||||
icon: "mdi:air-humidifier"
|
||||
turn_on_action:
|
||||
- lambda: 'id(remain) -= 1;'
|
||||
- switch.turn_on: fresh_motor
|
||||
- delay: 300ms
|
||||
- switch.turn_off: fresh_motor
|
||||
|
||||
- platform: template
|
||||
name: "Airfresher reset"
|
||||
icon: "mdi:backup-restore"
|
||||
turn_on_action:
|
||||
- lambda: 'id(remain) = 2000;'
|
||||
@@ -1,13 +0,0 @@
|
||||
#################################################
|
||||
# AirFresher #
|
||||
#################################################
|
||||
- platform: mqtt
|
||||
state_topic: 'home/airfresher/airfresher/remain'
|
||||
name: 'airfresher_remain'
|
||||
# value_template: '{{ (value | float ) / 1000 }}'
|
||||
unit_of_measurement: 'times'
|
||||
|
||||
- platform: template
|
||||
sensors:
|
||||
airfresher_remain_percent:
|
||||
value_template: "{{ ((100 / 1400) * (states('sensor.airfresher_remain') | int )) | round(2) }}"
|
||||
@@ -10,9 +10,6 @@
|
||||
- platform: mqtt
|
||||
state_topic: 'home/nest/$uptime'
|
||||
name: 'uptime_nest'
|
||||
- platform: mqtt
|
||||
state_topic: 'home/airfresher/$uptime'
|
||||
name: 'uptime_airfresher'
|
||||
- platform: mqtt
|
||||
state_topic: 'tele/bathlight/UPTIME'
|
||||
name: 'uptime_bathlight'
|
||||
|
||||
Reference in New Issue
Block a user