Shelly2.5 ESPHome – 2 Lichter ansteuern

Echo Show 5 (1. Gen, 2019) – Smart Display mit Alexa – Durch Alexa in Verbindung bleiben – Anthrazit
Echo Show 5 (1. Gen, 2019) – Smart Display mit Alexa – Durch Alexa in Verbindung bleiben – Anthrazit
--

Im Home Assistant wird es als 2 Relais mit Symbolen und 2 binären Sensoren (einschließlich Leistung, Strom und Sensoren) angezeigt. Wenn die „max_power“ auf einem Kanal überschritten wird, wird dieser Kanal ausgeschaltet und eine dauerhafte Benachrichtigung wird im HA erstellt. Wenn die „max_temp“ überschritten wird, werden die 2 Kanäle abgeschaltet und eine dauerhafte Benachrichtigung wird im HA erstellt.

substitutions:
  devicename: shelly_25
  channel_1: Light 1
  channel_2: Light 2


  max_power: "2000.0"
  max_temp: "70.0"

esphome:
  name: ${devicename}
  platform: ESP8266
  board: esp01_1m

wifi:
  ssid: "WIFI SSID"
  password: "PW"
  power_save_mode: none
  output_power: 20dB
  fast_connect: on
  manual_ip:
   static_ip: 192.168.178.77
   gateway: 192.168.178.1
   subnet: 255.255.255.0
    

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "NAME"
    password: "PW"
    

captive_portal:

# Enable logging
logger:
  level: DEBUG

# Enable Home Assistant API
api:


ota:


web_server:
  port: 80

time:
  - platform: sntp
    id: my_time

i2c:
  sda: GPIO12
  scl: GPIO14

sensor:
  - platform: ade7953
    irq_pin: GPIO16 # Prevent overheating by setting this
    voltage:
      name: ${devicename} voltage
    # On the Shelly 2.5 channels are mixed ch1=B ch2=A
    current_a:
      name: ${channel_2} current
      internal: true
    current_b:
      name: ${channel_1} current
      internal: true
    active_power_a:
      name: ${channel_2} power
      id: power_channel_2
      # active_power_a is normal, so don't multiply by -1
      on_value_range:
        - above: ${max_power}
          then:
            - light.turn_off: lightid2
            - homeassistant.service:
                service: persistent_notification.create
                data:
                  title: Message from ${devicename}
                data_template:
                  message: Switch turned off because power exceeded ${max_power}W
    active_power_b:
      name: ${channel_1} power
      id: power_channel_1
      # active_power_b is inverted, so multiply by -1
      filters:
        - multiply: -1
      on_value_range:
        - above: ${max_power}
          then:
            - light.turn_off: lightid1
            - homeassistant.service:
                service: persistent_notification.create
                data:
                  title: Message from ${devicename}
                data_template:
                  message: Switch turned off because power exceeded ${max_power}W
    update_interval: 30s

  - platform: total_daily_energy
    name: ${channel_1} energy
    power_id: power_channel_1
    filters:
      # Multiplication factor from W to kWh is 0.001
      - multiply: 0.001
    unit_of_measurement: kWh

  - platform: total_daily_energy
    name: ${channel_2} energy
    power_id: power_channel_2
    filters:
      # Multiplication factor from W to kWh is 0.001
      - multiply: 0.001
    unit_of_measurement: kWh

  # NTC Temperature
  - platform: ntc
    sensor: temp_resistance_reading
    name: ${devicename} temperature
    unit_of_measurement: "°C"
    accuracy_decimals: 1
    icon: "mdi:thermometer"
    calibration:
      b_constant: 3350
      reference_resistance: 10kOhm
      reference_temperature: 298.15K
    on_value_range:
      - above: ${max_temp}
        then:
          - light.turn_off: lightid1
          - light.turn_off: lightid2
          - homeassistant.service:
              service: persistent_notification.create
              data:
                title: Message from ${devicename}
              data_template:
                message: Switch turned off because temperature exceeded ${max_temp}°C
  - platform: resistance
    id: temp_resistance_reading
    sensor: temp_analog_reading
    configuration: DOWNSTREAM
    resistor: 32kOhm
  - platform: adc
    id: temp_analog_reading
    pin: A0

status_led:
  pin:
    number: GPIO0
    inverted: yes

output:
  - platform: gpio
    pin: GPIO4
    id: shelly_25_relay_1
  - platform: gpio
    pin: GPIO15
    id: shelly_25_relay_2

light:
  - platform: binary
    name: "${channel_1}"
    output: shelly_25_relay_1
    id: lightid1
  - platform: binary
    name: "${channel_2}"
    output: shelly_25_relay_2
    id: lightid2

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO13
    name: "${channel_1} input"
    on_state:
      then:
        - light.toggle: lightid1
  - platform: gpio
    pin:
      number: GPIO5
    name: "${channel_2} input"
    on_state:
      then:
        - light.toggle: lightid2