modes : forcé, normal +et-, arrêt
This commit is contained in:
parent
8b71e2bb63
commit
d40590e1cd
@ -1,6 +1,6 @@
|
||||
substitutions:
|
||||
name: thr320d_filtre_bb04f0
|
||||
friendly_name: "filtration"
|
||||
friendly_name: Filtration"
|
||||
project_name: "Filtration piscine"
|
||||
project_version: "1.0"
|
||||
light_restore_mode: RESTORE_DEFAULT_OFF
|
||||
@ -29,11 +29,19 @@ logger:
|
||||
|
||||
web_server:
|
||||
port: 80
|
||||
version: 3
|
||||
log: off
|
||||
ota: off
|
||||
local: true
|
||||
auth:
|
||||
username: !secret web_server_user_piscine
|
||||
password: !secret web_server_pass_piscine
|
||||
|
||||
wifi:
|
||||
ssid: !secret wifi_ssid
|
||||
password: !secret wifi_password
|
||||
|
||||
|
||||
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
||||
ap:
|
||||
ssid: !secret ap_ssid_pool
|
||||
@ -58,10 +66,9 @@ display:
|
||||
lambda: |-
|
||||
it.printf(0, "%.1f", id(${name}_temp).state);
|
||||
it.display_celsius(true);
|
||||
/*it.printf(1, "%.1f", id(${name}_temp).state/10);
|
||||
/*it.display_kwh(true);
|
||||
/*it.printf(1, "%.1f", id(${name}_humi).state);
|
||||
it.display_humidity(true);*/
|
||||
if (id(sntp_time).now().is_valid()) {
|
||||
it.printf(1, "%1.f", id(duree).state);
|
||||
}
|
||||
|
||||
binary_sensor:
|
||||
# single main button that also puts device into flash mode when held on boot
|
||||
@ -70,21 +77,20 @@ binary_sensor:
|
||||
number: GPIO0
|
||||
mode: INPUT_PULLUP
|
||||
inverted: True
|
||||
name: "${friendly_name} Button"
|
||||
name: "Boutton"
|
||||
internal: True
|
||||
on_click:
|
||||
- max_length: 350ms # short press to toggle the relay
|
||||
- min_length: 500ms # long press
|
||||
max_length: 2s
|
||||
then:
|
||||
switch.toggle: mainRelayVirt
|
||||
- min_length: 360ms # long press to do...
|
||||
max_length: 3s
|
||||
then:
|
||||
switch.toggle: dryContRelay
|
||||
- min_length: 10s # very long press to reset
|
||||
max_length: 20s
|
||||
- switch.toggle: mainRelayVirt
|
||||
- min_length: 5s # very long press to reset
|
||||
max_length: 10s
|
||||
then:
|
||||
- switch.turn_on: ${name}_restart
|
||||
- platform: status
|
||||
name: "${friendly_name} Status"
|
||||
on_double_click:
|
||||
then:
|
||||
switch.toggle: dryContRelay
|
||||
|
||||
switch:
|
||||
# virtual switch to represent the main relay
|
||||
@ -94,14 +100,14 @@ switch:
|
||||
name: "Pompe"
|
||||
turn_on_action:
|
||||
- switch.turn_on: mainRelayOn
|
||||
- switch.turn_on: ${name}_onoff_led
|
||||
- switch.turn_on: ${name}_pompe_led
|
||||
turn_off_action:
|
||||
- switch.turn_on: mainRelayOff
|
||||
- switch.turn_off: ${name}_onoff_led
|
||||
- switch.turn_off: ${name}_pompe_led
|
||||
assumed_state: True
|
||||
optimistic: True
|
||||
#restore_state: True
|
||||
#restore_mode: ALWAYS_ON
|
||||
icon: mdi:pump
|
||||
web_server_sorting_weight: 10
|
||||
|
||||
# internal momentary switch for main relay ON
|
||||
- platform: gpio
|
||||
@ -128,24 +134,27 @@ switch:
|
||||
# dry contact relay switch
|
||||
- platform: gpio
|
||||
id: dryContRelay
|
||||
name: "Extension"
|
||||
name: "Sortie auxiliaire"
|
||||
icon: mdi:cards-diamond
|
||||
web_server_sorting_weight: 15
|
||||
pin:
|
||||
number: GPIO4
|
||||
on_turn_on:
|
||||
- switch.turn_on: ${name}_ext_led
|
||||
- switch.turn_on: ${name}_aux_led
|
||||
on_turn_off:
|
||||
- switch.turn_off: ${name}_ext_led
|
||||
- switch.turn_off: ${name}_aux_led
|
||||
restore_mode: ALWAYS_OFF
|
||||
|
||||
# Leftmost (red) LED that's used to indicate the relay being on/off
|
||||
- platform: gpio
|
||||
id: ${name}_onoff_led
|
||||
id: ${name}_pompe_led
|
||||
pin:
|
||||
number: GPIO16
|
||||
inverted: true
|
||||
|
||||
# Rightmost (green) LED; use as dry contact indicator
|
||||
- platform: gpio
|
||||
id: ${name}_ext_led
|
||||
id: ${name}_aux_led
|
||||
pin:
|
||||
number: GPIO13
|
||||
inverted: true
|
||||
@ -156,21 +165,13 @@ switch:
|
||||
- platform: gpio
|
||||
pin: GPIO27
|
||||
id: ${name}_sensor_power
|
||||
restore_mode: ALWAYS_ON
|
||||
restore_mode: ALWAYS_OFF
|
||||
|
||||
- platform: restart
|
||||
name: "Filtration Restart"
|
||||
name: "Redémarrer"
|
||||
id: ${name}_restart
|
||||
icon: "mdi:restart"
|
||||
|
||||
light:
|
||||
# The middle (blue) LED is used as wifi status indicator.
|
||||
- platform: status_led
|
||||
id: wifi_status_led
|
||||
name: "Wifi"
|
||||
pin:
|
||||
number: GPIO15
|
||||
inverted: true
|
||||
|
||||
sensor:
|
||||
- platform: dallas_temp
|
||||
@ -178,62 +179,165 @@ sensor:
|
||||
id: ${name}_temp
|
||||
address: 0xfe3ce504578d3c28
|
||||
update_interval: 1s
|
||||
|
||||
climate:
|
||||
- platform: thermostat
|
||||
name: "${friendly_name} Climate"
|
||||
sensor: ${name}_temp
|
||||
default_preset: Home
|
||||
preset:
|
||||
- name: Home
|
||||
default_target_temperature_low: 31 °C
|
||||
mode: heat
|
||||
min_heating_off_time: 300s
|
||||
min_heating_run_time: 300s
|
||||
min_idle_time: 30s
|
||||
heat_action:
|
||||
- switch.turn_on: mainRelayVirt
|
||||
idle_action:
|
||||
- switch.turn_off: mainRelayVirt
|
||||
heat_deadband: 0.5 # how many degrees can we go under the temp before starting to heat
|
||||
heat_overrun: 0.5 # how many degrees can we go over the temp before stopping
|
||||
web_server_sorting_weight: 05
|
||||
icon: mdi:pool-thermometer
|
||||
|
||||
text_sensor:
|
||||
- platform: wifi_info
|
||||
ip_address:
|
||||
name: "Addresse IP"
|
||||
disabled_by_default: true
|
||||
icon: mdi:ip-network
|
||||
|
||||
interval:
|
||||
- interval: 30s
|
||||
then:
|
||||
if:
|
||||
condition:
|
||||
wifi.connected:
|
||||
then:
|
||||
- light.turn_on: wifi_status_led
|
||||
else:
|
||||
- light.turn_off: wifi_status_led
|
||||
number:
|
||||
- platform: template
|
||||
name: "Heure démarrage"
|
||||
id: heure_depart
|
||||
min_value: 0
|
||||
max_value: 59
|
||||
step: 1
|
||||
restore_value: True
|
||||
initial_value: 8
|
||||
unit_of_measurement: s
|
||||
mode: box
|
||||
optimistic: True
|
||||
icon: mdi:clock-start
|
||||
web_server_sorting_weight: 20
|
||||
|
||||
- platform: template
|
||||
name: "Durée de base"
|
||||
id: duree_debase
|
||||
min_value: 0
|
||||
max_value: 60
|
||||
step: 1
|
||||
restore_value: False
|
||||
initial_value: 0
|
||||
unit_of_measurement: s
|
||||
optimistic: True
|
||||
internal: True
|
||||
|
||||
- platform: template
|
||||
name: "Durée filtration H/j"
|
||||
id: duree
|
||||
min_value: 0
|
||||
max_value: 60
|
||||
step: 1
|
||||
restore_value: False
|
||||
initial_value: 0
|
||||
unit_of_measurement: s
|
||||
mode: SLIDER
|
||||
optimistic: True
|
||||
entity_category: config
|
||||
icon: mdi:fan-clock
|
||||
web_server_sorting_weight: 25
|
||||
|
||||
- platform: template
|
||||
name: "Heure actuelle"
|
||||
id: heure
|
||||
internal: True
|
||||
min_value: 0
|
||||
max_value: 59
|
||||
step: 1
|
||||
unit_of_measurement: s
|
||||
optimistic: True
|
||||
|
||||
- platform: template
|
||||
name: "Heure fin filtration"
|
||||
id: heure_fin
|
||||
internal: True
|
||||
min_value: 0
|
||||
max_value: 59
|
||||
step: 1
|
||||
unit_of_measurement: s
|
||||
optimistic: True
|
||||
|
||||
select:
|
||||
- platform: template
|
||||
name: "Mode"
|
||||
id: mode
|
||||
optimistic: true
|
||||
options:
|
||||
- Forcé
|
||||
- Intensif
|
||||
- Normal
|
||||
- Économique
|
||||
- Arrêt
|
||||
initial_option: Normal
|
||||
icon: mdi:power
|
||||
web_server_sorting_weight: 2
|
||||
on_value:
|
||||
then:
|
||||
- lambda: |-
|
||||
if (id(mode).state == "Intensif") {
|
||||
id(duree).state = id(duree_debase).state + 2;
|
||||
if (id(duree).state > 59) {
|
||||
id(duree).state = 60;
|
||||
}
|
||||
}
|
||||
if (id(mode).state == "Normal") {
|
||||
id(duree).state = id(duree_debase).state;
|
||||
}
|
||||
if (id(mode).state == "Économique") {
|
||||
id(duree).state = id(duree_debase).state - 2;
|
||||
if (id(duree).state < 0) {
|
||||
id(duree).state = 0;
|
||||
}
|
||||
}
|
||||
|
||||
time:
|
||||
- platform: sntp
|
||||
# ...
|
||||
on_time:
|
||||
# Every 5 minutes
|
||||
- seconds: /5
|
||||
#minutes: /5
|
||||
then:
|
||||
- switch.toggle: ${name}_ext_led
|
||||
id: sntp_time
|
||||
timezone: Europe/Paris
|
||||
servers:
|
||||
- 0.pool.ntp.org
|
||||
- 1.pool.ntp.org
|
||||
- 2.pool.ntp.org
|
||||
|
||||
# Every morning on weekdays
|
||||
- seconds: 0
|
||||
minutes: 30
|
||||
hours: 7
|
||||
days_of_week: MON-FRI
|
||||
then:
|
||||
- light.turn_on: wifi_status_led
|
||||
|
||||
# Cron syntax, trigger every 5 minutes
|
||||
- cron: '00 /5 * * * *'
|
||||
then:
|
||||
- switch.toggle: ${name}_ext_led
|
||||
interval:
|
||||
- interval: 1s
|
||||
then:
|
||||
- lambda: |-
|
||||
if (id(mode).state == "Forcé") {
|
||||
id(mainRelayVirt).turn_on();
|
||||
}
|
||||
|
||||
if ((id(mode).state == "Normal") || (id(mode).state == "Économique") || (id(mode).state == "Intensif")) {
|
||||
if (id(sntp_time).now().second == (id(heure_depart).state)) {
|
||||
id(duree_debase).state = (id(${name}_temp).state / 2);
|
||||
id(duree).state = id(duree_debase).state;
|
||||
}
|
||||
|
||||
ESP_LOGI("main", "Heure de début: %.0f", id(heure_depart).state);
|
||||
id(heure_fin).state = id(heure_depart).state + (id(duree).state) -1;
|
||||
ESP_LOGI("main", "Heure de fin: %.0f", id(heure_fin).state);
|
||||
if (id(heure_fin).state > 59) {
|
||||
id(heure_fin).state = id(heure_fin).state - 60;
|
||||
}
|
||||
ESP_LOGI("main", "Heure de fin: %.0f", id(heure_fin).state);
|
||||
if (id(heure_fin).state >= id(heure_depart).state) {
|
||||
if (((id(sntp_time).now().second) >= (id(heure_depart).state)) and ((id(sntp_time).now().second) <= (id(heure_fin).state))) {
|
||||
id(mainRelayVirt).turn_on();
|
||||
}
|
||||
else {
|
||||
id(mainRelayVirt).turn_off();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ((id(sntp_time).now().second) >= (id(heure_depart).state)) {
|
||||
id(mainRelayVirt).turn_on();
|
||||
}
|
||||
else {
|
||||
if ((id(sntp_time).now().second) <= (id(heure_fin).state)) {
|
||||
id(mainRelayVirt).turn_on();
|
||||
}
|
||||
else {
|
||||
id(mainRelayVirt).turn_off();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (id(mode).state == "Arrêt") {
|
||||
id(mainRelayVirt).turn_off();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user