commit fc216c51fc9c7d7f4ef98ac61a77b2769f48f0e1 Author: Laurent Date: Sun Dec 5 14:33:07 2021 +0000 add Readme and files diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/espled.yaml b/espled.yaml new file mode 100644 index 0000000..28bb5b5 --- /dev/null +++ b/espled.yaml @@ -0,0 +1,66 @@ +esphome: + name: espled + platform: ESP8266 + board: d1_mini + +# Enable logging +logger: + +# Enable Home Assistant API +api: + password: "feelhome123" + +ota: + password: "feelhome123" + +wifi: + ssid: "lauIOT" + password: "superiot1" + domain: .home.cabestan.be + + # Enable fallback hotspot (captive portal) in case wifi connection fails + ap: + ssid: "Espsalon Fallback Hotspot" + password: "jTlMOFiFOzog" + +captive_portal: + +web_server: + port: 80 + + +time: + - platform: sntp + id: esptime + timezone: "Europe/Brussels" + +light: + - platform: rgbw + name: "Bedroom Lights" + red: output_component_r + green: output_component_g + blue: output_component_b + white: output_component_w + +# Example output entry +output: + - platform: esp8266_pwm + id: output_component_r + pin: D1 + max_power: 100% + + - platform: esp8266_pwm + id: output_component_g + pin: D2 + max_power: 80% + + - platform: esp8266_pwm + id: output_component_b + pin: D3 + max_power: 80% + + - platform: esp8266_pwm + id: output_component_w + pin: D4 + max_power: 100% + \ No newline at end of file diff --git a/espsalon.yaml b/espsalon.yaml new file mode 100644 index 0000000..381d996 --- /dev/null +++ b/espsalon.yaml @@ -0,0 +1,155 @@ +esphome: + name: espsalon + platform: ESP8266 + board: d1_mini + +# Enable logging +logger: + +# Enable Home Assistant API +api: + password: "feelhome123" + +ota: + password: "feelhome123" + +wifi: + ssid: "lauIOT" + password: "superiot1" + domain: .home.cabestan.be + + # Enable fallback hotspot (captive portal) in case wifi connection fails + ap: + ssid: "Espsalon Fallback Hotspot" + password: "jTlMOFiFOzog" + +captive_portal: + +web_server: + port: 80 + +i2c: + sda: D2 + scl: D1 + scan: true + id: bus_a + +time: + - platform: sntp + id: esptime + timezone: "Europe/Brussels" + on_time: + - seconds: /1 + then: + - display.page.show_next: saloon_display + +font: + - file: "Roboto-Black.ttf" + id: my_font_16 + size: 16 + - file: "Roboto-Black.ttf" + id: my_font_14 + size: 14 + - file: "materialdesignicons-webfont.ttf" + id: icons_14 + size: 14 + glyphs: + - "\U000F050F" # mdi-home-thermometer + - "\U000F058E" # mdi-water-percent + - "\U000F015F" # mdi-cloud + - "\U000F1252" # mdi-home-lightbulb-outline + - "\U000F0A60" # mdi-ip-network + +mqtt: + broker: hass20.home.cabestan.be + username: espsalon + password: sala45224 + +switch: + - platform: gpio + name: "Esp Salon Led" + pin: 2 + +binary_sensor: + - platform: gpio + name: "Living Room Window" + pin: + number: 4 + inverted: true + mode: + input: true + pullup: true + - platform: status + name: "Living Room Status" + id: nw_connected + +sensor: + - platform: dht + pin: D7 + temperature: + id: temperature + name: "Living Room Temperature" + humidity: + id: humidity + name: "Living Room Humidity" + update_interval: 10s + + - platform: bmp280 + temperature: + name: "Living Room Temperature S2" + oversampling: 16x + pressure: + id: pressure + name: "Pressure" + address: 0x76 + update_interval: 60s + + + - platform: adc + id: ambiantlight + pin: A0 + name: "Living Room Brightness" + device_class: "illuminance" + unit_of_measurement: "lx" + update_interval: 2s + accuracy_decimals: 1 + filters: + - multiply: 500.0 + # - sliding_window_moving_average: + # window_size: 15 + # send_every: 5 + + + +display: + - platform: ssd1306_i2c + model: "SSD1306 128x64" + reset_pin: D0 + address: 0x3C + id: saloon_display + rotation: 90 + pages: + # - id: page1 + # lambda: |- + # it.printf( 5,20, id(my_font_20), "hello world"); + - id: page1 + lambda: |- + it.strftime( 32, 0, id(my_font_16), TextAlign::TOP_CENTER , "%H:%M:%S" , id(esptime).now() ); + it.printf( 0, 25, id(icons_14), TextAlign::TOP_LEFT , "\U000F050F"); + it.printf( 18, 25, id(my_font_14), TextAlign::TOP_LEFT , "%.1f°" , id(temperature).state ); + + it.printf( 0, 45, id(icons_14), TextAlign::TOP_LEFT , "\U000F058E"); + it.printf( 18, 45, id(my_font_14), TextAlign::TOP_LEFT , "%.1f%%", id(humidity).state ); + + it.printf( 0, 65, id(icons_14), TextAlign::TOP_LEFT , "\U000F015F"); + it.printf( 18, 65, id(my_font_14), TextAlign::TOP_LEFT , "%.0f" , id(pressure).state ); + + it.printf( 0, 85, id(icons_14), TextAlign::TOP_LEFT , "\U000F1252"); + it.printf( 18, 85, id(my_font_14), TextAlign::TOP_LEFT , "%.0f" , id(ambiantlight).state ); + + it.printf( 0, 105, id(icons_14), TextAlign::TOP_LEFT , "\U000F0A60"); + # it.printf( 18, 105, id(my_font_14), TextAlign::TOP_LEFT , "%s" , id(nw_connected).state ); + + + + diff --git a/espsalon1.yaml b/espsalon1.yaml new file mode 100644 index 0000000..a13f0da --- /dev/null +++ b/espsalon1.yaml @@ -0,0 +1,41 @@ +esphome: + name: espsalon1 + platform: ESP8266 + board: d1_mini + +# Enable logging +logger: + +# Enable Home Assistant API +api: + password: "feelhome123" + +ota: + password: "feelhome123" + +wifi: + ssid: "lauIOT" + password: "superiot1" + + # Enable fallback hotspot (captive portal) in case wifi connection fails + ap: + ssid: "Espsalon1 Fallback Hotspot" + password: "EGaKtG18gWXi" + +switch: + - platform: gpio + name: "Esp Salon Led" + pin: 2 + +binary_sensor: + - platform: gpio + name: "Living Room Window" + pin: + number: 4 + inverted: true + mode: + input: true + pullup: true + + +captive_portal: diff --git a/espsalon32.yaml b/espsalon32.yaml new file mode 100644 index 0000000..a094ac4 --- /dev/null +++ b/espsalon32.yaml @@ -0,0 +1,155 @@ +esphome: + name: espsalon + platform: ESP32 + board: nodemcu-32s + +# Enable logging +logger: + +# Enable Home Assistant API +api: + password: "feelhome123" + +ota: + password: "feelhome123" + +wifi: + ssid: "lauIOT" + password: "superiot1" + domain: .home.cabestan.be + + # Enable fallback hotspot (captive portal) in case wifi connection fails + ap: + ssid: "Espsalon Fallback Hotspot" + password: "jTlMOFiFOzog" + +captive_portal: + +web_server: + port: 80 + +i2c: + sda: GPIO18 + scl: GPIO19 + scan: true + id: bus_a + +time: + - platform: sntp + id: esptime + timezone: "Europe/Brussels" + on_time: + - seconds: /1 + then: + - display.page.show_next: saloon_display + +font: + - file: "Roboto-Black.ttf" + id: my_font_16 + size: 16 + - file: "Roboto-Black.ttf" + id: my_font_14 + size: 14 + - file: "materialdesignicons-webfont.ttf" + id: icons_14 + size: 14 + glyphs: + - "\U000F050F" # mdi-home-thermometer + - "\U000F058E" # mdi-water-percent + - "\U000F015F" # mdi-cloud + - "\U000F1252" # mdi-home-lightbulb-outline + - "\U000F0A60" # mdi-ip-network + +mqtt: + broker: hass20.home.cabestan.be + username: espsalon + password: sala45224 + +switch: + - platform: gpio + name: "Esp Salon Led" + pin: 2 + +binary_sensor: + - platform: gpio + name: "Living Room Window" + pin: + number: 4 + inverted: true + mode: + input: true + pullup: true + - platform: status + name: "Living Room Status" + id: nw_connected + +sensor: + - platform: dht + pin: GPIO21 + temperature: + id: temperature + name: "Living Room Temperature" + humidity: + id: humidity + name: "Living Room Humidity" + update_interval: 10s + + - platform: bmp280 + temperature: + name: "Living Room Temperature S2" + oversampling: 16x + pressure: + id: pressure + name: "Pressure" + address: 0x76 + update_interval: 60s + + + - platform: adc + id: ambiantlight + pin: A0 + name: "Living Room Brightness" + device_class: "illuminance" + unit_of_measurement: "lx" + update_interval: 2s + accuracy_decimals: 1 + filters: + - multiply: 500.0 + # - sliding_window_moving_average: + # window_size: 15 + # send_every: 5 + + + +display: + - platform: ssd1306_i2c + model: "SSD1306 128x64" + reset_pin: GPIO5 + address: 0x3C + id: saloon_display + rotation: 90 + pages: + # - id: page1 + # lambda: |- + # it.printf( 5,20, id(my_font_20), "hello world"); + - id: page1 + lambda: |- + it.strftime( 32, 0, id(my_font_16), TextAlign::TOP_CENTER , "%H:%M:%S" , id(esptime).now() ); + it.printf( 0, 25, id(icons_14), TextAlign::TOP_LEFT , "\U000F050F"); + it.printf( 18, 25, id(my_font_14), TextAlign::TOP_LEFT , "%.1f°" , id(temperature).state ); + + it.printf( 0, 45, id(icons_14), TextAlign::TOP_LEFT , "\U000F058E"); + it.printf( 18, 45, id(my_font_14), TextAlign::TOP_LEFT , "%.1f%%", id(humidity).state ); + + it.printf( 0, 65, id(icons_14), TextAlign::TOP_LEFT , "\U000F015F"); + it.printf( 18, 65, id(my_font_14), TextAlign::TOP_LEFT , "%.0f" , id(pressure).state ); + + it.printf( 0, 85, id(icons_14), TextAlign::TOP_LEFT , "\U000F1252"); + it.printf( 18, 85, id(my_font_14), TextAlign::TOP_LEFT , "%.0f" , id(ambiantlight).state ); + + it.printf( 0, 105, id(icons_14), TextAlign::TOP_LEFT , "\U000F0A60"); + # it.printf( 18, 105, id(my_font_14), TextAlign::TOP_LEFT , "%s" , id(nw_connected).state ); + + + + diff --git a/esptest.yaml b/esptest.yaml new file mode 100644 index 0000000..a8c83ff --- /dev/null +++ b/esptest.yaml @@ -0,0 +1,25 @@ +esphome: + name: esptest + platform: ESP32 + board: nodemcu-32s + +# Enable logging +logger: + +# Enable Home Assistant API +api: + password: "" + +ota: + password: "" + +wifi: + ssid: "lauIOT" + password: "superiot1" + + # Enable fallback hotspot (captive portal) in case wifi connection fails + ap: + ssid: "Esptest Fallback Hotspot" + password: "xAi4C5MuZGcB" + +captive_portal: diff --git a/espwater.yaml b/espwater.yaml new file mode 100644 index 0000000..d912d45 --- /dev/null +++ b/espwater.yaml @@ -0,0 +1,214 @@ +esphome: + name: espwater + platform: ESP32 + board: nodemcu-32s + +logger: + +api: + password: "feelhome123" + +ota: + password: "5h4554h5x4th5x4d" + +wifi: + ssid: "lauIOT" + password: "superiot1" + domain: .home.cabestan.be + ap: + ssid: "Espwater Fallback Hotspot" + password: "jTlMOFiFOzog" + +captive_portal: + +web_server: + port: 80 + +mqtt: + broker: hass20.home.cabestan.be + username: espsalon + password: sala45224 + on_message: + topic: espwater/set_total_drop + qos: 0 + then: + lambda: |- + // sprintf(id(lcd_line1),"|%s|%u|",x.c_str(),atol(x.c_str())); + id(drops_absolute) = atol(x.c_str())*4; + sprintf(id(lcd_line1),"Set Total:%u",id(drops_absolute)/4); + +globals: + # - id: software_version + # type: float + # initial_value: '0.11' + - id: drops_absolute + type: unsigned long int + restore_value: yes + initial_value: '0' + - id: drops_today + type: int + restore_value: no + initial_value: '0' + # - id: drops_1min + # type: int + # restore_value: no + # initial_value: '0' + - id: lcd_line1 + type: char[17] + initial_value: "{' ',' ',' ','I','N','I','T','I','A','L','I','Z','E','\0'}" + # it.strftime(0, 60, id(font2), TextAlign::BASELINE_LEFT, "%H:%M", id(esptime).now()); + restore_value: no + - id: lcd_line2 + type: char[17] + restore_value: no + initial_value: "{'v','e','r',':',' ','0','.','4','0','\0'}" + +time: + - platform: sntp + id: sntp_time + timezone: "Europe/Brussels" + on_time: + - seconds: 0 + minutes: 0 + hours: 0 + then: + lambda: |- + id(drops_today) = 0; + +switch: + - platform: restart + name: "ESP Water Restart" + + - platform: gpio + id: relay_2 + name: "Relay 2" + pin: 25 + inverted: true + + - platform: gpio + id: co2_drop + name: "Relay CO2" + pin: 26 + inverted: true + on_turn_on: + - delay: 60ms + - switch.turn_off: co2_drop + + - platform: template + name: "Drop CO2" + id: drop_co2 + turn_on_action: + - switch.turn_on: co2_drop + - switch.turn_off: drop_co2 + - sensor.template.publish: + id: template_water_absolute + state: !lambda 'return id(drops_absolute)/4;' + - sensor.template.publish: + id: template_water_today + state: !lambda 'return id(drops_today)/4;' + + +display: + - platform: lcd_gpio + dimensions: 16x2 + data_pins: + - 17 + - 16 + - 4 + - 0 + enable_pin: 5 + rs_pin: 18 + id: my_display + lambda: |- + it.printf(0,0,"%s",id(lcd_line1)); + it.printf(0,1,"%s",id(lcd_line2)); + update_interval: 1s + +# sensor: + # - platform: rotary_encoder + # name: "Rotary Encoder" + # pin_a: + # number: 5 + # pullup: true + # pin_b: + # number: 7 + # pullup: true + +sensor: + - platform: template + id: template_water_absolute + name: "Water Total Liters" + lambda: |- + return id(drops_absolute)/4; + update_interval: 60s + - platform: template + id: template_water_today + name: "Water Today Liters" + lambda: |- + return id(drops_today)/4; + update_interval: 60s + +binary_sensor: + - platform: gpio + name: "rotary Left" + id: rot_left + pin: + number: 12 + mode: + input: true + pullup: true + filters: + - delayed_on: 5ms + - delayed_off: 5ms + - platform: gpio + name: "rotary Right" + id: rot_right + pin: + number: 14 + mode: + input: true + pullup: true + filters: + - delayed_on: 5ms + - delayed_off: 5ms + - platform: gpio + name: "rotary Push Button" + id: rot_push + pin: + number: 27 + mode: + input: true + pullup: true + filters: + - delayed_on: 20ms + - delayed_off: 100ms + - platform: gpio + name: "push Button" + id: push_button + pin: + number: 13 + mode: + input: true + pullup: true + filters: + - delayed_on: 20ms + - delayed_off: 100ms + on_press: + - switch.turn_on: drop_co2 + - platform: gpio + name: "Water Hall Sensor" + id: water_relay + pin: 34 + filters: + - delayed_on: 2ms + - delayed_off: 50ms + on_press: + - switch.turn_on: drop_co2 + - lambda: |- + id(drops_absolute) += 1; + id(drops_today) += 1; + sprintf(id(lcd_line1),"%s%10.1f","Total:",float(id(drops_absolute)*0.25)); + sprintf(id(lcd_line2),"%s%10.1f","Today:",float(id(drops_today)*0.25)); + + + diff --git a/espwater_old.yaml b/espwater_old.yaml new file mode 100644 index 0000000..85c4751 --- /dev/null +++ b/espwater_old.yaml @@ -0,0 +1,116 @@ +esphome: + name: espwater + platform: ESP8266 + board: d1_mini + esp8266_restore_from_flash: true + +# Enable logging +logger: + +# Enable Home Assistant API +api: + password: "feelhome123" + +ota: + password: "feelhome123" + +wifi: + ssid: "lauIOT" + password: "superiot1" + domain: .home.cabestan.be + + # Enable fallback hotspot (captive portal) in case wifi connection fails + ap: + ssid: "Espsalon Fallback Hotspot" + password: "jTlMOFiFOzog" + +captive_portal: + +web_server: + port: 80 + +mqtt: + broker: hass20.home.cabestan.be + username: espsalon + password: sala45224 + +globals: + - id: drops_absolute + type: unsigned long int + restore_value: no + initial_value: '0' + - id: drops_today + type: int + restore_value: no + initial_value: '0' + - id: drops_1min + type: int + restore_value: no + initial_value: '0' + +# display: + # - platform: lcd_gpio + # dimensions: 18x4 + # data_pins: + # - D0 + # - D1 + # - D2 + # - D3 + # enable_pin: D4 + # rs_pin: D5 + # lambda: |- + # it.print("Hello World!"); + +switch: + - platform: gpio + name: "CO2 Led" + pin: 2 + - platform: gpio + id: co2_drop + name: "CO2 Relay" + pin: D8 + +binary_sensor: + - platform: gpio + name: "Water Hall Sensor" + id: water_relay + pin: + number: D2 + mode: + input: true + pullup: true + filters: + - delayed_on: 2ms + - delayed_off: 50ms + on_press: + then: + - switch.turn_on: co2_drop + - delay: 100ms + - switch.turn_off: co2_drop + - lambda: |- + id(drops_absolute) += 1; + id(drops_today) += 1; + id(drops_1min) += 1; + - mqtt.publish: + topic: test/liters_today + payload: !lambda |- + return to_string(float(id(drops_today)*0.25)); + - mqtt.publish: + topic: test/liters_absolute + payload: !lambda |- + return to_string(float(id(drops_absolute)*0.25)); + +time: + - platform: sntp + on_time: + # reset counter every day + - seconds: 0 + minutes: 0 + hours: 0 + then: + - lambda: |- + drops_today = 0; + + + + diff --git a/test.yaml b/test.yaml new file mode 100644 index 0000000..665f7e1 --- /dev/null +++ b/test.yaml @@ -0,0 +1,52 @@ +esphome: + name: espwater + platform: ESP32 + board: nodemcu-32s + + +# used for debuging purpose +logger: + # baud_rate: 9600 + +api: + password: "feelhome123" + +# ota: + # password: "feelhome123" + +wifi: + ssid: "lauIOT" + password: "superiot1" + domain: .home.cabestan.be + # ap: + # ssid: "Espwater Fallback Hotspot" + # password: "jTlMOFiFOzog" + +# captive_portal: + +web_server: + port: 80 + +# globals: + # - id: drops_absolute + # type: unsigned long int + # restore_value: no + # initial_value: '0' + # - id: drops_today + # type: int + # restore_value: no + # initial_value: '0' + # - id: drops_1min + # type: int + # restore_value: no + # initial_value: '0' + + +# switch: + # - platform: gpio + # name: "CO2 Led" + # pin: 12 + # - platform: gpio + # id: co2_drop + # name: "CO2 Relay" + # pin: 13