esphome pmb 6 button switch update
This commit is contained in:
@@ -9,7 +9,9 @@
|
|||||||
# process then hold down the I00 button. I think GPIO12 is preventing the flash process
|
# process then hold down the I00 button. I think GPIO12 is preventing the flash process
|
||||||
# 2. OTA flash to an Existing Tasmota device is likely a bit hard with and ESP32 as they
|
# 2. OTA flash to an Existing Tasmota device is likely a bit hard with and ESP32 as they
|
||||||
# expect a signed Tasmota binary... and partition layout needs to be fixed anyway
|
# expect a signed Tasmota binary... and partition layout needs to be fixed anyway
|
||||||
#
|
# 3. EspHome warns on compiling: "legacy adc driver is deprecated, please migrate to use
|
||||||
|
# esp_adc/adc_oneshot.h and esp_adc/adc_continuous.h for oneshot mode and continuous mode
|
||||||
|
# drivers respectively" [-Wcpp]""
|
||||||
#
|
#
|
||||||
##########################################################################################
|
##########################################################################################
|
||||||
##########################################################################################
|
##########################################################################################
|
||||||
@@ -104,6 +106,40 @@ esp32:
|
|||||||
preferences:
|
preferences:
|
||||||
flash_write_interval: 5min # not too important but anything written for reboot mem will wear the flash
|
flash_write_interval: 5min # not too important but anything written for reboot mem will wear the flash
|
||||||
|
|
||||||
|
|
||||||
|
##########################################################################################
|
||||||
|
# GLOBALS - State storage for vrelays
|
||||||
|
##########################################################################################
|
||||||
|
globals:
|
||||||
|
- id: vrelay_1_state
|
||||||
|
type: bool
|
||||||
|
restore_value: yes
|
||||||
|
initial_value: 'false'
|
||||||
|
- id: vrelay_2_state
|
||||||
|
type: bool
|
||||||
|
restore_value: yes
|
||||||
|
initial_value: 'false'
|
||||||
|
- id: vrelay_3_state
|
||||||
|
type: bool
|
||||||
|
restore_value: yes
|
||||||
|
initial_value: 'false'
|
||||||
|
- id: vrelay_4_state
|
||||||
|
type: bool
|
||||||
|
restore_value: yes
|
||||||
|
initial_value: 'false'
|
||||||
|
- id: vrelay_5_state
|
||||||
|
type: bool
|
||||||
|
restore_value: yes
|
||||||
|
initial_value: 'false'
|
||||||
|
- id: vrelay_5b_state
|
||||||
|
type: bool
|
||||||
|
restore_value: yes
|
||||||
|
initial_value: 'false'
|
||||||
|
- id: vrelay_5c_state
|
||||||
|
type: bool
|
||||||
|
restore_value: yes
|
||||||
|
initial_value: 'false'
|
||||||
|
|
||||||
#############################################
|
#############################################
|
||||||
# ESPHome Logging Enable
|
# ESPHome Logging Enable
|
||||||
# https://esphome.io/components/logger.html
|
# https://esphome.io/components/logger.html
|
||||||
@@ -187,9 +223,8 @@ binary_sensor:
|
|||||||
mode: INPUT
|
mode: INPUT
|
||||||
inverted: true
|
inverted: true
|
||||||
name: "Button 5: ${switch_5_name}"
|
name: "Button 5: ${switch_5_name}"
|
||||||
# No delayed_on/off here to allow accurate multi-click timing
|
|
||||||
on_multi_click:
|
on_multi_click:
|
||||||
# Double click first
|
# Double click
|
||||||
- timing:
|
- timing:
|
||||||
- ON for 50ms to 500ms
|
- ON for 50ms to 500ms
|
||||||
- OFF for 50ms to 500ms
|
- OFF for 50ms to 500ms
|
||||||
@@ -304,67 +339,104 @@ switch:
|
|||||||
- platform: template
|
- platform: template
|
||||||
name: "Output 1: ${switch_1_name}"
|
name: "Output 1: ${switch_1_name}"
|
||||||
id: vrelay_1
|
id: vrelay_1
|
||||||
restore_mode: RESTORE_DEFAULT_OFF
|
lambda: |-
|
||||||
|
return id(vrelay_1_state);
|
||||||
turn_on_action:
|
turn_on_action:
|
||||||
- light.turn_on: led1
|
- light.turn_on: led1
|
||||||
|
- lambda: |-
|
||||||
|
id(vrelay_1_state) = true;
|
||||||
turn_off_action:
|
turn_off_action:
|
||||||
- light.turn_off: led1
|
- light.turn_off: led1
|
||||||
|
- lambda: |-
|
||||||
|
id(vrelay_1_state) = false;
|
||||||
|
|
||||||
- platform: template
|
- platform: template
|
||||||
name: "Output 2: ${switch_2_name}"
|
name: "Output 2: ${switch_2_name}"
|
||||||
id: vrelay_2
|
id: vrelay_2
|
||||||
restore_mode: RESTORE_DEFAULT_OFF
|
lambda: |-
|
||||||
|
return id(vrelay_2_state);
|
||||||
turn_on_action:
|
turn_on_action:
|
||||||
- light.turn_on: led2
|
- light.turn_on: led2
|
||||||
|
- lambda: |-
|
||||||
|
id(vrelay_2_state) = true;
|
||||||
turn_off_action:
|
turn_off_action:
|
||||||
- light.turn_off: led2
|
- light.turn_off: led2
|
||||||
|
- lambda: |-
|
||||||
|
id(vrelay_2_state) = false;
|
||||||
|
|
||||||
- platform: template
|
- platform: template
|
||||||
name: "Output 3: ${switch_3_name}"
|
name: "Output 3: ${switch_3_name}"
|
||||||
id: vrelay_3
|
id: vrelay_3
|
||||||
restore_mode: RESTORE_DEFAULT_OFF
|
lambda: |-
|
||||||
|
return id(vrelay_3_state);
|
||||||
turn_on_action:
|
turn_on_action:
|
||||||
- light.turn_on: led3
|
- light.turn_on: led3
|
||||||
|
- lambda: |-
|
||||||
|
id(vrelay_3_state) = true;
|
||||||
turn_off_action:
|
turn_off_action:
|
||||||
- light.turn_off: led3
|
- light.turn_off: led3
|
||||||
|
- lambda: |-
|
||||||
|
id(vrelay_3_state) = false;
|
||||||
|
|
||||||
- platform: template
|
- platform: template
|
||||||
name: "Output 4: ${switch_4_name}"
|
name: "Output 4: ${switch_4_name}"
|
||||||
id: vrelay_4
|
id: vrelay_4
|
||||||
restore_mode: RESTORE_DEFAULT_OFF
|
lambda: |-
|
||||||
|
return id(vrelay_4_state);
|
||||||
turn_on_action:
|
turn_on_action:
|
||||||
- light.turn_on: led4
|
- light.turn_on: led4
|
||||||
|
- lambda: |-
|
||||||
|
id(vrelay_4_state) = true;
|
||||||
turn_off_action:
|
turn_off_action:
|
||||||
- light.turn_off: led4
|
- light.turn_off: led4
|
||||||
|
- lambda: |-
|
||||||
|
id(vrelay_4_state) = false;
|
||||||
|
|
||||||
- platform: template
|
- platform: template
|
||||||
name: "Output 5: ${switch_5_name}"
|
name: "Output 5: ${switch_5_name}"
|
||||||
id: vrelay_5
|
id: vrelay_5
|
||||||
restore_mode: RESTORE_DEFAULT_OFF
|
lambda: |-
|
||||||
|
return id(vrelay_5_state);
|
||||||
turn_on_action:
|
turn_on_action:
|
||||||
- light.turn_on: led5
|
- light.turn_on: led5
|
||||||
|
- lambda: |-
|
||||||
|
id(vrelay_5_state) = true;
|
||||||
turn_off_action:
|
turn_off_action:
|
||||||
- light.turn_off: led5
|
- light.turn_off: led5
|
||||||
|
- lambda: |-
|
||||||
|
id(vrelay_5_state) = false;
|
||||||
|
#- switch.turn_off: vrelay_5c
|
||||||
|
|
||||||
- platform: template
|
- platform: template
|
||||||
name: "Output 5B: ${switch_5b_name}"
|
name: "Output 5B: ${switch_5b_name}"
|
||||||
id: vrelay_5b
|
id: vrelay_5b
|
||||||
restore_mode: RESTORE_DEFAULT_OFF
|
lambda: |-
|
||||||
|
return id(vrelay_5b_state);
|
||||||
turn_on_action:
|
turn_on_action:
|
||||||
- logger.log: "vrelay_5b ON"
|
- logger.log: "vrelay_5b ON"
|
||||||
|
- lambda: |-
|
||||||
|
id(vrelay_5b_state) = true;
|
||||||
turn_off_action:
|
turn_off_action:
|
||||||
- logger.log: "vrelay_5b OFF"
|
- logger.log: "vrelay_5b OFF"
|
||||||
|
- lambda: |-
|
||||||
|
id(vrelay_5b_state) = false;
|
||||||
|
|
||||||
- platform: template
|
- platform: template
|
||||||
name: "Output 5C: ${switch_5c_name}"
|
name: "Output 5C: ${switch_5c_name}"
|
||||||
id: vrelay_5c
|
id: vrelay_5c
|
||||||
restore_mode: RESTORE_DEFAULT_OFF
|
lambda: |-
|
||||||
|
return id(vrelay_5c_state);
|
||||||
turn_on_action:
|
turn_on_action:
|
||||||
- light.turn_on:
|
- light.turn_on:
|
||||||
id: led1
|
id: led5
|
||||||
effect: "Pulse 0.5s"
|
effect: "Pulse 0.5s"
|
||||||
|
- lambda: |-
|
||||||
|
id(vrelay_5c_state) = true;
|
||||||
turn_off_action:
|
turn_off_action:
|
||||||
- light.turn_off: led1
|
- light.turn_off: led5
|
||||||
|
- lambda: |-
|
||||||
|
id(vrelay_5c_state) = false;
|
||||||
|
#- switch.turn_off: vrelay_5
|
||||||
|
|
||||||
#- platform: template
|
#- platform: template
|
||||||
# name: "Output 6: ${switch_6_name}"
|
# name: "Output 6: ${switch_6_name}"
|
||||||
@@ -423,8 +495,8 @@ sensor:
|
|||||||
filters:
|
filters:
|
||||||
- calibrate_linear:
|
- calibrate_linear:
|
||||||
# Format: raw_value -> real_voltage_at_pin
|
# Format: raw_value -> real_voltage_at_pin
|
||||||
- 0.80 -> 3.20 # Example: ADC reads 0.80 when pin is actually 3.20V
|
- 00.66 -> 10.00 # Example: ADC reads 0.80 when pin is actually 3.20V
|
||||||
- 0.90 -> 3.60 # Example: ADC reads 0.90 when pin is actually 3.60V
|
- 00.99 -> 15.00 # Example: ADC reads 1.00 when pin is actually 4.00V
|
||||||
- 1.00 -> 4.00 # Example: ADC reads 1.00 when pin is actually 4.00V
|
- 01.30 -> 20.00 # Example: ADC reads 0.90 when pin is actually 3.60V
|
||||||
- multiply: 4.00 # Voltage divider ratio
|
#- multiply: 4.00 # Voltage divider ratio
|
||||||
unit_of_measurement: "V"
|
unit_of_measurement: "V"
|
Reference in New Issue
Block a user