Compare commits
3 Commits
95760ca7cc
...
6d740d7383
Author | SHA1 | Date | |
---|---|---|---|
6d740d7383 | |||
9aa7d9e693 | |||
3208797a0a |
@ -1 +1 @@
|
||||
2022.2.8
|
||||
2022.2.9
|
@ -121,21 +121,16 @@ sensor:
|
||||
|
||||
text_sensor:
|
||||
- platform: homeassistant
|
||||
entity_id: sun.sun
|
||||
id: sun_state
|
||||
internal: True
|
||||
name: "Sun Rising ESP"
|
||||
entity_id: sensor.sun_rising_template
|
||||
id: sun_rising
|
||||
internal: true
|
||||
|
||||
- platform: homeassistant
|
||||
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
|
||||
name: "Sun Setting ESP"
|
||||
entity_id: sensor.sun_setting_template
|
||||
id: sun_setting
|
||||
internal: true
|
||||
|
||||
- platform: homeassistant
|
||||
entity_id: sensor.moon
|
||||
@ -291,7 +286,7 @@ font:
|
||||
]
|
||||
|
||||
image:
|
||||
- file: "epaperframe/C1024_logo_flat.png"
|
||||
- file: "epaperframe/C1024_logo_flat_bw.png"
|
||||
id: c1024_logo
|
||||
type: binary
|
||||
|
||||
@ -325,33 +320,9 @@ 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");
|
||||
/*
|
||||
@ -598,15 +569,14 @@ display:
|
||||
it.print(80 + offsetX, 200, id(big_sensor_font), TextAlign::BASELINE_LEFT, "Lüften!");
|
||||
}
|
||||
|
||||
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);
|
||||
/* ESP_LOGI("Sunrise: %s, Sunset: %s",
|
||||
id(sun_rising).state.c_str(), 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);
|
||||
}
|
||||
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());
|
||||
|
||||
/* Serverroom */
|
||||
offsetY = 247;
|
||||
|
29
sensors.yaml
29
sensors.yaml
@ -2,6 +2,7 @@
|
||||
- platform: time_date
|
||||
display_options:
|
||||
- 'time'
|
||||
- 'date'
|
||||
# Raspberry Pi CPU temp
|
||||
- platform: command_line
|
||||
name: "CPU Temp"
|
||||
@ -37,17 +38,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'
|
||||
@ -56,3 +57,15 @@
|
||||
- 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') }}"
|
||||
|
Loading…
Reference in New Issue
Block a user