Compare commits

..

No commits in common. "6d740d738377e2b978d64223816e0a841f7a2166" and "95760ca7ccf663074ecb2fdf82edffbaec89ea17" have entirely different histories.

3 changed files with 57 additions and 40 deletions

View File

@ -1 +1 @@
2022.2.9
2022.2.8

View File

@ -121,16 +121,21 @@ sensor:
text_sensor:
- platform: homeassistant
name: "Sun Rising ESP"
entity_id: sensor.sun_rising_template
id: sun_rising
internal: true
entity_id: sun.sun
id: sun_state
internal: True
- platform: homeassistant
name: "Sun Setting ESP"
entity_id: sensor.sun_setting_template
id: sun_setting
internal: true
entity_id: sun.sun
id: sun_rise
attribute: next_rising
internal: True
- platform: homeassistant
entity_id: sun.sun
id: sun_set
attribute: next_setting
internal: True
- platform: homeassistant
entity_id: sensor.moon
@ -286,7 +291,7 @@ font:
]
image:
- file: "epaperframe/C1024_logo_flat_bw.png"
- file: "epaperframe/C1024_logo_flat.png"
id: c1024_logo
type: binary
@ -320,9 +325,33 @@ display:
int sleepingroom_pm25 = int(id(pm25_sleepingroom).state);
float sleepingroom_co2 = id(co2_sleepingroom).state;
float serverroom_temp = id(temp_serverroom).state;
char sunrise[5] = "";
char sunset[5] = "";
int offsetX = 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 */
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!");
}
/* ESP_LOGI("Sunrise: %s, Sunset: %s",
id(sun_rising).state.c_str(), id(sun_setting).state.c_str());
*/
if(id(sun_state).has_state()) {
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.printf(50 + offsetX, 250, id(sensor_unit), TextAlign::BASELINE_LEFT, "%s", id(sun_rising).state.c_str());
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.print(10 + offsetX, 250, id(mdi_small), TextAlign::BASELINE_LEFT, "󰖜"); // sun-up
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.printf(175 + offsetX, 250, id(sensor_unit), TextAlign::BASELINE_LEFT, "%s", sunset);
}
/* Serverroom */
offsetY = 247;

View File

@ -2,7 +2,6 @@
- platform: time_date
display_options:
- 'time'
- 'date'
# Raspberry Pi CPU temp
- platform: command_line
name: "CPU Temp"
@ -38,17 +37,17 @@
- platform: template
sensors:
internet_speed_in:
friendly_name: 'Internet Speed IN'
value_template: '{{ ((states.input_number.internet_traffic_delta_in.state | float ) / 1000000 ) | round(2) }}'
unit_of_measurement: 'Mbps'
internet_speed_in:
friendly_name: 'Internet Speed IN'
value_template: '{{ ((states.input_number.internet_traffic_delta_in.state | float ) / 1000000 ) | round(2) }}'
unit_of_measurement: 'Mbps'
- platform: template
sensors:
internet_speed_out:
friendly_name: 'Internet Speed OUT'
value_template: '{{ ((states.input_number.internet_traffic_delta_out.state | float ) / 1000000 ) | round(2) }}'
unit_of_measurement: 'Mbps'
internet_speed_out:
friendly_name: 'Internet Speed OUT'
value_template: '{{ ((states.input_number.internet_traffic_delta_out.state | float ) / 1000000 ) | round(2) }}'
unit_of_measurement: 'Mbps'
- platform: statistics
name: 'WAN Traffic In'
@ -57,15 +56,3 @@
- platform: statistics
name: 'WAN Traffic 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') }}"