#Apexcharts-card datagenerator help needed

1 messages · Page 1 of 1 (latest)

crude knot
#

Hey all, so as the title says I'd need a bit of help to get this working. I can't find my issue so a fresh pair of eyes would be lovely.

I'm trying to make an apexchart "temperature forecast" I've got a template up and running grabbing the temperature and date/time.
that code looks like this ```template:

  • trigger:
    • platform: time_pattern
      hours: /1
      action:
    • action: weather.get_forecasts
      data:
      type: hourly
      target:
      entity_id: weather.bree
      response_variable: hourly
      sensor:
    • name: Temperature forecast
      unique_id: temperature_forecast
      device_class: timestamp
      state: "{{ now() }}"
      attributes:
      temperatures: "{{ hourly['weather.bree'].forecast | map(attribute='temperature') | list }}"
      datetime: "{{ hourly['weather.bree'].forecast | map(attribute='datetime') | list }}"```

I can also see it's grabbing the temps and date accordingly (attached screenshot)

now for my apexcharts-card my code is the following ```type: custom:apexcharts-card
graph_span: 2d
span:
start: minute
header:
show: true
title: Temperature forecast
show_states: false
now:
show: true
label: now
apex_config:
legend:
show: false
series:

  • entity: sensor.temperature_forecast
    type: line
    color: rgb(70, 126, 238)
    extend_to: now
    unit: mm
    show:
    in_header: false
    data_generator: |
    return entity.attributes.temperatures.map((entry) => {
    return [new Date(entry.datetime).getTime(), entry.temperatures];
    });```

but my card stays empty and I'm unable to see what the issue might be. is it possible that the datetime needs to be formatted?

ocean merlin
#

Hi, I am crazy about Apexchart so far and I've modified the code as I thought like this.

series:
  - entity: sensor.temperature_forecast
    type: line
    color: rgb(70, 126, 238)
    extend_to: now
    unit: °C
    show:
      in_header: false
    data_generator: |
      return entity.attributes.temperatures.map((entry, index) => {
         return [new Date(entity.attributes.datetime[index]).getTime(), entry];
      });
#

if it doesnt work still, you may send me dm so that we have deep discussion

ocean merlin
#

good to hear that.