init upload
This commit is contained in:
22
sonoff-m5/backlight.yaml
Normal file
22
sonoff-m5/backlight.yaml
Normal file
@@ -0,0 +1,22 @@
|
||||
# NOTE: This file is not a stand-alone package. It is part of
|
||||
# a 'root' device template and expects the substitutions that
|
||||
# are hereby referenced to be defined by its parent.
|
||||
|
||||
output:
|
||||
# Physical GPIO PWM for off-state background brightness
|
||||
# This pin controls the background brightness for all LEDs
|
||||
# physically attached to the relays
|
||||
- platform: ledc
|
||||
id: pwm_output
|
||||
pin: GPIO18
|
||||
frequency: 1000 Hz
|
||||
|
||||
light:
|
||||
|
||||
# HA UI connection to the background brightness (PWM) pin
|
||||
- platform: monochromatic
|
||||
output: pwm_output
|
||||
name: "Background Brightness"
|
||||
restore_mode: RESTORE_DEFAULT_OFF
|
||||
icon: 'mdi:led-outline'
|
||||
entity_category: 'config'
|
||||
6
sonoff-m5/board.yaml
Normal file
6
sonoff-m5/board.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
# Define the board for the compiler
|
||||
esp32:
|
||||
board: esp32dev
|
||||
framework:
|
||||
type: arduino
|
||||
version: recommended
|
||||
60
sonoff-m5/button-a.yaml
Normal file
60
sonoff-m5/button-a.yaml
Normal file
@@ -0,0 +1,60 @@
|
||||
# NOTE: This file is not a stand-alone package. It is part of
|
||||
# a 'root' device template and expects the substitutions that
|
||||
# are hereby referenced to be defined by its parent.
|
||||
|
||||
binary_sensor:
|
||||
# Physical Button A
|
||||
- platform: gpio
|
||||
name: "Button A"
|
||||
id: button_a
|
||||
pin:
|
||||
number: ${button_a_gpio}
|
||||
mode: INPUT_PULLUP
|
||||
inverted: true
|
||||
ignore_strapping_warning: false
|
||||
|
||||
filters:
|
||||
- delayed_on: ${filter_delay_on}
|
||||
- delayed_off: ${filter_delay_off}
|
||||
|
||||
on_multi_click:
|
||||
# single click detection
|
||||
- timing:
|
||||
- ${timing_click_1}
|
||||
- ${timing_click_2}
|
||||
then:
|
||||
- homeassistant.event:
|
||||
event: esphome.on_gesture
|
||||
data:
|
||||
button: A
|
||||
gesture: single_click
|
||||
|
||||
# double click detection
|
||||
- timing:
|
||||
- ${timing_double_click_1}
|
||||
- ${timing_double_click_2}
|
||||
- ${timing_double_click_3}
|
||||
- ${timing_double_click_4}
|
||||
then:
|
||||
- homeassistant.event:
|
||||
event: esphome.on_gesture
|
||||
data:
|
||||
button: A
|
||||
gesture: double_click
|
||||
|
||||
# hold detection
|
||||
- timing:
|
||||
- ${timing_hold}
|
||||
then:
|
||||
- while:
|
||||
condition:
|
||||
binary_sensor.is_on: button_a
|
||||
then:
|
||||
- light.toggle: led_status
|
||||
- homeassistant.event:
|
||||
event: esphome.on_gesture
|
||||
data:
|
||||
button: A
|
||||
gesture: button_hold
|
||||
- delay: ${timing_hold_repeat}
|
||||
- light.turn_off: led_status
|
||||
60
sonoff-m5/button-b.yaml
Normal file
60
sonoff-m5/button-b.yaml
Normal file
@@ -0,0 +1,60 @@
|
||||
# NOTE: This file is not a stand-alone package. It is part of
|
||||
# a 'root' device template and expects the substitutions that
|
||||
# are hereby referenced to be defined by its parent.
|
||||
|
||||
binary_sensor:
|
||||
# Physical Button B
|
||||
- platform: gpio
|
||||
name: "Button B"
|
||||
id: button_b
|
||||
pin:
|
||||
number: ${button_b_gpio}
|
||||
mode: INPUT_PULLUP
|
||||
inverted: true
|
||||
ignore_strapping_warning: true
|
||||
|
||||
filters:
|
||||
- delayed_on: ${filter_delay_on}
|
||||
- delayed_off: ${filter_delay_off}
|
||||
|
||||
on_multi_click:
|
||||
# single click detection
|
||||
- timing:
|
||||
- ${timing_click_1}
|
||||
- ${timing_click_2}
|
||||
then:
|
||||
- homeassistant.event:
|
||||
event: esphome.on_gesture
|
||||
data:
|
||||
button: B
|
||||
gesture: single_click
|
||||
|
||||
# double click detection
|
||||
- timing:
|
||||
- ${timing_double_click_1}
|
||||
- ${timing_double_click_2}
|
||||
- ${timing_double_click_3}
|
||||
- ${timing_double_click_4}
|
||||
then:
|
||||
- homeassistant.event:
|
||||
event: esphome.on_gesture
|
||||
data:
|
||||
button: B
|
||||
gesture: double_click
|
||||
|
||||
# hold detection
|
||||
- timing:
|
||||
- ${timing_hold}
|
||||
then:
|
||||
- while:
|
||||
condition:
|
||||
binary_sensor.is_on: button_b
|
||||
then:
|
||||
- light.toggle: led_status
|
||||
- homeassistant.event:
|
||||
event: esphome.on_gesture
|
||||
data:
|
||||
button: B
|
||||
gesture: button_hold
|
||||
- delay: ${timing_hold_repeat}
|
||||
- light.turn_off: led_status
|
||||
60
sonoff-m5/button-c.yaml
Normal file
60
sonoff-m5/button-c.yaml
Normal file
@@ -0,0 +1,60 @@
|
||||
# NOTE: This file is not a stand-alone package. It is part of
|
||||
# a 'root' device template and expects the substitutions that
|
||||
# are hereby referenced to be defined by its parent.
|
||||
|
||||
binary_sensor:
|
||||
# Physical Button C
|
||||
- platform: gpio
|
||||
name: "Button C"
|
||||
id: button_c
|
||||
pin:
|
||||
number: ${button_c_gpio}
|
||||
mode: INPUT_PULLUP
|
||||
inverted: true
|
||||
ignore_strapping_warning: true
|
||||
|
||||
filters:
|
||||
- delayed_on: ${filter_delay_on}
|
||||
- delayed_off: ${filter_delay_off}
|
||||
|
||||
on_multi_click:
|
||||
# single click detection
|
||||
- timing:
|
||||
- ${timing_click_1}
|
||||
- ${timing_click_2}
|
||||
then:
|
||||
- homeassistant.event:
|
||||
event: esphome.on_gesture
|
||||
data:
|
||||
button: C
|
||||
gesture: single_click
|
||||
|
||||
# double click detection
|
||||
- timing:
|
||||
- ${timing_double_click_1}
|
||||
- ${timing_double_click_2}
|
||||
- ${timing_double_click_3}
|
||||
- ${timing_double_click_4}
|
||||
then:
|
||||
- homeassistant.event:
|
||||
event: esphome.on_gesture
|
||||
data:
|
||||
button: C
|
||||
gesture: double_click
|
||||
|
||||
# hold detection
|
||||
- timing:
|
||||
- ${timing_hold}
|
||||
then:
|
||||
- while:
|
||||
condition:
|
||||
binary_sensor.is_on: button_c
|
||||
then:
|
||||
- light.toggle: led_status
|
||||
- homeassistant.event:
|
||||
event: esphome.on_gesture
|
||||
data:
|
||||
button: C
|
||||
gesture: button_hold
|
||||
- delay: ${timing_hold_repeat}
|
||||
- light.turn_off: led_status
|
||||
15
sonoff-m5/indicator-led.yaml
Normal file
15
sonoff-m5/indicator-led.yaml
Normal file
@@ -0,0 +1,15 @@
|
||||
# NOTE: This file is not a stand-alone package. It is part of
|
||||
# a 'root' device template and expects the substitutions that
|
||||
# are hereby referenced to be defined by its parent.
|
||||
|
||||
# Allow importing this package
|
||||
dashboard_import:
|
||||
package_import_url: "github://mariodivece/esphometemplates/sonoff-m5/indicator-led.yaml@main"
|
||||
import_full_config: false
|
||||
|
||||
switch:
|
||||
# Physical indicator of the relay
|
||||
- platform: gpio
|
||||
id: led_indicator
|
||||
internal: true
|
||||
pin: ${led_indicator_gpio}
|
||||
21
sonoff-m5/mode-button-a.yaml
Normal file
21
sonoff-m5/mode-button-a.yaml
Normal file
@@ -0,0 +1,21 @@
|
||||
# NOTE: This file is not a stand-alone package. It is part of
|
||||
# a 'root' device template and expects the substitutions that
|
||||
# are hereby referenced to be defined by its parent.
|
||||
|
||||
select:
|
||||
# Config-only select for operation mode
|
||||
- platform: template
|
||||
name: "Mode - Button A"
|
||||
id: mode_a
|
||||
icon: 'mdi:link-box-outline'
|
||||
entity_category: 'config'
|
||||
options:
|
||||
- "Latching" # 0
|
||||
- "Momentary" # 1
|
||||
- "Pulse" # 2
|
||||
- "Decoupled" # 3
|
||||
initial_option: "Latching"
|
||||
restore_value: true
|
||||
optimistic: true
|
||||
set_action:
|
||||
- switch.turn_off: relay_a
|
||||
21
sonoff-m5/mode-button-b.yaml
Normal file
21
sonoff-m5/mode-button-b.yaml
Normal file
@@ -0,0 +1,21 @@
|
||||
# NOTE: This file is not a stand-alone package. It is part of
|
||||
# a 'root' device template and expects the substitutions that
|
||||
# are hereby referenced to be defined by its parent.
|
||||
|
||||
select:
|
||||
# Config-only select for operation mode
|
||||
- platform: template
|
||||
name: "Mode - Button B"
|
||||
id: mode_b
|
||||
icon: 'mdi:link-box-outline'
|
||||
entity_category: 'config'
|
||||
options:
|
||||
- "Latching" # 0
|
||||
- "Momentary" # 1
|
||||
- "Pulse" # 2
|
||||
- "Decoupled" # 3
|
||||
initial_option: "Latching"
|
||||
restore_value: true
|
||||
optimistic: true
|
||||
set_action:
|
||||
- switch.turn_off: relay_b
|
||||
21
sonoff-m5/mode-button-c.yaml
Normal file
21
sonoff-m5/mode-button-c.yaml
Normal file
@@ -0,0 +1,21 @@
|
||||
# NOTE: This file is not a stand-alone package. It is part of
|
||||
# a 'root' device template and expects the substitutions that
|
||||
# are hereby referenced to be defined by its parent.
|
||||
|
||||
select:
|
||||
# Config-only select for operation mode
|
||||
- platform: template
|
||||
name: "Mode - Button C"
|
||||
id: mode_c
|
||||
icon: 'mdi:link-box-outline'
|
||||
entity_category: 'config'
|
||||
options:
|
||||
- "Latching" # 0
|
||||
- "Momentary" # 1
|
||||
- "Pulse" # 2
|
||||
- "Decoupled" # 3
|
||||
initial_option: "Latching"
|
||||
restore_value: true
|
||||
optimistic: true
|
||||
set_action:
|
||||
- switch.turn_off: relay_c
|
||||
11
sonoff-m5/relay-a.yaml
Normal file
11
sonoff-m5/relay-a.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
# NOTE: This file is not a stand-alone package. It is part of
|
||||
# a 'root' device template and expects the substitutions that
|
||||
# are hereby referenced to be defined by its parent.
|
||||
|
||||
switch:
|
||||
# Physical GPIO Relay
|
||||
- platform: gpio
|
||||
name: "Relay A"
|
||||
pin: ${relay_a_gpio}
|
||||
id: relay_a
|
||||
restore_mode: RESTORE_DEFAULT_OFF
|
||||
11
sonoff-m5/relay-b.yaml
Normal file
11
sonoff-m5/relay-b.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
# NOTE: This file is not a stand-alone package. It is part of
|
||||
# a 'root' device template and expects the substitutions that
|
||||
# are hereby referenced to be defined by its parent.
|
||||
|
||||
switch:
|
||||
# Physical GPIO Relay
|
||||
- platform: gpio
|
||||
name: "Relay B"
|
||||
pin: ${relay_b_gpio}
|
||||
id: relay_b
|
||||
restore_mode: RESTORE_DEFAULT_OFF
|
||||
11
sonoff-m5/relay-c.yaml
Normal file
11
sonoff-m5/relay-c.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
# NOTE: This file is not a stand-alone package. It is part of
|
||||
# a 'root' device template and expects the substitutions that
|
||||
# are hereby referenced to be defined by its parent.
|
||||
|
||||
switch:
|
||||
# Physical GPIO Relay
|
||||
- platform: gpio
|
||||
name: "Relay C"
|
||||
pin: ${relay_c_gpio}
|
||||
id: relay_c
|
||||
restore_mode: RESTORE_DEFAULT_OFF
|
||||
31
sonoff-m5/status-led.yaml
Normal file
31
sonoff-m5/status-led.yaml
Normal file
@@ -0,0 +1,31 @@
|
||||
# NOTE: This file is not a stand-alone package. It is part of
|
||||
# a 'root' device template and expects the substitutions that
|
||||
# are hereby referenced to be defined by its parent.
|
||||
|
||||
light:
|
||||
# Physical pin to the connection status LED
|
||||
# We don't expose this to the HA UI (internal)
|
||||
- platform: status_led
|
||||
name: "LED"
|
||||
id: led_status
|
||||
pin:
|
||||
number: GPIO05
|
||||
inverted: true
|
||||
ignore_strapping_warning: true
|
||||
internal: true
|
||||
restore_mode: RESTORE_DEFAULT_ON
|
||||
|
||||
binary_sensor:
|
||||
|
||||
# Make the status LED blink when not connected/trying to connect
|
||||
- platform: template
|
||||
name: "API connected"
|
||||
id: sensor_api_connected
|
||||
internal: true
|
||||
entity_category: 'diagnostic'
|
||||
device_class: 'connectivity'
|
||||
lambda: return global_api_server->is_connected();
|
||||
on_press:
|
||||
- light.turn_off: led_status
|
||||
on_release:
|
||||
- light.turn_on: led_status
|
||||
26
sonoff-m5/timings.yaml
Normal file
26
sonoff-m5/timings.yaml
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
# NOTE: This file is not a stand-alone package. It is part of
|
||||
# a 'root' device template and expects the substitutions that
|
||||
# are hereby referenced to be defined by its parent.
|
||||
|
||||
substitutions:
|
||||
# Button timing configurations
|
||||
filter_delay_on: 50ms
|
||||
filter_delay_off: 50ms
|
||||
|
||||
# Single Click Timings
|
||||
timing_click_1: ON for at most 400ms
|
||||
timing_click_2: OFF for at least 600ms
|
||||
|
||||
# Double Click Timings
|
||||
timing_double_click_1: ON for at most 500ms
|
||||
timing_double_click_2: OFF for at most 400ms
|
||||
timing_double_click_3: ON for at most 500ms
|
||||
timing_double_click_4: OFF for at least 250ms
|
||||
|
||||
# Button Hold Timings
|
||||
timing_hold: ON for at least 1s
|
||||
timing_hold_repeat: 100ms
|
||||
|
||||
# Pulse Switch
|
||||
timing_pulse: 250ms
|
||||
Reference in New Issue
Block a user