I am trying to use my P1 meter (DSMR Smart Meter intergration) sensor sensor.electricity_meter_power_production to trigger a switch switch.shelly_blokhut_boiler_switch_0
If I trigger the automation manualy it works but one way or the other it never getst triggerd (i am probably missing something / thinking to simple)
My Automation based on examples here , and part of the Gui.
What do I want to accomplish :
When sensor.electricity_meter_power_production => 2650kW for longer than 2 minutes
Then Enable sensor.shelly_blokhut_boiler_switch_0_power
if sensor.electricity_meter_power_production < 2500
Then Disable sensor.shelly_blokhut_boiler_switch_0_power
I have not build the power of part yet as I am not getting it to turn on.
I also tried : above 2650
But no success
Thanks, biggest question is how where you able to exactly guess my Switch Identity ?
(it is spot on)
The missing T was an issue me struggling with this forum go get the code right.
And thanks for giving me the code to do the on / off procces
I just realized that I am measuring the production on my grid connection so as soon as I enable the boiler I introduce a load of 2.5kW resulting in production being lower directly.
With this code I will get a switch on / of (with a delay of 2 minutes) so I need to check if the consumption is getting higher than 0 (as than I will no longer be producing more electricity than I am consuming) and than switch the boiler off.
But thanks will give this a go.
My main question is, what is the correct vallue (or how to check this) of the sensor.electricity_meter_power_production
Is this 2650 or 2.65 or 2.650 or 2,65 or 2,650 just curious how to check this raw vallue.
For a slight moment I thought there was a “translation” tool for the numeric vallue of the Identity ID not knowing I posted my “plan” with the normal identity ID’s
Next question (sorry thought I was done here but made a wrong assumption)
I wanted to use sensor.electricity_meter_power_consumption to check whether I start consuming more than producing.
But my P1 meter does not show this, I need to calculate this.
So what I want is if sensor.electricity_meter_power_consumption > than sensor.electricity_meter_power_production power off switch.shelly_blokhut_boiler_switch_0
So I need to do something smart (but I am not a coder) with substracting the power consumption vallue from the production vallue sensor.
If the outcome of that substraction is bigger than 0 I need to switch off the switch.
My guess would be something like :
value_template: >-
{% set production = states('sensor.electricity_meter_power_production') | int(0) }
{% set consumption = states('sensor.electricity_meter_power_consumption') | int(0) }
{{ consumption > production }}
for: "00:02:00"
id: "off"
Is this correct ? (Just stealing from other examples here)
You’re using int (integer) filters on the values to compare, yet it looks like the numbers are small (in kW). You will be better using float:
- value_template: >-
{% set production = states('sensor.electricity_meter_power_production')|float(0) %}
{% set consumption = states('sensor.electricity_meter_power_consumption')|float(0) %}
{{ production <= consumption }}
@Troon thanks for pointing this out, but as a non coder I have no idea what the difference is between an integer vs a float.
So need to google that so I learn something from it.
The automation is working fine in current config (with the int) only issue / not happy with is the way currently the load (2,5kW) is being switched on and on quite often on a Shelly relay.
Allthough it is perfectly specked to switch 3,6kW I am not sure if this the setup I want to keep (but this is more a electrical worry than an automation issue).
[10 minutes and 1 google search later]
Floats it is
Thank you sir ! Automation has been adjusted to your suggestion.