ESPHOME SDD1306 eteindre ecran au bout de 30s et le rallumer sur n’importe qu’elle action.
je suis novice j’ai suivi le tuto de
3ATIVE VFX Studio : Home Assistant and ESPHome Digital OLED Thermostat v3
mon programme esphome:
esphome:
name: d1minithermostat1
friendly_name: D1minithermostat1
esp8266:
board: esp01_1m
substitutions:
room: JX # Room Name
entity_heater: input_boolean.tut_thermo_fire ### Change for your 'Heating' Entity [u]=> je ne sais pas par quoi le remplacer[/u]
entity_cooler: input_boolean.tut_thermo_cool ### Change for your 'Cooling' Entity[u]=> je ne sais pas par quoi le remplacer[/u]
default_low: "20"
default_hi: "25"
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
ota:
password: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "D1Minithermostat1"
password: "xxxxxxxxxxx"
i2c:
sda: GPIO4
scl: GPIO5
frequency: 400kHz
captive_portal:
switch:
- platform: template
id: heat_cool
optimistic: true
- platform: gpio
id: relay_heater
pin: GPIO16
# inverted: true
- platform: gpio
id: relay_cooler
pin: GPIO14
# inverted: true
- platform: template
id: brightness
optimistic: true
binary_sensor:
- platform: template
id: fire
- platform: template
id: cool
- platform: gpio
id: button
pin:
number: GPIO2
inverted: true
on_press:
then:
- switch.toggle: heat_cool
on_click:
- min_length: 1000ms
max_length: 20000ms
then:
- switch.toggle: brightness
climate:
- platform: thermostat
min_cooling_off_time: 0s
min_cooling_run_time: 0s
min_heating_off_time: 0s
min_heating_run_time: 0s
min_idle_time: 0s
visual:
min_temperature: 15 °C
max_temperature: 30 °C
name: "${room} Thermostat"
id: this_thermostat
sensor: internal_temperature
### Updated for ESPHome v2022.10.0 Onwards
default_preset: Home ### NEW! Use this to set Preset
# on_boot_restore_from: memory ### Use this to "Restore From Memeory" (A Saved State) OR...
on_boot_restore_from: default_preset ### Use this to set Preset to start on every Boot
preset:
- name: Home
default_target_temperature_low: $default_low
default_target_temperature_high: $default_hi
mode: AUTO
###########################################
cool_action:
- switch.turn_on: relay_cooler
- lambda: id(cool).publish_state(true);
- homeassistant.service:
service: homeassistant.turn_on
data:
entity_id: $entity_cooler
heat_action:
- switch.turn_on: relay_heater
- lambda: id(fire).publish_state(true);
- homeassistant.service:
service: homeassistant.turn_on
data:
entity_id: $entity_heater
idle_action:
- switch.turn_off: relay_cooler
- switch.turn_off: relay_heater
- lambda: id(cool).publish_state(false);
- lambda: id(fire).publish_state(false);
- homeassistant.service:
service: homeassistant.turn_off
data:
entity_id: $entity_cooler
- homeassistant.service:
service: homeassistant.turn_off
data:
entity_id: $entity_heater
sensor:
- platform: bme280
temperature:
name: "BME280 Temperature"
oversampling: 16x
id: internal_temperature
pressure:
name: "BME280 Pressure"
id: internal_pressure
humidity:
name: "BME280 Humidity"
id: internal_humidity
address: 0x77
update_interval: 15s
- platform: template
id: oled_contrast
- platform: rotary_encoder
id: encoder
pin_a:
number: GPIO12
mode: INPUT_PULLUP
pin_b:
number: GPIO13
mode: INPUT_PULLUP
on_clockwise:
- if:
condition:
switch.is_on: brightness
then:
- sensor.template.publish:
id: oled_contrast
state: !lambda "return id(oled_contrast).state + 0.02;"
- lambda: |-
id(oled1).set_contrast( id(oled_contrast).state );
else:
- if:
condition:
switch.is_on: heat_cool
then:
- climate.control:
id: this_thermostat
target_temperature_high: !lambda "return id(this_thermostat).target_temperature_high + 0.5;"
else:
- climate.control:
id: this_thermostat
target_temperature_low: !lambda "return id(this_thermostat).target_temperature_low + 0.5;"
on_anticlockwise:
then:
- if:
condition:
switch.is_on: brightness
then:
- sensor.template.publish:
id: oled_contrast
state: !lambda "return id(oled_contrast).state - 0.02;"
- lambda: |-
id(oled1).set_contrast( id(oled_contrast).state);
else:
- if:
condition:
switch.is_on: heat_cool
then:
- climate.control:
id: this_thermostat
target_temperature_high: !lambda "return id(this_thermostat).target_temperature_high - 0.5;"
else:
- climate.control:
id: this_thermostat
target_temperature_low: !lambda "return id(this_thermostat).target_temperature_low - 0.5;"
display:
- platform: ssd1306_i2c
id: oled1
update_interval: 1.0s
contrast: 0.4
model: "SSD1306 128x64"
rotation: 180
address: 0x3C
lambda: |-
if (id(fire).state) {id(ani_fire).next_frame(); it.image(0, 0, id(ani_fire));}
else if (id(cool).state) {id(ani_fan).next_frame(); it.image(0, 0, id(ani_fan));}
else {it.image(0, 0, id(home_thermometer));}
it.print(64, 0, id(font1), TextAlign::TOP_CENTER, "${room}");
it.printf(128, 0, id(font4), TextAlign::TOP_RIGHT, " %.1f%% ", id(internal_humidity).state);
it.printf(64, 4, id(font2), TextAlign::TOP_CENTER, " %.1f°", id(internal_temperature).state);
it.printf(0, 64, id(font3), TextAlign::BASELINE_LEFT, "L:%.1f°", id(this_thermostat).target_temperature_low);
it.printf(128, 64, id(font3), TextAlign::BASELINE_RIGHT, "H:%.1f°", id(this_thermostat).target_temperature_high);
if (id(brightness).state) {it.image(56, 51, id(bulb));}
else if (id(heat_cool).state) {it.image(56, 51, id(arrow_right));}
else {it.image(56, 51, id(arrow_left));}
animation:
- file: 'fan.gif'
id: ani_fan
- file: 'fire.gif'
id: ani_fire
image:
- file: 'home-thermometer.png'
id: home_thermometer
- file: 'arrow-left-circle-outline.png'
id: arrow_left
- file: 'arrow-right-circle-outline.png'
id: arrow_right
- file: 'lightbulb-on-outline.png'
id: bulb
font:
- file: 'nasalization.ttf'
id: font1
size: 12
- file: 'refsan.ttf'
id: font2
size: 42
- file: 'refsan.ttf'
id: font3
size: 13
- file: 'refsan.ttf'
id: font4
size: 10
Ma configuration
[center]## System Information
version |
core-2023.4.2 |
installation_type |
Home Assistant OS |
dev |
false |
hassio |
true |
docker |
true |
user |
root |
virtualenv |
false |
python_version |
3.10.10 |
os_name |
Linux |
os_version |
5.15.90 |
arch |
x86_64 |
timezone |
Europe/Paris |
config_dir |
/config |
Home Assistant Community Store
GitHub API |
ok |
GitHub Content |
ok |
GitHub Web |
ok |
GitHub API Calls Remaining |
5000 |
Installed Version |
1.32.1 |
Stage |
running |
Available Repositories |
1265 |
Downloaded Repositories |
18 |
Home Assistant Cloud
logged_in |
false |
can_reach_cert_server |
ok |
can_reach_cloud_auth |
ok |
can_reach_cloud |
ok |
Home Assistant Supervisor
host_os |
Home Assistant OS 9.5 |
update_channel |
stable |
supervisor_version |
supervisor-2023.04.0 |
agent_version |
1.4.1 |
docker_version |
20.10.22 |
disk_total |
234.0 GB |
disk_used |
18.9 GB |
healthy |
true |
supported |
true |
board |
generic-x86-64 |
supervisor_api |
ok |
version_api |
ok |
installed_addons |
File editor (5.5.0), Samba share (10.0.0), Terminal & SSH (9.6.1), Mosquitto broker (6.2.0), ESPHome (2023.3.2), Node-RED (14.1.3), Spotify Connect (0.12.3), Studio Code Server (5.5.6), VLC (0.1.3), InfluxDB (4.6.0), Grafana (8.2.1), Let’s Encrypt (4.12.8), MariaDB (2.5.2), Plex Media Server (3.2.4), Music Assistant BETA (2.0.0b27) |
Dashboards
dashboards |
1 |
resources |
11 |
views |
9 |
mode |
storage |
Recorder
oldest_recorder_run |
31 mars 2023 à 11:30 |
current_recorder_run |
9 avril 2023 à 10:09 |
estimated_db_size |
229.04 MiB |
database_engine |
sqlite |
database_version |
3.38.5 |
Spotify
api_endpoint_reachable |
ok |
[/center]
Comment récupérer ma configuration :
Dans votre HA, Menu latéral `Paramètres` > `Système` > `Corrections` puis les trois petits points en haut a droite > `Informations Système` puis une fois en bas `Copier`
___