Skip to content

Tibber get_prices incompatible with templates #123293

Description

@functionpointer

The problem

The response of the tibber.get_prices action includes datetime objects, which are not handled properly when part of a template.

Instead, the entire answer gets converted into a string:
grafik
grafik

By contrast, the weather integration handles it properly:
grafik
grafik

Notice the result type list as opposed to string.
Returning a string makes using the result difficult, i.e. if we wanted to plot the electricity prices or weather forecast using apexcharts card.

What version of Home Assistant Core has the issue?

dev branch (9717a86)

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Core

Integration causing the issue

tibber

Link to integration documentation on our website

https://www.home-assistant.io/integrations/tibber/

Diagnostics information

No response

Example YAML snippet

template:
  - trigger:
      - platform: time_pattern
        minutes: /1
    action:
      - service: weather.get_forecasts
        data:
          type: hourly
        target:
          entity_id: weather.home
        response_variable: hourly
    sensor:
      - name: Weather Forecast Hourly
        unique_id: weather_forecast_hourly
        state: "{{ now().isoformat() }}"
        attributes:
          forecast: "{{ hourly['weather.home'].forecast }}"
  - trigger:
     - platform: time_pattern
       minutes: /1
    action:
      - service: tibber.get_prices
        response_variable: my_spot_prices
    sensor:
      - name: Tibber Spot Prices
        unique_id: tibber_spot_prices
        state: "{{ now().isoformat() }}"
        attributes:
          price: "{{ my_spot_prices }}"

Anything in the logs that might be useful for us?

No response

Additional information

No response

Metadata

Metadata

Type

No type

Fields

Priority

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions