In the spanish case the price change hourly, as can be seen here:
The Cofycloud translates these 24 hours of pricing into a 5-level signal, as shown here. This -2 to +2 signal is sent to the Cofybox, and we need to represent this with light colors. For example, the ones below:
For this translation, follow the next steps:
Note: in this case N/A [blinking white] is for moments where the signal is unavailable and not reaching the cofybox.
alias: SOM_Cuca.matrix.translator
description: ""
trigger:
- platform: state
entity_id:
- sensor.explicit_service_dhw
- platform: time_pattern
minutes: /15
condition: []
action:
- choose:
- conditions:
- condition: or
conditions:
- condition: state
entity_id: sensor.explicit_service_dhw
state: "-2.0"
- condition: state
entity_id: sensor.explicit_service_dhw
state: "-1.0"
- condition: state
entity_id: sensor.explicit_service_dhw
state: "-1"
- condition: state
entity_id: sensor.explicit_service_dhw
state: "-2"
sequence:
- service: input_select.select_option
data:
option: Expensive [red]
target:
entity_id: input_select.cuca_state
- conditions:
- condition: or
conditions:
- condition: state
entity_id: sensor.explicit_service_dhw
state: "0.0"
- condition: state
entity_id: sensor.explicit_service_dhw
state: "0"
sequence:
- service: input_select.select_option
data:
option: Medium [yellow]
target:
entity_id: input_select.cuca_state
- conditions:
- condition: or
conditions:
- condition: state
entity_id: sensor.explicit_service_dhw
state: "1"
- condition: state
entity_id: sensor.explicit_service_dhw
state: "1.0"
- condition: state
entity_id: sensor.explicit_service_dhw
state: "2"
- condition: state
entity_id: sensor.explicit_service_dhw
state: "2.0"
sequence:
- service: input_select.select_option
data:
option: Cheap/Exporting [green]
target:
entity_id: input_select.cuca_state
- conditions:
- condition: or
conditions:
- condition: state
entity_id: sensor.explicit_service_dhw
state: unavailable
- condition: state
entity_id: sensor.explicit_service_dhw
state: unknown
sequence:
- service: input_select.select_option
data:
option: N/A [blinking white]
target:
entity_id: input_select.cuca_state
mode: single
alias: SOM_Cuca.control
description: ""
trigger:
- platform: state
entity_id:
- input_select.cuca_state
- platform: time_pattern
minutes: /15
condition: []
action:
- choose:
- conditions:
- condition: state
entity_id: input_select.cuca_state
state: Expensive [red]
sequence:
- service: light.turn_on
data:
rgb_color:
- 255
- 0
- 0
target:
entity_id: light.cuca_2leds_estrella_cuca_llum
- conditions:
- condition: state
entity_id: input_select.cuca_state
state: Medium [yellow]
sequence:
- service: light.turn_on
data:
rgb_color:
- 255
- 210
- 0
target:
entity_id: light.cuca_2leds_estrella_cuca_llum
- conditions:
- condition: state
entity_id: input_select.cuca_state
state: Cheap/Exporting [green]
sequence:
- service: light.turn_on
data:
rgb_color:
- 0
- 255
- 0
target:
entity_id: light.cuca_2leds_estrella_cuca_llum
- service: light.turn_on
data: {}
- conditions:
- condition: state
entity_id: input_select.cuca_state
state: N/A [blinking white]
sequence:
- repeat:
while:
- condition: state
entity_id: input_select.cuca_state
state: N/A [blinking white]
sequence:
- service: light.turn_on
data:
rgb_color:
- 255
- 255
- 255
target:
entity_id: light.cuca_2leds_estrella_cuca_llum
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
- service: light.turn_on
data:
rgb_color:
- 0
- 0
- 0
target:
entity_id: light.cuca_2leds_estrella_cuca_llum
- delay:
hours: 0
minutes: 0
seconds: 0
milliseconds: 600
mode: queued
As a result, you will be able to see this translation in the historic tab, and below is an example of the prototype developed in this case: