budisek
(budisek)
May 15, 2024, 4:05pm
1
Hi, how can I set my MAX7219digit display to show temperature only during day time and not from 10pm to 6am? Or dim?
time:
- platform: homeassistant
id: homeassistant_time
display:
- platform: max7219digit
cs_pin: D6
num_chips: 4
intensity: 2
lambda: |-
if (id(temperature).has_state()) {
it.printf(0, 0, id(digit_font), "%.1f°C", id(temperature).state);
}
font:
- file: "pixelmix.ttf"
id: digit_font
size: 8
budisek
(budisek)
May 18, 2024, 4:35am
3
There is nothing about time based switch off and on.
Use the Time component to figure out when to turn the display on/off (or set intensity).
nickrout
(Nick Rout)
May 18, 2024, 8:41pm
5
Sorry I didn’t realize you couldn’t search the front page of esphome for the term “time”
Here, I did that for you Time Component — ESPHome
budisek
(budisek)
May 19, 2024, 7:24am
6
I’ve tried this but it does not work
time:
- platform: homeassistant
id: homeassistant_time
font:
- file: "pixelmix.ttf"
id: digit_font
size: 8
display:
- platform: max7219digit
cs_pin: D6
num_chips: 4
intensity: 2
lambda: |-
if (id(homeassistant_time).hour >= 6 && id(homeassistant_time).hour < 22) {
if (id(temperature).has_state()) {
it.printf(0, 0, id(my_font), "%.1f°C", id(temperature).state);
}
} else {
it.fill(0);
}
You’re using a lambda and thus have to do it as show on the Time component page under the Use in Lambdas header.
auto time = id(homeassistant_time).now();
if time.hour ...
nickrout
(Nick Rout)
May 19, 2024, 9:30am
8
You don’t seem to be using the code that was given
it.turn_on_off(true or false)
budisek
(budisek)
May 19, 2024, 1:28pm
9
I don’t understand this. Can you please write here part of lambda code which i need for this function? I could learn it from some example. I am quite a novice in lambda automation
Using it.turn_on_off() :
lambda: |-
auto time = id(homeassistant_time).now();
it.turn_on_off(time.hour >= 6 && time.hour < 22);
Or using it.itensity():
lambda: |-
auto time = id(homeassistant_time).now();
if (time.hour >= 6 && time.hour < 22) {
it.itensity(2);
} else {
it.itensity(0);
}