Skip to content

Plotly chart with data collected in a command_line sensor #304

Answered by dbuezas
evilalmus asked this question in Q&A
Discussion options

You must be logged in to vote

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:

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_…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by evilalmus
Comment options

You must be logged in to vote
1 reply
@dbuezas
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants