Created
April 23, 2023 16:43
-
-
Save huizebruin/eeeb32e955e80b2072a03c2b7a9eefd3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
esphome: | |
name: lcd-notification | |
on_boot: | |
priority: -100.0 | |
then: | |
- lambda: 'id(mydisplay).no_backlight();' | |
esp8266: | |
board: d1_mini | |
# Enable logging | |
logger: | |
# Enable Home Assistant API | |
api: | |
ota: | |
wifi: | |
ssid: !secret wifi_ssid | |
password: !secret wifi_password | |
# Enable fallback hotspot (captive portal) in case wifi connection fails | |
ap: | |
ssid: "Lcd-Notification-Display" | |
captive_portal: | |
i2c: | |
sda: D4 | |
scl: D3 | |
time: | |
- platform: sntp | |
id: my_time | |
text_sensor: | |
# Create text input helper in homeassistant and enter id below | |
- platform: homeassistant | |
entity_id: input_text.tekst_lcd_display | |
id: lcd_text | |
- platform: homeassistant | |
entity_id: input_text.tekst_lcd_display2 | |
id: lcd_text2 | |
- platform: wifi_info | |
ip_address: | |
id: ip_address | |
name: IP address | |
mac_address: | |
id: mac_address | |
name: Mac address | |
ssid: | |
id: connected_ssid | |
name: Network SSID | |
bssid: | |
id: connected_ | |
name: Network Mac | |
sensor: | |
- platform: wifi_signal | |
id: wifisignal | |
name: wifi-signal | |
update_interval: 300s | |
- platform: homeassistant | |
id: inside_temperature | |
entity_id: sensor.living_room_temperature_bmp180 | |
internal: true | |
- platform: homeassistant | |
id: outside_temperature | |
entity_id: sensor.temperatuur_voor_temperature | |
internal: true | |
globals: | |
- id: achtergrondlicht_aan | |
type: bool | |
initial_value: 'false' | |
- id: knipperlicht_aan | |
type: bool | |
initial_value: 'false' | |
- id: page | |
type: int | |
initial_value: "1" | |
switch: | |
- platform: template | |
name: "Achtergrondlicht" | |
id: achtergrondlicht | |
restore_state: false | |
turn_on_action: | |
- globals.set: | |
id: achtergrondlicht_aan | |
value: 'true' | |
- globals.set: | |
id: knipperlicht_aan | |
value: 'false' | |
- lambda: |- | |
id(mydisplay).backlight(); | |
- delay: 5s | |
turn_off_action: | |
- globals.set: | |
id: achtergrondlicht_aan | |
value: 'false' | |
- lambda: |- | |
id(mydisplay).no_backlight(); | |
lambda: |- | |
return id(achtergrondlicht_aan); | |
- platform: template | |
name: "Knipperlicht" | |
id: knipperlicht | |
restore_state: false | |
turn_on_action: | |
- globals.set: | |
id: knipperlicht_aan | |
value: 'true' | |
- globals.set: | |
id: achtergrondlicht_aan | |
value: 'false' | |
- lambda: |- | |
id(mydisplay).backlight(); | |
- delay: 0.75s | |
- lambda: |- | |
id(mydisplay).no_backlight(); | |
- delay: 0.75s | |
- lambda: |- | |
id(mydisplay).backlight(); | |
- delay: 0.75s | |
- lambda: |- | |
id(mydisplay).no_backlight(); | |
- delay: 0.75s | |
- lambda: |- | |
id(mydisplay).backlight(); | |
turn_off_action: | |
- globals.set: | |
id: knipperlicht_aan | |
value: 'false' | |
- lambda: |- | |
id(mydisplay).no_backlight(); | |
lambda: |- | |
return id(knipperlicht_aan); | |
display: | |
- platform: lcd_pcf8574 | |
id: mydisplay | |
dimensions: 16x2 | |
address: 0x27 | |
lambda: |- | |
switch (id(page)){ | |
case 1: | |
it.strftime(0, 0, "%H:%M", id(my_time).now()); | |
it.strftime(0, 1, "%d-%m-%y", id(my_time).now()); | |
break; | |
case 2: | |
it.print(0, 0, id(lcd_text).state.c_str()); | |
break; | |
case 3: | |
// Print inside temperature (from homeassistant sensor) | |
if (id(inside_temperature).has_state()) { | |
it.printf(0, 0, "In %.1fC", id(inside_temperature).state); | |
} | |
// Print outside temperature (from homeassistant sensor) | |
if (id(outside_temperature).has_state()) { | |
it.printf(0, 1, "Out %.1fC", id(outside_temperature).state); | |
break; | |
} | |
case 4: | |
it.print(0, 0, id(lcd_text2).state.c_str()); | |
break; | |
} | |
interval: | |
- interval: 30s | |
then: | |
- lambda: |- | |
id(page) = (id(page) + 1); | |
if (id(page) > 4) { | |
id(page) = 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment