Compare commits

..

3 Commits

2 changed files with 49 additions and 1 deletions

2
esphome/.gitignore vendored
View File

@ -9,3 +9,5 @@
**/platformio.ini
**/partitions.csv
/secrets.yaml
.vscode/

View File

@ -90,7 +90,7 @@ sensor:
- platform: homeassistant
entity_id: sensor.schlafzimmer_luftdruck
id: airpressure
- platform: homeassistant
entity_id: zone.home
attribute: latitude
@ -133,6 +133,10 @@ text_sensor:
format: "%H:%M"
internal: True
- platform: homeassistant
entity_id: sensor.moon
id: moonphase
# Webserver configuration entry
web_server:
port: 80
@ -315,6 +319,48 @@ display:
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 */
int offsetY = 137;