How to use EPEX SPOT SENSOR in an automation?
Closed this issue · 3 comments
Hi Steffen,
I was able to install EPEX SPOT SENSOR successfully, and the sensor works fine.
But I struggle when using the sensor in a simple automation with a call service switch toggle on/off for a relay.
The relay turns on/off when the sensor 'Enabled' -attribute changes from 'false' to 'true', instead of following the sensor 'Data' -attributes start and end times.
I don't see what I'm doing wrong.
Would you please help me with this?
Below is the information about the sensor and the automations I made.
Thanks in advance for your help.
Kind regards,
Wim
You have to use the state of the sensor, not attribute.
Example (not tested!):
description: ""
mode: single
trigger:
- platform: state
entity_id:
- binary_sensor.my_epex_spot_sensor
condition: []
action:
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.my_epex_spot_sensor
state: "on"
sequence:
- service: switch.turn_on
target:
entity_id: switch.my_switch
data: {}
- conditions:
- condition: state
entity_id: binary_sensor.my_epex_spot_sensor
state: "off"
sequence:
- service: switch.turn_off
target:
entity_id: switch.my_switch
data: {}
Hello Steffen,
Thank you very much for your quick answer.
As you can see, I am an absolute beginner with HA and I still have a lot to learn... :-)
I added a new automation based on your YAML code.
Normally this automation should work perfectly.
I will confirm you tomorrow.
Kind regards,
Wim
alias: Relay 27 Switch toggle on/off (EPEX SPOT BINARY SENSOR 9PM - 6AM - CONTIGUOUS)
description: ""
trigger:
- platform: state
entity_id:- binary_sensor.epex_spot_binary_sensor_epex_spot_data_price
condition: []
action:
- binary_sensor.epex_spot_binary_sensor_epex_spot_data_price
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.epex_spot_binary_sensor_epex_spot_data_price
state: "on"
sequence: - service: switch.turn_on
target:
entity_id: switch.relay_27
data: {}
- condition: state
- conditions:
- condition: state
entity_id: binary_sensor.epex_spot_binary_sensor_epex_spot_data_price
state: "off"
sequence: - service: switch.turn_off
target:
entity_id: switch.relay_27
data: {}
mode: single
- condition: state
- conditions:
Thanks for your help Steffen!
The automation works perfectly.
Kind regards,
Wim