Compare commits
No commits in common. "6d740d738377e2b978d64223816e0a841f7a2166" and "95760ca7ccf663074ecb2fdf82edffbaec89ea17" have entirely different histories.
6d740d7383
...
95760ca7cc
@ -1 +1 @@
|
|||||||
2022.2.9
|
2022.2.8
|
@ -121,16 +121,21 @@ sensor:
|
|||||||
|
|
||||||
text_sensor:
|
text_sensor:
|
||||||
- platform: homeassistant
|
- platform: homeassistant
|
||||||
name: "Sun Rising ESP"
|
entity_id: sun.sun
|
||||||
entity_id: sensor.sun_rising_template
|
id: sun_state
|
||||||
id: sun_rising
|
internal: True
|
||||||
internal: true
|
|
||||||
|
|
||||||
- platform: homeassistant
|
- platform: homeassistant
|
||||||
name: "Sun Setting ESP"
|
entity_id: sun.sun
|
||||||
entity_id: sensor.sun_setting_template
|
id: sun_rise
|
||||||
id: sun_setting
|
attribute: next_rising
|
||||||
internal: true
|
internal: True
|
||||||
|
|
||||||
|
- platform: homeassistant
|
||||||
|
entity_id: sun.sun
|
||||||
|
id: sun_set
|
||||||
|
attribute: next_setting
|
||||||
|
internal: True
|
||||||
|
|
||||||
- platform: homeassistant
|
- platform: homeassistant
|
||||||
entity_id: sensor.moon
|
entity_id: sensor.moon
|
||||||
@ -286,7 +291,7 @@ font:
|
|||||||
]
|
]
|
||||||
|
|
||||||
image:
|
image:
|
||||||
- file: "epaperframe/C1024_logo_flat_bw.png"
|
- file: "epaperframe/C1024_logo_flat.png"
|
||||||
id: c1024_logo
|
id: c1024_logo
|
||||||
type: binary
|
type: binary
|
||||||
|
|
||||||
@ -320,9 +325,33 @@ display:
|
|||||||
int sleepingroom_pm25 = int(id(pm25_sleepingroom).state);
|
int sleepingroom_pm25 = int(id(pm25_sleepingroom).state);
|
||||||
float sleepingroom_co2 = id(co2_sleepingroom).state;
|
float sleepingroom_co2 = id(co2_sleepingroom).state;
|
||||||
float serverroom_temp = id(temp_serverroom).state;
|
float serverroom_temp = id(temp_serverroom).state;
|
||||||
|
char sunrise[5] = "";
|
||||||
|
char sunset[5] = "";
|
||||||
int offsetX = 0;
|
int offsetX = 0;
|
||||||
int offsetY = 0;
|
int offsetY = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
This is Commander1024 doing awful string / time fuckerey full of
|
||||||
|
desperation to format sunrise / sunset times.
|
||||||
|
Don't be like Commander1024
|
||||||
|
|
||||||
|
Format: 2021-10-08T05:40:47.467076+00:00 -> 7:40 (dst)
|
||||||
|
*/
|
||||||
|
int dst = id(homeassistant_time).now().is_dst; // returns 1 for dst, otherwise 0
|
||||||
|
struct tm tm;
|
||||||
|
memset (&tm, 0, sizeof (tm));
|
||||||
|
strptime(id(sun_rise).state.c_str(), "%Y-%m-%dT%H:%M:%S", &tm);
|
||||||
|
time_t rawtime = mktime(&tm);
|
||||||
|
struct tm* ltm = localtime(&rawtime);
|
||||||
|
sprintf(sunrise, "%d:%02d", ltm->tm_hour + dst, ltm->tm_min);
|
||||||
|
|
||||||
|
memset (&tm, 0, sizeof (tm));
|
||||||
|
strptime(id(sun_set).state.c_str(), "%Y-%m-%dT%H:%M:%S", &tm);
|
||||||
|
rawtime = mktime(&tm);
|
||||||
|
ltm = localtime(&rawtime);
|
||||||
|
sprintf(sunset, "%d:%02d", ltm->tm_hour + dst, ltm->tm_min);
|
||||||
|
|
||||||
|
|
||||||
/* OUTSIDE */
|
/* OUTSIDE */
|
||||||
it.print(10, 10, id(sensor_unit), "Umwelt");
|
it.print(10, 10, id(sensor_unit), "Umwelt");
|
||||||
/*
|
/*
|
||||||
@ -569,14 +598,15 @@ display:
|
|||||||
it.print(80 + offsetX, 200, id(big_sensor_font), TextAlign::BASELINE_LEFT, "Lüften!");
|
it.print(80 + offsetX, 200, id(big_sensor_font), TextAlign::BASELINE_LEFT, "Lüften!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ESP_LOGI("Sunrise: %s, Sunset: %s",
|
if(id(sun_state).has_state()) {
|
||||||
id(sun_rising).state.c_str(), id(sun_setting).state.c_str());
|
ESP_LOGI("Sun", "State of the sun: %s, sunrise: %s, sunset: %s",
|
||||||
*/
|
id(sun_state).state.c_str(), sunrise, sunset);
|
||||||
|
|
||||||
it.print(10 + offsetX, 250, id(mdi_small), TextAlign::BASELINE_LEFT, ""); // sun-up
|
it.print(10 + offsetX, 250, id(mdi_small), TextAlign::BASELINE_LEFT, ""); // sun-up
|
||||||
it.printf(50 + offsetX, 250, id(sensor_unit), TextAlign::BASELINE_LEFT, "%s", id(sun_rising).state.c_str());
|
it.printf(50 + offsetX, 250, id(sensor_unit), TextAlign::BASELINE_LEFT, "%s", sunrise);
|
||||||
it.print(135 + offsetX, 250, id(mdi_small), TextAlign::BASELINE_LEFT, ""); // sun-down
|
it.print(135 + offsetX, 250, id(mdi_small), TextAlign::BASELINE_LEFT, ""); // sun-down
|
||||||
it.printf(175 + offsetX, 250, id(sensor_unit), TextAlign::BASELINE_LEFT, "%s", id(sun_setting).state.c_str());
|
it.printf(175 + offsetX, 250, id(sensor_unit), TextAlign::BASELINE_LEFT, "%s", sunset);
|
||||||
|
}
|
||||||
|
|
||||||
/* Serverroom */
|
/* Serverroom */
|
||||||
offsetY = 247;
|
offsetY = 247;
|
||||||
|
13
sensors.yaml
13
sensors.yaml
@ -2,7 +2,6 @@
|
|||||||
- platform: time_date
|
- platform: time_date
|
||||||
display_options:
|
display_options:
|
||||||
- 'time'
|
- 'time'
|
||||||
- 'date'
|
|
||||||
# Raspberry Pi CPU temp
|
# Raspberry Pi CPU temp
|
||||||
- platform: command_line
|
- platform: command_line
|
||||||
name: "CPU Temp"
|
name: "CPU Temp"
|
||||||
@ -57,15 +56,3 @@
|
|||||||
- platform: statistics
|
- platform: statistics
|
||||||
name: 'WAN Traffic Out'
|
name: 'WAN Traffic Out'
|
||||||
entity_id: sensor.internet_speed_out
|
entity_id: sensor.internet_speed_out
|
||||||
|
|
||||||
- platform: template
|
|
||||||
sensors:
|
|
||||||
sun_rising_template:
|
|
||||||
friendly_name: "Sun Rising Template"
|
|
||||||
value_template: "{{ as_timestamp(states.sun.sun.attributes.next_rising) | timestamp_custom ('%H:%M') }}"
|
|
||||||
|
|
||||||
- platform: template
|
|
||||||
sensors:
|
|
||||||
sun_setting_template:
|
|
||||||
friendly_name: "Sun Setting Template"
|
|
||||||
value_template: "{{ as_timestamp(states.sun.sun.attributes.next_setting) | timestamp_custom ('%H:%M') }}"
|
|
||||||
|
Loading…
Reference in New Issue
Block a user