-
I brought this up in the HA forums, and mateine tried to help but suggested I come here if I needed more assistance. I'll try to be as complete as possible. First, the sensor. This is a command_line sensor that's pulling data from the CDC public API (no auth is required, so, if you want to pull it yourself you can)
The data is collected in attributes in the sensor, like so: Here is the old apexcharts-card that does work, I'd just like to convert it over to Plootly:
Lastly, this is what I have so far (using the 'fn' code suggested in the forums.
Any help would be appreciated, I'm not much of a coder (I'm not a coder at all), so I'm not really understanding most of the custom |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Rumor has it that dbuezas and mateine am the same person 😀 type: custom:plotly-graph
entities:
- entity: sensor.covid_wastewater_1142
filters:
- fn: |-
({meta}) => {
var filtered_data = meta.data.filter(function(record) {
return 'pcr_conc_smoothed' in record;
});
var filtered_map = filtered_data.map(record => {
return [new Date(record.date).getTime(), record.pcr_conc_smoothed/1000000];
});
return {xs: filtered_map.map(([x]) => x), ys: filtered_map.map(([x, y])=>y) }
}
hours_to_show: 200
refresh_interval: 10 |
Beta Was this translation helpful? Give feedback.
-
Nice to meet you @dbuezas. the YAML, for anyone else trying to do something similar:
|
Beta Was this translation helpful? Give feedback.
Rumor has it that dbuezas and mateine am the same person 😀
I wrote the previous answer in my phone so it has some mistakes.
Try this: