Added moonphase sensor and MDI representation at dummy position.

This commit is contained in:
Marcus Scholz 2021-10-08 17:27:03 +02:00
parent 5eb5d7ca44
commit 0abbd5ccf6

View File

@ -91,10 +91,6 @@ sensor:
entity_id: sensor.schlafzimmer_luftdruck entity_id: sensor.schlafzimmer_luftdruck
id: airpressure id: airpressure
- platform: homeassistant
entity_id: sensor.moon
id: moonphase
- platform: homeassistant - platform: homeassistant
entity_id: zone.home entity_id: zone.home
attribute: latitude attribute: latitude
@ -137,6 +133,10 @@ text_sensor:
format: "%H:%M" format: "%H:%M"
internal: True internal: True
- platform: homeassistant
entity_id: sensor.moon
id: moonphase
# Webserver configuration entry # Webserver configuration entry
web_server: web_server:
port: 80 port: 80
@ -319,6 +319,48 @@ display:
it.print(50, 115, id(sub_sensor_font), TextAlign::BASELINE_LEFT, "- hPa"); it.print(50, 115, id(sub_sensor_font), TextAlign::BASELINE_LEFT, "- hPa");
} }
/* Moon phase display */
if(id(moonphase).has_state()) {
int x = 526;
int y = 276;
if (id(moonphase).state == "new_moon") {
// new moon
it.print(x, y, id(mdi_small), TextAlign::BASELINE_CENTER, "󰽤");
ESP_LOGI("Moonphase", "new moon");
} else if (id(moonphase).state == "waxing_crescent") {
// waxing crescent
it.print(x, y, id(mdi_small), TextAlign::BASELINE_CENTER, "󰽧");
ESP_LOGI("Moonphase", "waxing crescent");
} else if (id(moonphase).state == "first_quarter") {
// first_quarter
it.print(x, y, id(mdi_small), TextAlign::BASELINE_CENTER, "󰽡");
ESP_LOGI("Moonphase", "first quarter");
} else if (id(moonphase).state == "waxing_gibbous") {
// waxing gibbous
it.print(x, y, id(mdi_small), TextAlign::BASELINE_CENTER, "󰽨");
ESP_LOGI("Moonphase", "waxing gibbous");
} else if (id(moonphase).state == "full_moon") {
// full moon
it.print(x, y, id(mdi_small), TextAlign::BASELINE_CENTER, "󰽢");
ESP_LOGI("Moonphase", "full moon");
} else if (id(moonphase).state == "waning_gibbous") {
// waning gibbous
it.print(x, y, id(mdi_small), TextAlign::BASELINE_CENTER, "󰽦");
ESP_LOGI("Moonphase", "waning gibbous");
} else if (id(moonphase).state == "last_quarter") {
// last quarter
it.print(x, y, id(mdi_small), TextAlign::BASELINE_CENTER, "󰽣");
ESP_LOGI("Moonphase", "last quarter");
} else if (id(moonphase).state == "waning_crescent") {
// waning crescent
it.print(x, y, id(mdi_small), TextAlign::BASELINE_CENTER, "󰽥");
ESP_LOGI("Moonphase", "waning crescent");
} else {
// N/A
ESP_LOGE("Moonphase", "No data");
}
}
/* INSIDE */ /* INSIDE */
int offsetY = 137; int offsetY = 137;