FEAT : Pilotage TV OK
This commit is contained in:
parent
325e9203df
commit
1b3464f06e
@ -23,7 +23,6 @@ wifi:
|
||||
ssid: !secret wifi_ssid
|
||||
password: !secret wifi_password
|
||||
|
||||
# Example configuration entry
|
||||
uart:
|
||||
tx_pin: GPIO44 # Il faut les inverser !!!!
|
||||
rx_pin: GPIO43
|
||||
|
||||
95
config/tv2.yaml
Normal file
95
config/tv2.yaml
Normal file
@ -0,0 +1,95 @@
|
||||
esphome:
|
||||
name: tv2
|
||||
friendly_name: tv2
|
||||
on_boot:
|
||||
then:
|
||||
- output.turn_off: relais
|
||||
- output.turn_on: bouton_vert
|
||||
- output.turn_off: bouton_rouge
|
||||
|
||||
esp32:
|
||||
board: esp32-c6-devkitc-1
|
||||
variant: esp32c6
|
||||
framework:
|
||||
type: esp-idf
|
||||
|
||||
# Enable logging
|
||||
logger:
|
||||
|
||||
uart:
|
||||
tx_pin: GPIO17 # Il faut les inverser !!!!
|
||||
rx_pin: GPIO16
|
||||
baud_rate: 9600
|
||||
# debug:
|
||||
# direction: BOTH
|
||||
# dummy_receiver: false
|
||||
# after:
|
||||
# delimiter: "\n"
|
||||
# sequence:
|
||||
# - lambda: UARTDebug::log_string(direction, bytes);
|
||||
|
||||
modbus:
|
||||
|
||||
output:
|
||||
- platform: gpio
|
||||
pin: GPIO1
|
||||
id: relais
|
||||
- platform: gpio
|
||||
pin: GPIO22
|
||||
id: bouton_vert
|
||||
- platform: gpio
|
||||
pin: GPIO23
|
||||
id: bouton_rouge
|
||||
|
||||
globals:
|
||||
- id: low_power_count
|
||||
type: int
|
||||
initial_value: '0'
|
||||
- id: from_start_count
|
||||
type: int
|
||||
initial_value: '0'
|
||||
- id: puissance_faible
|
||||
type: bool
|
||||
initial_value: 'false'
|
||||
|
||||
sensor:
|
||||
- platform: pzemac
|
||||
address: 4
|
||||
power:
|
||||
name: "PZEM-004T V3 Power"
|
||||
on_value:
|
||||
then:
|
||||
- lambda: |-
|
||||
if (id(from_start_count) < 10) {
|
||||
id(from_start_count)++;
|
||||
id(bouton_rouge).turn_on();
|
||||
id(relais).turn_on();
|
||||
ESP_LOGD("main", "--> Démarrage... (%d / 10)", id(from_start_count));
|
||||
} else {
|
||||
if (id(puissance_faible)) {
|
||||
id(low_power_count)++;
|
||||
ESP_LOGD("main", "--> Puissance faible (%d / 5)", id(low_power_count));
|
||||
}
|
||||
if (id(low_power_count) >= 5) {
|
||||
ESP_LOGD("main", "--> TV OFF !");
|
||||
id(relais).turn_off();
|
||||
}
|
||||
}
|
||||
on_value_range:
|
||||
- below: 40
|
||||
then:
|
||||
- lambda: |-
|
||||
ESP_LOGD("main", "--> Puissance faible !");
|
||||
id(puissance_faible) = true;
|
||||
id(bouton_vert).turn_off();
|
||||
- above: 40
|
||||
then:
|
||||
- lambda: |-
|
||||
ESP_LOGD("main", "--> Puissance normale.");
|
||||
id(puissance_faible) = false;
|
||||
id(bouton_vert).turn_on();
|
||||
id(relais).turn_on();
|
||||
id(low_power_count) = 0;
|
||||
|
||||
update_interval: 5s
|
||||
|
||||
Loading…
Reference in New Issue
Block a user