Új hozzászólás Aktív témák

  • noorbertt

    őstag

    válasz Olympia76 #30384 üzenetére

    Netrol kukaztam egy ilyet esphome-hoz:

    substitutions:
      plug_name: shelly-nappali-lampa
      device_name: shelly-nappali-lampa
      
    esphome:
      name: shelly-nappali-lampa
      platform: ESP8266
      board: esp01_1m
    logger:

    wifi:
      ssid: !secret wifi_ssid
      password: !secret wifi_password

    #==============================================================
    # Text sensors with general information.
    text_sensor:
      - platform: wifi_info
        ip_address:
          name: ${device_name} IP
    # Sensors with general information.
    sensor:
      # Uptime sensor.
      - platform: uptime
        name: ${device_name} Uptime
      # WiFi Signal sensor.
      - platform: wifi_signal
        name: ${device_name} WiFi Signal
        update_interval: 60s
      #Shelly 1L hot safe switch
      - platform: ntc
        sensor: temp_resistance_reading
        name: ${device_name}_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: "80.0"
            then:
              - switch.turn_off: shelly_1l_relay
      - platform: resistance
        id: temp_resistance_reading
        sensor: temp_analog_reading
        configuration: DOWNSTREAM
        resistor: 32kOhm
      - platform: adc
        id: temp_analog_reading
        pin: A0

    # Shelly 1l detached switch config with fallback in case of wifi or api fail
    switch:
      - platform: gpio
        name: ${device_name}
        pin: GPIO5
        id: shelly_1l_relay
        # after reboot, keep the relay off. this prevents light turning on after a power outage
        restore_mode: ALWAYS_OFF
    binary_sensor:
      - platform: gpio
        name: ${device_name} Input
        pin:
          number: GPIO4
        # small delay to prevent debouncing
        filters:
          - delayed_on_off: 50ms
        # config for state change of input button
        on_state:
            then:
              - if:
                  condition:
                    and:
                      - wifi.connected:
                      - api.connected:
                      - switch.is_on: shelly_1l_relay
                  # toggle smart light if wifi and api are connected and relay is on
                  then:
                    - homeassistant.service:
                        service: light.toggle
                        data:
                          entity_id: light.nappali_led
                  # else, toggle relay
                  else:
                    - switch.toggle: shelly_1l_relay
        id: button
    status_led:
      pin: GPIO0

    Jol ertem, ha ezzel rakotom a lampa kapcsolot a shelly-re, akkor meg is van oldva az egesz?

Új hozzászólás Aktív témák