diff --git a/functions b/functions index e8a049414bca2b14b158444dac1b94c2ca90d9be..900377e4f72486f6699ecf736f96adfbc04e92da 160000 --- a/functions +++ b/functions @@ -1 +1 @@ -Subproject commit e8a049414bca2b14b158444dac1b94c2ca90d9be +Subproject commit 900377e4f72486f6699ecf736f96adfbc04e92da diff --git a/intern/docker_esphome/tasks/main.yml b/intern/docker_esphome/tasks/main.yml index b709ee7a4a6eb3d34d1efa8a7510eaf5d105a85c..5176bbf678c4fbcb98787dcfd47e27f85a79053a 100644 --- a/intern/docker_esphome/tasks/main.yml +++ b/intern/docker_esphome/tasks/main.yml @@ -51,6 +51,11 @@ - config/esphome_plug02.yaml - config/esphome_plug03.yaml - config/esphome_plug04.yaml + - config/esphome_plug05.yaml + - config/esphome_plug06.yaml + - config/esphome_plug07.yaml + - config/esphome_plug08.yaml + - config/esphome_popcorn.yaml register: config - name: "stop {{ servicename }} docker" diff --git a/intern/docker_esphome/templates/config/esphome_plug04.yaml b/intern/docker_esphome/templates/config/esphome_plug04.yaml index b5785bd1943dfb5d62ac8811a96cf323ecba1d13..c31210bd9d28df9f9d941cdb467deec371c7d203 100644 --- a/intern/docker_esphome/templates/config/esphome_plug04.yaml +++ b/intern/docker_esphome/templates/config/esphome_plug04.yaml @@ -36,4 +36,5 @@ switch: name: "{{ devicename }} Relay" pin: GPIO12 id: "relay" - restore_mode: RESTORE_DEFAULT_OFF \ No newline at end of file + restore_mode: RESTORE_DEFAULT_OFF + diff --git a/intern/docker_esphome/templates/config/esphome_plug05.yaml b/intern/docker_esphome/templates/config/esphome_plug05.yaml new file mode 100644 index 0000000000000000000000000000000000000000..b6cd479286528b1d19e19b6ae6e59867d2b02414 --- /dev/null +++ b/intern/docker_esphome/templates/config/esphome_plug05.yaml @@ -0,0 +1,86 @@ +{% set devicename = "esphome_plug05" %} + +{% include "/includes/ansible.inc.yaml" %} +{% include "/includes/board.esp01_1m.inc.yaml" %} +{% include "/includes/common.inc.yaml" %} +# force newline + on_message: + - topic: ESPHome/{{ devicename }}/state/command + payload: "ON" + then: + - switch.turn_on: relay + - topic: ESPHome/{{ devicename }}/state/command + payload: "OFF" + then: + - switch.turn_off: relay + +substitutions: + plug_name: {{ devicename }} + # Higher value gives lower watt readout + current_res: "0.00221" + # Lower value gives lower voltage readout + voltage_div: "920" + +binary_sensor: + # Binary sensor for the button press + - platform: gpio + name: "${plug_name}_button" + pin: + number: GPIO3 + inverted: true + on_press: + - switch.toggle: relay + + + +switch: + - platform: gpio + id: relay + name: "${plug_name}_Relay" + restore_mode: RESTORE_DEFAULT_OFF + pin: GPIO14 + on_turn_on: + - light.turn_on: led + on_turn_off: + - light.turn_off: led +sensor: + - platform: hlw8012 + sel_pin: + number: GPIO12 + inverted: True + cf_pin: GPIO04 + cf1_pin: GPIO05 + current_resistor: ${current_res} + voltage_divider: ${voltage_div} + current: + name: "${plug_name}_Amperage" + unit_of_measurement: A + voltage: + name: "${plug_name}_Voltage" + unit_of_measurement: V + power: + name: "${plug_name}_Wattage" + unit_of_measurement: W + id: "${plug_name}_Wattage" + change_mode_every: 8 + update_interval: 10s + +output: + # Relay state led + - platform: esp8266_pwm + id: state_led + pin: + number: GPIO1 + inverted: true + +light: + # Relay state light + - platform: monochromatic + output: state_led + id: led + +# Uses the red LED as a status indicator +status_led: + pin: + number: GPIO13 + inverted: true diff --git a/intern/docker_esphome/templates/config/esphome_plug06.yaml b/intern/docker_esphome/templates/config/esphome_plug06.yaml new file mode 100644 index 0000000000000000000000000000000000000000..95e2dafad337cb39cb0861c7660d42a82f4d590e --- /dev/null +++ b/intern/docker_esphome/templates/config/esphome_plug06.yaml @@ -0,0 +1,86 @@ +{% set devicename = "esphome_plug06" %} + +{% include "/includes/ansible.inc.yaml" %} +{% include "/includes/board.esp01_1m.inc.yaml" %} +{% include "/includes/common.inc.yaml" %} +# force newline + on_message: + - topic: ESPHome/{{ devicename }}/state/command + payload: "ON" + then: + - switch.turn_on: relay + - topic: ESPHome/{{ devicename }}/state/command + payload: "OFF" + then: + - switch.turn_off: relay + +substitutions: + plug_name: {{ devicename }} + # Higher value gives lower watt readout + current_res: "0.00221" + # Lower value gives lower voltage readout + voltage_div: "920" + +binary_sensor: + # Binary sensor for the button press + - platform: gpio + name: "${plug_name}_button" + pin: + number: GPIO3 + inverted: true + on_press: + - switch.toggle: relay + + + +switch: + - platform: gpio + id: relay + name: "${plug_name}_Relay" + restore_mode: ALWAYS_OFF + pin: GPIO14 + on_turn_on: + - light.turn_on: led + on_turn_off: + - light.turn_off: led +sensor: + - platform: hlw8012 + sel_pin: + number: GPIO12 + inverted: True + cf_pin: GPIO04 + cf1_pin: GPIO05 + current_resistor: ${current_res} + voltage_divider: ${voltage_div} + current: + name: "${plug_name}_Amperage" + unit_of_measurement: A + voltage: + name: "${plug_name}_Voltage" + unit_of_measurement: V + power: + name: "${plug_name}_Wattage" + unit_of_measurement: W + id: "${plug_name}_Wattage" + change_mode_every: 8 + update_interval: 10s + +output: + # Relay state led + - platform: esp8266_pwm + id: state_led + pin: + number: GPIO1 + inverted: true + +light: + # Relay state light + - platform: monochromatic + output: state_led + id: led + +# Uses the red LED as a status indicator +status_led: + pin: + number: GPIO13 + inverted: true diff --git a/intern/docker_esphome/templates/config/esphome_plug07.yaml b/intern/docker_esphome/templates/config/esphome_plug07.yaml new file mode 100644 index 0000000000000000000000000000000000000000..7ad6bbc23b2a98869f5a06fbb44377f83d74e639 --- /dev/null +++ b/intern/docker_esphome/templates/config/esphome_plug07.yaml @@ -0,0 +1,86 @@ +{% set devicename = "esphome_plug07" %} + +{% include "/includes/ansible.inc.yaml" %} +{% include "/includes/board.esp01_1m.inc.yaml" %} +{% include "/includes/common.inc.yaml" %} +# force newline + on_message: + - topic: ESPHome/{{ devicename }}/state/command + payload: "ON" + then: + - switch.turn_on: relay + - topic: ESPHome/{{ devicename }}/state/command + payload: "OFF" + then: + - switch.turn_off: relay + +substitutions: + plug_name: {{ devicename }} + # Higher value gives lower watt readout + current_res: "0.00221" + # Lower value gives lower voltage readout + voltage_div: "920" + +binary_sensor: + # Binary sensor for the button press + - platform: gpio + name: "${plug_name}_button" + pin: + number: GPIO3 + inverted: true + on_press: + - switch.toggle: relay + + + +switch: + - platform: gpio + id: relay + name: "${plug_name}_Relay" + restore_mode: ALWAYS_OFF + pin: GPIO14 + on_turn_on: + - light.turn_on: led + on_turn_off: + - light.turn_off: led +sensor: + - platform: hlw8012 + sel_pin: + number: GPIO12 + inverted: True + cf_pin: GPIO04 + cf1_pin: GPIO05 + current_resistor: ${current_res} + voltage_divider: ${voltage_div} + current: + name: "${plug_name}_Amperage" + unit_of_measurement: A + voltage: + name: "${plug_name}_Voltage" + unit_of_measurement: V + power: + name: "${plug_name}_Wattage" + unit_of_measurement: W + id: "${plug_name}_Wattage" + change_mode_every: 8 + update_interval: 10s + +output: + # Relay state led + - platform: esp8266_pwm + id: state_led + pin: + number: GPIO1 + inverted: true + +light: + # Relay state light + - platform: monochromatic + output: state_led + id: led + +# Uses the red LED as a status indicator +status_led: + pin: + number: GPIO13 + inverted: true diff --git a/intern/docker_esphome/templates/config/esphome_plug08.yaml b/intern/docker_esphome/templates/config/esphome_plug08.yaml new file mode 100644 index 0000000000000000000000000000000000000000..424337350e9860eb61082a859999e9c70dae4d12 --- /dev/null +++ b/intern/docker_esphome/templates/config/esphome_plug08.yaml @@ -0,0 +1,86 @@ +{% set devicename = "esphome_plug08" %} + +{% include "/includes/ansible.inc.yaml" %} +{% include "/includes/board.esp01_1m.inc.yaml" %} +{% include "/includes/common.inc.yaml" %} +# force newline + on_message: + - topic: ESPHome/{{ devicename }}/state/command + payload: "ON" + then: + - switch.turn_on: relay + - topic: ESPHome/{{ devicename }}/state/command + payload: "OFF" + then: + - switch.turn_off: relay + +substitutions: + plug_name: {{ devicename }} + # Higher value gives lower watt readout + current_res: "0.00221" + # Lower value gives lower voltage readout + voltage_div: "920" + +binary_sensor: + # Binary sensor for the button press + - platform: gpio + name: "${plug_name}_button" + pin: + number: GPIO3 + inverted: true + on_press: + - switch.toggle: relay + + + +switch: + - platform: gpio + id: relay + name: "${plug_name}_Relay" + restore_mode: ALWAYS_OFF + pin: GPIO14 + on_turn_on: + - light.turn_on: led + on_turn_off: + - light.turn_off: led +sensor: + - platform: hlw8012 + sel_pin: + number: GPIO12 + inverted: True + cf_pin: GPIO04 + cf1_pin: GPIO05 + current_resistor: ${current_res} + voltage_divider: ${voltage_div} + current: + name: "${plug_name}_Amperage" + unit_of_measurement: A + voltage: + name: "${plug_name}_Voltage" + unit_of_measurement: V + power: + name: "${plug_name}_Wattage" + unit_of_measurement: W + id: "${plug_name}_Wattage" + change_mode_every: 8 + update_interval: 10s + +output: + # Relay state led + - platform: esp8266_pwm + id: state_led + pin: + number: GPIO1 + inverted: true + +light: + # Relay state light + - platform: monochromatic + output: state_led + id: led + +# Uses the red LED as a status indicator +status_led: + pin: + number: GPIO13 + inverted: true diff --git a/intern/docker_esphome/templates/config/esphome_popcorn.yaml b/intern/docker_esphome/templates/config/esphome_popcorn.yaml new file mode 100644 index 0000000000000000000000000000000000000000..2e1da231e6c819852e2ab2824a02e95f7a977036 --- /dev/null +++ b/intern/docker_esphome/templates/config/esphome_popcorn.yaml @@ -0,0 +1,44 @@ +{% set devicename = "esphome_popcorn" %} + +{% include "/includes/ansible.inc.yaml" %} +{% include "/includes/board.d1_mini.inc.yaml" %} +{% include "/includes/common.inc.yaml" %} + + +spi: + miso_pin: GPIO12 + clk_pin: GPIO14 + +climate: + - platform: pid + id: pid_climate + name: "PID Climate Controller" + sensor: pot_sensor + default_target_temperature: 21°C + heat_output: heater + control_parameters: + kp: 0.0 + ki: 0.0 + kd: 0.0 + +button: + - platform: template + name: "PID Climate Autotune" + on_press: + - climate.pid.autotune: pid_climate + +sensor: + - platform: pid + name: "PID Climate Result" + type: RESULT + - platform: max31855 + name: "Pot Temperature" + id: pot_sensor + cs_pin: GPIO15 + update_interval: 30s + +output: + - platform: slow_pwm + pin: GPIO0 + id: heater + period: 15s \ No newline at end of file diff --git a/intern/docker_esphome/templates/config/esphome_status.yaml b/intern/docker_esphome/templates/config/esphome_status.yaml index 515d5b4ea42c8b0fc2ea705dc8142d71c35a9cf0..1cbf48a27048b80c36d06b53b25643ccdc6e8c19 100644 --- a/intern/docker_esphome/templates/config/esphome_status.yaml +++ b/intern/docker_esphome/templates/config/esphome_status.yaml @@ -11,7 +11,11 @@ sensor: # Diese werden durch einen Optokoppler jede 0.00125kWh (800 Impulse / kWh) für ca. 30ms zueinander leitend. # Hier schließen wir an den einen Kontakt GPIO2 und an den anderen Gnd an. - platform: pulse_meter - pin: GPIO12 + pin: + number: GPIO13 + mode: + input: true + pullup: true unit_of_measurement: 'kW' name: 'Stromverbrauch' # Herausfilterung von fehlerhaften Impulsen < 20ms @@ -31,11 +35,13 @@ sensor: filters: # (800 Impulse / kWh)^-1 = 0.00125kWh - multiply: 0.00125 - binary_sensor: - platform: gpio - pin: GPIO13 + pin: + number: GPIO12 + mode: + input: true + pullup: true + inverted: true name: "warpzone Status" device_class: presence - filters: - - autorepeat \ No newline at end of file