Here is what the Automation shoud do:
If a Webhook is triggerd, it should wait 5min, check if the Power Usage is below 3 Watt and then turn the Wall Switch off (and if its possible, if power usage is above 3 Watt send a Message)
Problem is that I have Problem with reading the Value from Entity
Entity : sensor.fibaro_system_fgwpef_wall_plug_exporting
Attributes :
node_id: 9
value_index: 32
value_instance: 1
value_id: 72057594193936896
power_consumption: 2.6
unit_of_measurement:
friendly_name: nas Exporting
I have played a bit around, there is what I have
- id: '1559640460411'
alias: server
trigger:
- platform: webhook
webhook_id: test
condition: []
action:
- delay: 00:05:00
- condition: state
entity_id: sensor.fibaro_system_fgwpef_wall_plug_exporting
state: ((float(sensor.fibaro_system_fgwpef_wall_plug_exportin.power_consumption)) - (float(3))) | round(2)
1 Like
tom_l
June 4, 2019, 9:38am
2
uiguy
June 4, 2019, 12:56pm
3
Your condition should go in line with your action… have read through the docs and look at the examples… https://www.home-assistant.io/docs/scripts/conditions/
Trigger, Action and Condition are all supposed to be ont he same indentation level…
I would also keep this simple by just making your condition calling the entity ID, numeric state and “below.”
Its more about how to use the Attribute of the Entity and use it further, I can’t find this is in the Docs
uiguy
June 4, 2019, 1:02pm
5
well if you start to ask a question, make sure that the code examples you are using are correct… how am I supposed to know where you are going wrong if your code is full of mistakes that you can’t be bothered to fix before asking for help?
What you need to do is create a template sensor out of the attribute… Here is link which should help: http://lmgtfy.com/?q=create+template+sensor+from+attributes+in+home+assistant
The Code example is copied from the Automation Editor, I did’t change anything in there.
123
(Taras)
June 4, 2019, 3:35pm
7
This condition
will return true
if the sensor’s power_consumption
attribute is less than 3
.
- condition: template
value_template: "{{state_attr('sensor.fibaro_system_fgwpef_wall_plug_exporting', 'power_consumption') | float < 3}}"
EDIT
Correction: What tom_I said, missing curly brackets!
1 Like
tom_l
June 4, 2019, 3:36pm
8
Missing curly brackets.
value_template: "{{ state_attr('sensor.fibaro_system_fgwpef_wall_plug_exporting', 'power_consumption') | float < 3 }}"
2 Likes