diff --git a/esp8266-test.yaml b/esp8266-test.yaml new file mode 100644 index 0000000..24af5c3 --- /dev/null +++ b/esp8266-test.yaml @@ -0,0 +1,24 @@ +esphome: + name: esp8266-test + platform: ESP8266 + board: esp01_1m + +# Enable logging +logger: + +# Enable Home Assistant API +api: + +ota: + password: "48f8d0884bc08dc53e56c299a9783401" + +wifi: + ssid: "EasyBox-368239" + password: "inginf95" + + # Enable fallback hotspot (captive portal) in case wifi connection fails + ap: + ssid: "Esp8266-Test Fallback Hotspot" + password: "HFW1pCVNECIu" + +captive_portal: diff --git a/esphome-heatingsystem.yaml b/esphome-heatingsystem.yaml new file mode 100644 index 0000000..c24c6e2 --- /dev/null +++ b/esphome-heatingsystem.yaml @@ -0,0 +1,120 @@ +esphome: + name: esphome-heatingsystem + platform: ESP8266 + board: esp01_1m + board_flash_mode: dout + on_boot: + - switch.turn_on: relay + - light.turn_on: led + - switch.turn_on: fakebutton + +mqtt: + broker: 192.168.178.36 + port: 1884 + username: nils + password: inginf95 + on_message: + topic: esphome-heatingsystem/restart + qos: 0 + then: + - switch.turn_off: relay + +# Enable logging +logger: + hardware_uart: UART1 + +# Enable Home Assistant API +#api: + +web_server: + port: 80 + auth: + username: nils + password: inginf95 + +ota: + password: "0848c056d780accd7fbb0dbaf989156b" + +wifi: + ssid: "EasyBox-368239" + password: "inginf95" + + # Enable fallback hotspot (captive portal) in case wifi connection fails + ap: + ssid: "Sonoff-Basic-Test" + password: "Wky9j6BNCgI0" + +captive_portal: + +binary_sensor: + - platform: gpio + pin: + number: GPIO0 + mode: INPUT_PULLUP + inverted: True + name: "Sonoff Basic Button" + on_press: + - switch.toggle: fakebutton + +switch: + - platform: template + name: "Sonoff Basic Relay" + optimistic: true + id: fakebutton + turn_on_action: + - switch.turn_on: relay + - light.turn_on: led + turn_off_action: + - switch.turn_off: relay + - light.turn_off: led + - platform: gpio + id: relay + pin: GPIO12 + name: "Heating System Relay" + on_turn_off: + - delay: 2500ms + - switch.turn_on: relay + +output: + - platform: esp8266_pwm + id: basic_green_led + pin: + number: GPIO13 + inverted: True + +light: + - platform: monochromatic + name: "Sonoff Basic Green LED" + output: basic_green_led + id: led + +sensor: + - platform: wifi_signal + name: "Sonoff Basic WiFi Signal" + update_interval: 60s + - platform: uptime + name: "Sonoff Basic Uptime" + - platform: dallas + address: 0x4F01204FEB52A128 + name: "Test Sensor Temperature" + filters: + - filter_out: nan + - platform: dallas + address: 0x1901204FFD99B328 + name: "Test Sensor2 Temperature" + filters: + - filter_out: nan + - platform: dallas + address: 0x9001204EFDB37828 + name: "Test Sensor3 Temperature" + filters: + - filter_out: nan + +dallas: + - pin: GPIO1 + update_interval: 30s + +text_sensor: + - platform: version + name: "Sonoff Basic ESPHome Version" + \ No newline at end of file diff --git a/esphome-test.yaml b/esphome-test.yaml index 1d95c2b..53bb951 100644 --- a/esphome-test.yaml +++ b/esphome-test.yaml @@ -40,7 +40,7 @@ switch: sensor: - platform: mqtt_subscribe - name: "Temperatur Büro" + name: "Temperatur Büro" id: DachTemperatur topic: stat/Dach/MA/temperature - platform: wifi_signal diff --git a/garage.yaml b/garage.yaml index 46eb1e2..e27957f 100644 --- a/garage.yaml +++ b/garage.yaml @@ -65,7 +65,7 @@ globals: #2 = closed, assume the garage is closed mqtt: - broker: 192.168.178.76 + broker: 192.168.178.36 port: 1884 username: nils password: inginf95 @@ -94,7 +94,7 @@ text_sensor: then: - mqtt.publish: topic: stat/Garage/status - payload: "Garage soll geöffnet werden" + payload: "Garage soll geöffnet werden" - if: condition: lambda: 'return (id(GarageStatus)==2);' diff --git a/hs_oben.yaml b/hs_oben.yaml index 2c83384..71047a3 100644 --- a/hs_oben.yaml +++ b/hs_oben.yaml @@ -45,7 +45,7 @@ switch: mqtt: - broker: 192.168.178.76 + broker: 192.168.178.36 port: 1884 username: nils password: inginf95 @@ -55,7 +55,7 @@ mqtt: then: - if: condition: - lambda: 'return (esphome::parse_float(x)) < (id(TargetHK1).state);' + lambda: 'return (esphome::parse_number(x)) < (id(TargetHK1).state);' then: - logger.log: "Turn on vent 1!" - switch.turn_on: vent1 @@ -72,7 +72,7 @@ mqtt: then: - if: condition: - lambda: 'return (esphome::parse_float(x)) < (id(TargetHK2).state);' + lambda: 'return (esphome::parse_number(x)) < (id(TargetHK2).state);' then: - logger.log: "Turn on vent 2!" - switch.turn_on: vent2 @@ -89,7 +89,7 @@ mqtt: then: - if: condition: - lambda: 'return (esphome::parse_float(x)) < (id(TargetHK3).state);' + lambda: 'return (esphome::parse_number(x)) < (id(TargetHK3).state);' then: - logger.log: "Turn on vent 3!" - switch.turn_on: vent3 @@ -106,7 +106,7 @@ mqtt: then: - if: condition: - lambda: 'return (esphome::parse_float(x)) < (id(TargetHK4).state);' + lambda: 'return (esphome::parse_number(x)) < (id(TargetHK4).state);' then: - logger.log: "Turn on vent 4!" - switch.turn_on: vent4 diff --git a/hs_unten.yaml b/hs_unten.yaml index 544847d..1f478a9 100644 --- a/hs_unten.yaml +++ b/hs_unten.yaml @@ -45,7 +45,7 @@ switch: mqtt: - broker: 192.168.178.76 + broker: 192.168.178.36 port: 1884 username: nils password: inginf95 @@ -55,7 +55,7 @@ mqtt: then: - if: condition: - lambda: 'return (esphome::parse_float(x)) < (id(TargetHK1).state);' + lambda: 'return (esphome::parse_number(x)) < (id(TargetHK1).state);' then: - logger.log: "Turn on vent 1!" - switch.turn_on: vent1 @@ -72,7 +72,7 @@ mqtt: then: - if: condition: - lambda: 'return (esphome::parse_float(x)) < (id(TargetHK2).state);' + lambda: 'return (esphome::parse_number(x)) < (id(TargetHK2).state);' then: - logger.log: "Turn on vent 2!" - switch.turn_on: vent2 @@ -89,7 +89,7 @@ mqtt: then: - if: condition: - lambda: 'return (esphome::parse_float(x)) < (id(TargetHK3).state);' + lambda: 'return (esphome::parse_number(x)) < (id(TargetHK3).state);' then: - logger.log: "Turn on vent 3!" - switch.turn_on: vent3 @@ -106,7 +106,7 @@ mqtt: then: - if: condition: - lambda: 'return (esphome::parse_float(x)) < (id(TargetHK4).state);' + lambda: 'return (esphome::parse_number(x)) < (id(TargetHK4).state);' then: - logger.log: "Turn on vent 4!" - switch.turn_on: vent4 diff --git a/sonoff-3x-wohnzimmer.yaml b/sonoff-3x-wohnzimmer.yaml new file mode 100644 index 0000000..57fb209 --- /dev/null +++ b/sonoff-3x-wohnzimmer.yaml @@ -0,0 +1,125 @@ +esphome: + name: sonoff-3x-wohnzimmer + platform: ESP8266 + board: esp01_1m + board_flash_mode: dout + +mqtt: + broker: 192.168.178.36 + port: 1884 + username: nils + password: inginf95 + on_message: + - topic: sonoff-3x-wohnzimmer/relay1 + payload: "on" + then: + - switch.turn_on: relay + - topic: sonoff-3x-wohnzimmer/relay1 + payload: "off" + then: + - switch.turn_off: relay + - topic: sonoff-3x-wohnzimmer/relay2 + payload: "on" + then: + - switch.turn_on: relay2 + - topic: sonoff-3x-wohnzimmer/relay2 + payload: "off" + then: + - switch.turn_off: relay2 + - topic: sonoff-3x-wohnzimmer/relay3 + payload: "on" + then: + - switch.turn_on: relay3 + - topic: sonoff-3x-wohnzimmer/relay3 + payload: "off" + then: + - switch.turn_off: relay3 + +# Disable logging +logger: + baud_rate: 0 + +# Enable Home Assistant API +#api: + +web_server: + port: 80 + auth: + username: nils + password: inginf95 + +ota: + password: "0848c056d780accd7fbb0dbaf989156b" + +wifi: + ssid: "EasyBox-368239_WZ" + password: "inginf95" + + # Enable fallback hotspot (captive portal) in case wifi connection fails + ap: + ssid: "Sonoff-3x-Wohnzimmer" + password: "Wky9j6BNCgI0" + +captive_portal: + +binary_sensor: + - platform: gpio + pin: + number: GPIO0 + mode: INPUT_PULLUP + inverted: True + name: "Sonoff Basic Button" + on_press: + - switch.toggle: fakebutton + +switch: + - platform: template + name: "Sonoff Basic Relay" + optimistic: true + id: fakebutton + turn_on_action: + - switch.turn_on: relay + - light.turn_on: led + turn_off_action: + - switch.turn_off: relay + - light.turn_off: led + - platform: gpio + name: "Relay1" + id: relay + pin: GPIO12 + - platform: gpio + name: "Relay2" + id: relay2 + pin: + number: GPIO1 + - platform: gpio + id: relay3 + name: "Relay3" + pin: + number: GPIO3 + + +output: + - platform: esp8266_pwm + id: basic_green_led + pin: + number: GPIO13 + inverted: True + +light: + - platform: monochromatic + name: "Sonoff Basic Green LED" + output: basic_green_led + id: led + +sensor: + - platform: wifi_signal + name: "Sonoff Basic WiFi Signal" + update_interval: 60s + - platform: uptime + name: "Sonoff Basic Uptime" + + +text_sensor: + - platform: version + name: "Sonoff Basic ESPHome Version" \ No newline at end of file diff --git a/sonoff-arduino-bridge.yaml b/sonoff-arduino-bridge.yaml new file mode 100644 index 0000000..1ec4dce --- /dev/null +++ b/sonoff-arduino-bridge.yaml @@ -0,0 +1,127 @@ +esphome: + name: sonoff-arduino-bridge + platform: ESP8266 + board: esp01_1m + board_flash_mode: dout + includes: + - uart_read_line_sensor.h + +mqtt: + broker: 192.168.178.36 + port: 1884 + username: nils + password: inginf95 + on_message: + - topic: sonoff-arduino-bridge/cmnd + qos: 0 + then: + - uart.write: !lambda |- + std::vector data(x.begin(), x.end()); + return data; + - topic: sonoff-arduino-bridge/pc-on + qos: 0 + then: + - uart.write: "OPTO1=ON\r" + - delay: 2s + - uart.write: "OPTO1=OFF\r" + - topic: sonoff-arduino-bridge/pc-off + qos: 0 + then: + - uart.write: "OPTO1=ON\n" + - delay: 5s + - uart.write: "OPTO1=OFF\n" + +# Enable logging +logger: + baud_rate: 0 + +# Enable Home Assistant API +#api: + +web_server: + port: 80 + auth: + username: nils + password: inginf95 + +uart: + tx_pin: GPIO01 + rx_pin: GPIO03 + baud_rate: 9600 + id: uart_bus + +ota: + password: "0848c056d780accd7fbb0dbaf989156b" + +wifi: + ssid: "EasyBox-368239" + password: "inginf95" + + # Enable fallback hotspot (captive portal) in case wifi connection fails + ap: + ssid: "Sonoff-Basic-Test" + password: "Wky9j6BNCgI0" + +captive_portal: + +binary_sensor: + - platform: gpio + pin: + number: GPIO0 + mode: INPUT_PULLUP + inverted: True + name: "Sonoff Basic Button" + on_press: + - switch.toggle: fakebutton + +switch: + - platform: template + name: "Sonoff Basic Relay" + optimistic: true + id: fakebutton + turn_on_action: + - switch.turn_on: relay + - light.turn_on: led + turn_off_action: + - switch.turn_off: relay + - light.turn_off: led + - platform: gpio + id: relay + pin: GPIO12 + +output: + - platform: esp8266_pwm + id: basic_green_led + pin: + number: GPIO13 + inverted: True + +light: + - platform: monochromatic + name: "Sonoff Basic Green LED" + output: basic_green_led + id: led + +sensor: + - platform: wifi_signal + name: "Sonoff Basic WiFi Signal" + update_interval: 60s + - platform: uptime + name: "Sonoff Basic Uptime" + + +text_sensor: + - platform: version + name: "Sonoff Basic ESPHome Version" + - platform: mqtt_subscribe + name: "UART Tx" + id: command + topic: sonoff-arduino-bridge/cmnd + - platform: custom + lambda: |- + auto my_custom_sensor = new UartReadLineSensor(id(uart_bus)); + App.register_component(my_custom_sensor); + return {my_custom_sensor}; + text_sensors: + id: "uart_readline" + name: "UART Rx"