Added Livinroom power sensors.

This commit is contained in:
Marcus Scholz 2022-04-09 21:44:35 +02:00
parent e9937726ec
commit 4bfcc04fc5

View File

@ -160,6 +160,14 @@ sensor:
entity_id: sensor.serverraum_power
id: power_serverroom
- platform: homeassistant
entity_id: sensor.schreibtisch_power
id: desk_livingroom
- platform: homeassistant
entity_id: sensor.wohnzimmer_heimkino_power
id: media_livingroom
text_sensor:
- platform: homeassistant
name: "Sun Rising ESP"
@ -217,7 +225,7 @@ time:
- output.turn_on: power_key
- delay: 0.5s
- output.turn_off: power_key
# Every 5 minutes
# Every 10 minutes
- seconds: 0
minutes: /10
then:
@ -693,6 +701,8 @@ display:
float total_power = id(power_total).state;
float serverroom_power = id(power_serverroom).state;
float livingroom_desk = id(desk_livingroom).state;
float livingroom_media = id(media_livingroom).state;
int offsetX = 0;
int offsetY = 0;
@ -711,46 +721,24 @@ display:
offsetY = 127;
it.print(10, 10 + offsetY, id(sensor_unit), "Wohnzimmer");
it.filled_rectangle(136, 21 + offsetY, 247, 3);
/*
it.print(10, 114 + offsetY, id(mdi_small), TextAlign::BASELINE_LEFT, "󰮬"); // PM2.5
it.print(375, 75 + offsetY, id(mdi_small), TextAlign::BASELINE_CENTER, "󰔏"); // thermometer
it.print(375, 115 + offsetY, id(mdi_small), TextAlign::BASELINE_CENTER, "󰖎"); // water percent
it.print(10, 75 + offsetY, id(mdi_small), TextAlign::BASELINE_LEFT, "󰟤"); // CO2
it.print(375, 75 + offsetY, id(mdi_small), TextAlign::BASELINE_CENTER, "󰚥"); // power-plug
it.print(375, 115 + offsetY, id(mdi_small), TextAlign::BASELINE_CENTER, "󰚥"); // power-plug
if(livingroom_temp > -100 && livingroom_temp < 100) {
it.printf(357, 75 + offsetY, id(sub_sensor_font), TextAlign::BASELINE_RIGHT, "%2.1fºC", livingroom_temp);
if(livingroom_desk >= 0) {
it.printf(357, 75 + offsetY, id(sub_sensor_font), TextAlign::BASELINE_RIGHT, "%2.1fW", livingroom_desk);
}
else {
it.print(357, 75 + offsetY, id(sub_sensor_font), TextAlign::BASELINE_RIGHT, " - ºC");
it.print(357, 75 + offsetY, id(sub_sensor_font), TextAlign::BASELINE_RIGHT, " - W");
}
if(livingroom_humid >=0 && livingroom_humid <= 100) {
it.printf(357, 115 + offsetY, id(sub_sensor_font), TextAlign::BASELINE_RIGHT, "%3d%%", livingroom_humid);
if(livingroom_media >= 0) {
it.printf(357, 115 + offsetY, id(sub_sensor_font), TextAlign::BASELINE_RIGHT, "%2.1fW", livingroom_media);
}
else {
it.print(357, 115 + offsetY, id(sub_sensor_font), TextAlign::BASELINE_RIGHT, " - %");
it.print(357, 115 + offsetY, id(sub_sensor_font), TextAlign::BASELINE_RIGHT, " - W");
}
if(livingroom_co2 >=380 && livingroom_co2 <= 20000) {
it.printf(170, 75 + offsetY, id(big_sensor_font), TextAlign::BASELINE_RIGHT, "%4.0f", livingroom_co2);
it.print(175, 50 + offsetY, id(sensor_unit), TextAlign::BASELINE_LEFT, "ppm");
}
else {
it.print(170, 75 + offsetY, id(big_sensor_font), TextAlign::BASELINE_RIGHT, "- ");
it.print(175, 50 + offsetY, id(sensor_unit), TextAlign::BASELINE_LEFT, "ppm³");
}
if(livingroom_pm25 < 255 && livingroom_pm25 >=0) {
it.printf(200, 114 + offsetY, id(big_sensor_font), TextAlign::BASELINE_RIGHT, "%3d", livingroom_pm25);
it.print(205, 114 + offsetY, id(sensor_unit), TextAlign::BASELINE_LEFT, "µg/m³");
}
else {
it.print(200, 114 + offsetY, id(big_sensor_font), TextAlign::BASELINE_RIGHT, "- ");
it.print(205, 114 + offsetY, id(sensor_unit), TextAlign::BASELINE_LEFT, "µg/m³");
}
*/
/* Sleepingroom */
offsetY = 247;
it.print(10, 10 + offsetY, id(sensor_unit), "Schlafzimmer");
@ -803,7 +791,7 @@ display:
it.print(227 + offsetX, 20 + offsetY, id(mdi_small), TextAlign::BASELINE_CENTER, "󰴾"); // transmission-tower
if(total_power > 0 && total_power < 19999) {
if(total_power >= 0) {
it.printf(207 + offsetX, 20 + offsetY, id(sub_sensor_font), TextAlign::BASELINE_RIGHT, "W");
it.printf(170 + offsetX, 20 + offsetY, id(big_sensor_font), TextAlign::BASELINE_RIGHT, "%2.1f", total_power);
}
@ -820,7 +808,7 @@ display:
it.print(227 + offsetX, 110 + offsetY, id(mdi_small), TextAlign::BASELINE_CENTER, "󰚥"); // power-plug
if(serverroom_power > 0 && serverroom_power < 999) {
if(serverroom_power >= 0) {
it.printf(207 + offsetX, 110 + offsetY, id(sub_sensor_font), TextAlign::BASELINE_RIGHT, "W");
it.printf(170 + offsetX, 110 + offsetY, id(big_sensor_font), TextAlign::BASELINE_RIGHT, "%2.1f", serverroom_power);
}