Dear all,
I’m running a campground in Germany and am currently trying to automate certain chores and processes related to energy and my solar installation. I’m new to HA and managed to get quite some things done. I’m not into fancy dashboards and stuff, but rather into automating things and make my campground smart. That worked like a charm when it came to lighting, motionsensors, surveillance with ring cams and so forth. However I’m struggling with the energy automations.
This is the solar installation I’m running on my campground:
I marked the value which I’m capable of reading out of the smart manager via Modbus sensors. This is the code I’ve used to setup the sensors in HA:
modbus:
- name: "KSEM"
type: tcp
host: 192.168.1.207
port: 502
sensors:
- name: netzbezug_leistung_ksem
slave: 1
device_class: power
state_class: measurement
unit_of_measurement: W
scale: 0.1
address: 0
scan_interval: 10 # Defines the update interval of the sensor in seconds.
count: 2 # Anzahl zu lesenden Register
input_type: holding
data_type: uint32
- name: netzeinspeisung_leistung_ksem
slave: 1
device_class: power
state_class: measurement
unit_of_measurement: W
scale: 0.1
address: 2
scan_interval: 10 # Defines the update interval of the sensor in seconds.
count: 2 # Anzahl zu lesenden Register
input_type: holding
data_type: uint32
I can display that sensors value in HA and it shows the correct values, like my KSEM smart meter does via the web interface.
However, here comes the trouble. I cannot use this value to trigger automations, that could switch any of my shellies or other smart installations I’ve got.
This ist the code I used to create an automation to start the heat pump of our pool, once 2500 Watts of power to grid has been reached and as a condition I added “current pool temperature below 25°C” from a sensor attached to a shelly:
alias: "Energie: Solar Überschuss >2500 W & Pool <25°C = Wärmepumpe Schwimmbad an"
description: >-
Wenn die Solaranlage mehr als 2500 W über 2 Minuten liefert und der Pool eine
Temperatur von unter 25°C hat, wird die Wärmepumpe eingeschaltet.
trigger:
- platform: numeric_state
entity_id: sensor.netzeinspeisung_energie_ksem
for:
hours: 0
minutes: 2
seconds: 0
above: 2500
condition:
- type: is_temperature
condition: device
device_id: f596d7928a8ab756b6bfab6b256abf08
entity_id: sensor.vorlauf_schwarz_temperature
domain: sensor
below: 25
action:
- type: turn_on
device_id: f596d7928a8ab756b6bfab6b256abf08
entity_id: switch.shellyplus1pm_80646fe47d38_switch_0
domain: switch
mode: single
No worries, it ain’t the shelly switching the heat pump, of course there’s a relais inbetween, switching the 400V heat pump
I tested both sensors as a condition as well and HA verifies the above or below value state correctly when testing. I also switched condition and trigger to see if that has any effect (pool temp going below 25°C triggers and condition is solar to grid more than 2500) but to no avail. This automation never ran unless triggered manually.
Other automations work well, so I guess it ain’t a general automation prob.
I’m most thankful for the pros around here to take a look at my code and let me know what else I could check to make this work.
Thanks in advance and
sunny regards from the river Neckar in Germany!