Skip to content
Snippets Groups Projects
Commit 5b16726d authored by Jannik Berges's avatar Jannik Berges
Browse files

Stecker hinzugefügt

parent a3dfc536
No related branches found
No related tags found
No related merge requests found
...@@ -52,6 +52,9 @@ ...@@ -52,6 +52,9 @@
- config/esphome_plug03.yaml - config/esphome_plug03.yaml
- config/esphome_plug04.yaml - config/esphome_plug04.yaml
- config/esphome_plug05.yaml - config/esphome_plug05.yaml
- config/esphome_plug06.yaml
- config/esphome_plug07.yaml
- config/esphome_plug08.yaml
register: config register: config
- name: "stop {{ servicename }} docker" - name: "stop {{ servicename }} docker"
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
- switch.turn_off: relay - switch.turn_off: relay
substitutions: substitutions:
plug_name: esphome_plug05 plug_name: {{ devicename }}
# Higher value gives lower watt readout # Higher value gives lower watt readout
current_res: "0.00221" current_res: "0.00221"
# Lower value gives lower voltage readout # Lower value gives lower voltage readout
......
{% 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
- platform: wifi_signal
name: "WiFi Signal"
update_interval: 60s
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
{% 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
- platform: wifi_signal
name: "WiFi Signal"
update_interval: 60s
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
{% 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
- platform: wifi_signal
name: "WiFi Signal"
update_interval: 60s
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment