diff --git a/esphome/epaperframe.yaml b/esphome/epaperframe.yaml index aa40e9a..f368cd4 100644 --- a/esphome/epaperframe.yaml +++ b/esphome/epaperframe.yaml @@ -91,10 +91,6 @@ sensor: entity_id: sensor.schlafzimmer_luftdruck id: airpressure - - platform: homeassistant - entity_id: sensor.moon - id: moonphase - - platform: homeassistant entity_id: zone.home attribute: latitude @@ -137,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 @@ -319,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;