Amber Electric - Change the colour of a light based on the current electricity price

@madpilot Is there a way to currently indicate if there is a demand window active? Is that something that is exposed through the API?

Yeah, there is a Boolean called demandWindow in the tariffInformation object in the attributes.

{{ state_attr('sensor.amber_general_price', 'tariffInformation').demandWindow }}

Will probably do it. My account doesn’t have a demand window to confirm

1 Like

Hi Myles

I can see where demandWindow is referenced in the API docs (within the TariffInformation schema), but I’m struggling to implement it within HA. In the example above, you have it listed as an attribute under the general price entity. This isn’t working for me, and when I expand the available attributes for general price within HA, it’s not listed there (see screenshot below).

Hoping you may be able to assist with the correct way to access this for use within HA?

Many thanks
Lee

It looks like it’s not included at the moment. I’ve got to do some updates to the integration shortly, so I’ll add it in then.

1 Like

Ahh, great! Glad I wasn’t going crazy. :slight_smile:

That’s awesome. I really look forward to when this is available again. Thanks Myles.

Cheers
Lee

2 Likes

Hey Myles

Still super keen to see the boolean for demandWindow added back into General Price.

Fingers crossed on this!

Cheers
Lee

2 Likes

Hi Myles

I see demandWindow has been added back into the entity list.

Super awesome - thanks!!

Cheers
Lee

2 Likes

Just added this.
Tried the ‘reload amber fix’

Still getting the error.

Executed: August 12, 2024 at 10:59:22
Error: UndefinedError: 'dict object' has no attribute 'to_state' 
id: '1723423594229'
alias: Amber Lightstrip
description: control lightstrip based on amber prices
use_blueprint:
  path: amberelectric/light.yaml
  input:
    amber_price_descriptor: sensor.13wtf_general_price_descriptor
    target_light:
      entity_id: light.hue_lightstrip_plus_1

The sensor is current, and has a state of ‘very low’.

Did a complete restart.

Executed: August 12, 2024 at 11:08:06
Error: UndefinedError: 'dict object' has no attribute 'to_state' 

… and now, while trying to debug it more, it starts working.
Peculiar.

This happened to me also. I walked away to work on it later and then noticed the light working. I think it is a HA thing. I am learning to be patient with HA…

Thank you very much for this @madpilot0. I was able to go from turning on a brand new HA Green to a working automated lamp thanks to your efforts in a few steps. Also thanks to @markpurcell for pointing me to Home Assistant. Now my teenagers can plainly see the electricity prices and act accordingly. Well I can dream.

1 Like