Shelly 1

Shelly 1

ESPhome firmware for Shelly 1 to act as a light switch.

  • Binary Sensor: Button
  • Binary Sensor: Status
  • Light
  • Sensor: WiFi Signal
  • Sensor: Uptime
  • Output: IP Address
esphome:
  name: light_shelly_1
  platform: ESP8266
  board: esp01_1m

wifi:
  networks:
  - ssid: "YOUR-SSID"
    password: "yourpassword"
    priority: 1
  - ssid: "YOUR-SSID-backup"
    password: "yourpassword"  
    priority: 0

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Light Shelly 1"
    password: "ASkNYjaeai9b"

web_server:
  port: 80
  
captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:

output:                                
  - platform: gpio                     
    pin: GPIO4                         
    id: shelly_1_relay                         
                                       
light:                                 
  - platform: binary                   
    name: "Light Shelly 1"              
    output: shelly_1_relay                     
    id: lightid                        
                                       
binary_sensor:                         
  - platform: gpio                     
    pin:                               
      number: GPIO5                    
    name: "Light Shelly 1 Button"             
    on_state:                          
      then:                            
        - light.toggle: lightid        
    internal: true                     
    id: switchid  
  - platform: status
    name: "Light Shelly 1 Status"
    
sensor:
  - platform: wifi_signal
    name: "Light Shelly 1 WiFi Signal"
    update_interval: 60s
  - platform: uptime
    name: "Light Shelly 1 Uptime"
    filters:
      - lambda: return x / 3600.0 /24;
    unit_of_measurement: "days"
    accuracy_decimals: 0
    
text_sensor:
  - platform: template
    name: "Light Shelly 1 IP"
    lambda: 'return {WiFi.localIP().toString().c_str()};'

Leave a Reply

Your email address will not be published.