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.65k stars 30.8k forks source link

Tibber price level just showing HIGH #130113

Open kurtern84 opened 5 days ago

kurtern84 commented 5 days ago

The problem

Price level in Tibber has started to show only HIGH regardless of price.

What version of Home Assistant Core has the issue?

core-2024.11.0

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

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

- sensor:
      - name: Price Level
        unique_id: 0123423443346423432
        state: "{{ state_attr('sensor.electricity_price_asvegen_12','price_level') }}"

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 5 days 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)

perosb commented 5 days ago

This works fine for me. What does the actual sensor show?

And also, what does the action action: tibber.get_prices return?

On another note, this was a breaking change that caused some headaches that price_level is now LOW/NORMAL/HIGH instead of the more detailed VERY_CHEAP > VERY_EXPENSIVE.

kurtern84 commented 5 days ago

Thanks for fast respons! Are the variable VERY_CHEAP > VERY_EXPENSIVE coming back, or is it now only LOW/NORMAL/HIGH? Just wondering because my automotation are responding to VERY_CHEAP > VERY_EXPENSIVE and so on.

action: tibber.get_prices return:

`prices: Åsvegen 12:

perosb commented 5 days ago

Probably not coming back, it was a change in pyTibber https://github.com/Danielhiversen/pyTibber/pull/317 that wasn't marked as breaking. But yes, it broke my automations too. You can add a custom sensors for it, something like:

template:
  - sensor:
      - name: Electricity Price Level
        unique_id: electricity_price_level
        state: >-
          {%- set price = float(states('sensor.electricity_price_infinity_8'), default=-10000) -%}
          {%- set avg_price = float(state_attr('sensor.electricity_price_infinity_8', 'avg_price'), default=0) -%}
          {% if price > -10000 %}
            {{- 'SUPER_CHEAP' if price <= avg_price*0.4 -}}
            {{- 'VERY_CHEAP' if price <= avg_price*0.5 and price > avg_price*0.4 -}}
            {{- 'CHEAP' if price > avg_price*0.5 and price <= avg_price*0.9 -}}
            {{- 'NORMAL' if price > avg_price*0.9 and price < avg_price*1.15 -}}
            {{- 'EXPENSIVE' if price >= avg_price*1.15 and price < avg_price*1.4 -}}
            {{- 'VERY_EXPENSIVE' if price >= avg_price*1.4 }}
          {%else%}
            unknown
          {%endif%}

Adjust interals as needed.

Below is the Tibber definitions:

VERY_CHEAP | The price is smaller or equal to 60 % compared to average price
CHEAP | The price is greater than 60 % and less or equal to 90 % compared to average price
NORMAL | The price is greater than 90 % and less than 115 % compared to average price
EXPENSIVE | The price is greater or equal to 115 % and less than 140 % compared to average price
VERY_EXPENSIVE | The price is greater or equal to 140 % compared to average price
kurtern84 commented 5 days ago

Okey! Thanks for the help:)

Danielhiversen commented 5 days ago

I did not know Tibber has two different price levels :( I changed to a different query, because that returns data easier to work with.

So now I am unsure what to do. Changing it back will be another breaking change :/

kurtern84 commented 5 days ago

For me, the solution above seems to work. Less work to change the automations. Also didn't know they had several price levels.

TylonHH commented 5 days ago

yeah something is broken. Tibber has this in their API

PriceLevel

Price level based on trailing price average (3 days for hourly values and 30 days for daily values)

Value | Description -- | -- NORMAL | The price is greater than 90 % and less than 115 % compared to average price CHEAP | The price is greater than 60 % and less or equal to 90 % compared to average price VERY_CHEAP | The price is smaller or equal to 60 % compared to average price EXPENSIVE | The price is greater or equal to 115 % and less than 140 % compared to average price VERY_EXPENSIVE | The price is greater or equal to 140 % compared to average price

PriceRatingLevel

Value | Description -- | -- NORMAL | The price is within the range of what is considered being normal (market dependent; see 'priceRating.thresholdPercentages' for limits) LOW | The price is within the range of what is considered being low (market dependent; see 'priceRating.thresholdPercentages' for limits) HIGH | The price is within the range of what is considered being high (market dependent; see 'priceRating.thresholdPercentages' for limits)