Getting an action response variable in a card?

Hi is there a way to get the output form a response variable into a card for display?

The integration I am working on returns a lot of data, a bit like the weather platform “get_forecasts”. In all the examples I find, the automation is putting the result into an entity, which can then be displayed elsewhere.

But one of the advantages of using response variables is that they can return a large amount of data and shouldn’t be written as the entity state…

Is there a way to store a response so that it can be used elsewhere?

The actual use case is to display tide forecast values in an apex chart, but it is working a bit like a weather service.

So for the weather example I currently have a standard call to get_forecasts:

template:
  - trigger:
      - platform: time_pattern
        minutes: /5
    action:
      - service: weather.get_forecasts
        target:
          entity_id: weather.myplace
        data:
          type: hourly
        response_variable: weather_myplace_var
    sensor:
      - name: weather_myplace
        unique_id: weather_myplace
        state: "{{ now().isoformat() }}"
        attributes:
          forecast: "{{ weather_myplace_var['weather.myplace'].forecast  }}"

Can weather_myplace_var be passed over to a lovelace card such as apexchart without being stored in a sensor to get there? The main reason for considering this is that the sensor weather_myplace is only used for temporary storage but it will get written to the recorder unless I take action to prevent that.

It may be possible to call the action from JavaScript and have the response be available in JavaScript and if this works you may be able do it from within the data generator in apexcharts.

Hi Jeremy Cook,

The variable appears to be text or a list or something, so it might stay in the 10 day recorder but it will not end up in LTS. It is not a measurement and does not have a state class.

Also an exclude line in recorder can even prevent that. I don’t think what you are asking is allowed but I might be wrong.

Yes, its a python dict that is returned. HA doesn’t have global variables, but it would be useful to have a mechanism to access data from cards and avoid writing large datasets into entities. I guess it’s not possible at the moment. BTW, yes I added a recorder exclude to prevent storing my dataset in the database every 10 minutes.