nuki47
(Nuki47)
October 10, 2024, 9:40am
1
For the past, I use a sensor.day_night
to show the night-period in a apex chart. But how can I show the night period in future in the chart?
The grey block is the night period (from sunset to sunrise)
- entity: sensor.day_night
curve: stepline
type: area
transform: "return x === 'Day' ? 0 : 30 ;"
color: grey
stroke_width: 0
opacity: 0.3
show:
in_header: false
legend_value: false
felixm
October 14, 2024, 7:29pm
2
Hi,
i was on same track for visualization of dynamic energy prices.
My solution (that works) uses the “sunpower” forecast of a German weather forecast (DWD). I transformed every forecast with sunpower > 0 to zero and everything else to max of my graph.
entity: sensor.wetter_sonneneinstrahlung_2
type: area
color: lightgray
show:
in_chart: true
data_generator: |
return entity.attributes.data.map((entry) => {
return [new Date(entry.datetime).getTime(), entry.value > 0 ? 0 : 50];
});
show:
header_color_threshold: true
Works out like this
Hope that helps
nuki47
(Nuki47)
October 14, 2024, 8:12pm
3
interesting approach, but for my situation it’s not possible because I don’t live in Germany (so DWD is not availiabe).
In my openweather forecast I don’t have a sunpower and I think the sunpower value isn’t similar with the sunset/sunrise, or? (and what’s happen on foggy days?)
felixm
October 15, 2024, 7:40am
4
You could try to use UV index in OWM or a solar forecast. Both match sunrise/sunset quite good (±30min). For a visualization this should be precise enough.
nuki47
(Nuki47)
October 20, 2024, 12:31pm
5
sensor.openweathermap_uv_index
but it’s not working?
- entity: sensor.openweathermap_uv_index
type: area
color: grey
opacity: 0.3
stroke_width: 2
data_generator: |
return [new Date(entry.datetime).getTime(), entry.value > 0 ? 0 : 30];
});
felixm
October 28, 2024, 8:28pm
6
Hey,
i think you are running in a problem with the new service get_forecasts thing. At least my OpenWeatherMap Sensor don’t include any forecasts any more and you will need a template sensor:
https://community.home-assistant.io/t/met-no-hourly-forecast-entity-not-available-in-latest-ha/616504/11?u=felixm
Alternativly we have to create a template sensor relying on sunset and sunrise…
nuki47
(Nuki47)
November 1, 2024, 7:24pm
7
I have a forecast sensor which includes the hourly forecast data from openweathermap.
Example (Attributes):
forecast:
- datetime: '2024-11-01T18:00:00+00:00'
condition: cloudy
temperature: 7.7
pressure: 1025
cloud_coverage: 91
wind_speed: 7.31
wind_bearing: 292
uv_index: 0
precipitation_probability: 0
precipitation: 0
apparent_temperature: 6.5
dew_point: 7
wind_gust_speed: 7.42
humidity: 95
I think the uv_index would be fine…but can I bring this forecast into the apex chart as a stepline curve?