init upload
This commit is contained in:
149
sonoff-m5-1g-us.yaml
Normal file
149
sonoff-m5-1g-us.yaml
Normal file
@@ -0,0 +1,149 @@
|
||||
# ESPHome Firmware for
|
||||
# Sonoff Switchman M5 1-Gang US
|
||||
# Copyright (c) 2024 Mario Di Vece
|
||||
# License: [MIT](https://opensource.org/license/mit/)
|
||||
# Decription:
|
||||
# Aims to provide a feature-rich, production-ready firmware for this elegant device
|
||||
# - Provides Diagnostic data plus, status LED indicator when not connected to Home Assistant API
|
||||
# - Relays may be configured individually on the UI to work in decoupled mode.
|
||||
# LEDs are physically connected to the relays, and they can't be individually controlled :(
|
||||
# - Exposes gestures via events:
|
||||
# esphome.on_gesture { button: (A), gesture: (click|double_click|button_hold) }
|
||||
# - Off-state (Background Brightness) of the LEDs is configurable via the UI
|
||||
#
|
||||
# For the below example, you need to keep the following entries in your secrets.yaml file:
|
||||
# - wifi_ssid: "<secret>"
|
||||
# - wifi_password: "<secret>"
|
||||
# - ota_password: "<secret>"
|
||||
# - api_key: "<32-byte-base-64-secret>"
|
||||
#
|
||||
# Example file (lab-office-wasw-003.yaml)
|
||||
#
|
||||
# substitutions:
|
||||
# device_site: "lab"
|
||||
# device_location_code: "office"
|
||||
# device_location_name: "Office"
|
||||
# device_type_code: "wasw"
|
||||
# device_type_name: "Wall Switch"
|
||||
# device_number: "003"
|
||||
# device_ip: "192.168.1.31"
|
||||
#
|
||||
# packages:
|
||||
# base_package:
|
||||
# url: https://github.com/mariodivece/esphometemplates/
|
||||
# ref: main
|
||||
# file: sonoff-m5-1g-us.yaml
|
||||
# refresh: 0d
|
||||
#
|
||||
|
||||
substitutions:
|
||||
# User-required substitutions
|
||||
device_site: "home"
|
||||
device_location_code: "bedroom01"
|
||||
device_location_name: "Bedroom 1"
|
||||
device_type_code: "wasw"
|
||||
device_type_name: "Wall Switch"
|
||||
device_number: "044"
|
||||
device_ip: "0.0.0.0"
|
||||
|
||||
# Project Substitutions (not intended for user substitution)
|
||||
device_model: "Switchman M5 (1-Gang)"
|
||||
device_make: "Sonoff"
|
||||
package_version: "2024.2.13"
|
||||
package_url: "github://mariodivece/esphometemplates/sonoff-m5-1g-us.yaml@main"
|
||||
|
||||
# Relay Configurations
|
||||
relay_a_gpio: GPIO23
|
||||
|
||||
# Button Configurations
|
||||
button_a_gpio: GPIO00
|
||||
|
||||
# Indicator LED
|
||||
led_indicator_gpio: GPIO19
|
||||
|
||||
# Allow importing this package
|
||||
dashboard_import:
|
||||
package_import_url: ${package_url}
|
||||
import_full_config: false
|
||||
|
||||
# Import packages
|
||||
packages:
|
||||
standard_package:
|
||||
url: https://github.com/mariodivece/esphometemplates/
|
||||
ref: main
|
||||
refresh: 0d
|
||||
files:
|
||||
- standard/project.yaml
|
||||
- standard/diagnostics.yaml
|
||||
- standard/wifi.yaml
|
||||
- standard/internaltemp.yaml
|
||||
sonoffm5_package:
|
||||
url: https://github.com/mariodivece/esphometemplates/
|
||||
ref: main
|
||||
refresh: 0d
|
||||
files:
|
||||
- sonoff-m5/board.yaml
|
||||
- sonoff-m5/timings.yaml
|
||||
- sonoff-m5/status-led.yaml
|
||||
- sonoff-m5/backlight.yaml
|
||||
- sonoff-m5/indicator-led.yaml
|
||||
- sonoff-m5/mode-button-a.yaml
|
||||
- sonoff-m5/relay-a.yaml
|
||||
- sonoff-m5/button-a.yaml
|
||||
|
||||
switch:
|
||||
|
||||
# Modify behavior of imported Relay A
|
||||
- id: !extend relay_a
|
||||
on_turn_on:
|
||||
- switch.turn_on: led_indicator
|
||||
on_turn_off:
|
||||
- switch.turn_off: led_indicator
|
||||
|
||||
binary_sensor:
|
||||
|
||||
# Button A
|
||||
- id: !extend button_a
|
||||
pin:
|
||||
ignore_strapping_warning: true
|
||||
on_press:
|
||||
# Latching
|
||||
- if:
|
||||
condition:
|
||||
- lambda: 'return id(mode_a).active_index() == 0;'
|
||||
then:
|
||||
- switch.toggle: relay_a
|
||||
# Momentary
|
||||
- if:
|
||||
condition:
|
||||
- lambda: 'return id(mode_a).active_index() == 1;'
|
||||
then:
|
||||
- switch.turn_on: relay_a
|
||||
# Pulse
|
||||
- if:
|
||||
condition:
|
||||
- lambda: 'return id(mode_a).active_index() == 2;'
|
||||
then:
|
||||
- switch.turn_on: relay_a
|
||||
- delay: ${timing_pulse}
|
||||
- switch.turn_off: relay_a
|
||||
# Decoupled
|
||||
- if:
|
||||
condition:
|
||||
- lambda: 'return id(mode_a).active_index() == 3;'
|
||||
then:
|
||||
- switch.turn_on: led_indicator
|
||||
|
||||
on_release:
|
||||
# Momentary
|
||||
- if:
|
||||
condition:
|
||||
- lambda: 'return id(mode_a).active_index() == 1;'
|
||||
then:
|
||||
- switch.turn_off: relay_a
|
||||
# Decoupled
|
||||
- if:
|
||||
condition:
|
||||
- lambda: 'return id(mode_a).active_index() == 3;'
|
||||
then:
|
||||
- switch.turn_off: led_indicator
|
||||
Reference in New Issue
Block a user