home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.43k stars 30.68k forks source link

Tibber get_prices incompatible with templates #123293

Closed functionpointer closed 1 week ago

functionpointer commented 3 months ago

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 (9717a867a77c5416d8d)

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

home-assistant[bot] commented 3 months ago

Hey there @danielhiversen, mind taking a look at this issue as it has been labeled with an integration (tibber) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `tibber` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign tibber` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


tibber documentation tibber source (message by IssueLinks)