Tibber sensors never seem to trigger automation

Hello!

Been testing Home Assistant for a few weeks now and I mostly got things working. I have one weird problem though. I have added integration with Tibber, and I can see the prices for electricity etc without problems. But I wanted to try adding an automation that would change the color of a Shelly lightbulb whenever the price is a certain value.

  • The lightbulb works and I can manually change color, turn it on and off etc (from Home Assistant).
  • I can create another automation that changes the color of the light at a certain times, this works.
  • When I instead set that the light should change color when the price is above or below a certain value, it never ever triggers.

My first attempt involved adding a trigger with

  • entity “Electricity price Home”
  • attribute “Avg Price”
  • Above mode, fixed number above “0.03”
  • Below mode, fixed number below “0.11”

Then I added similar automations for other ranges to give different colors. This was my first try and nothing happened. Since then I’ve messed around with templates a lot and tried the following for one trigger:

{% if(state_attr('sensor.electricity_price_home', 'avg_price')|float) >= 0 %}true{% endif %}

This as well does nothing and it never triggers. If I go into “Developer Tools” / “Template” and type the following template:

{{state_attr('sensor.electricity_price_home', 'avg_price')}}

It will at this very moment print: 0.633

I am currently out of ideas and I’m really hoping someone here can push me in the right direction. Would really appreciate it!

Im pretty sure this will always show “true” (unless the price is below 0 )

Even i got average price 0.633, at this moment :wink:

However ( not sure how your “automation” looks like cording to your “cryptic” description

This would seems like you want an automation which “Triggers”

  • When price goes “Above 0.03” … which it already is !
  • When price goes “Below 0.11” … Which it already is !

The first one, yes, it will always show true. So why doesn’t it trigger? : |

Sorry about the cryptic description.
Will try a bit harder and entertain you with a picture worth at least 1000 words.

I changed it so that it should (as far as I understand) trigger when it is below 1.0, which it is now. Yet it never triggers.

Yes it is now, that why it doesn’t “Trigger” a Trigger is “like a button” it does something when you “press it” … so , IF it is Above 1.0, it will trigger when it gets Below ! (Trigger 1 time) , never again

Again A trigger-event occur WHEN something(specified) happens AND only then,

So change your automation( if you want to use an automation for this ) and add “Conditions”.( if price is above, change color )

Maybe you should try to look at Templates for this , you can specify much more in details.

I.E

For your Shelby-Light-entity

IF el-pris-state <=0.1, then Shelby-Light-entity_color=green, elif el-pris-state >0.1 then Shelby-Light-entity_color=yellow, elif el-pris-state >=1.0 then Shelby-Light-entity_colo=red