Hi there,
I have potentially a super simple question, but can’t find since today morning a solution.
My house uses KNX and my wallbox MQTT (selfmade). To enable a PV charge (if sun is delivering more power than the house needs), I need to forward three KNX values (current house consumption, etc. …) to the wallbox to operate.
I struggle to get one value (PV_Gesamt) into mqtt. All other values are comming in correct (in MQTT Explorer). In HA, the value is also displayed correctly.
Here is my code I use in automations.yaml:
KNX Werte an MQTT senden
-
alias: KNX PV Leistung an MQTT senden
trigger:
platform: state
entity_id: sensor.solar_leistung_gesamt_knx
action:
service: mqtt.publish
data:
topic: ‘PV_Gesamt’
payload: ‘{{ states(“sensor.solar_leistung_gesamt_knx”) }}’
qos: 1
retain: true -
alias: KNX Hausverbrauch Gesamt an MQTT senden
trigger:
platform: state
entity_id: sensor.hausverbrauch_gesamt_knx
action:
service: mqtt.publish
data:
topic: ‘Hausverbrauch_Gesamt’
payload: ‘{{ states(“sensor.hausverbrauch_gesamt_knx”) }}’
qos: 1
retain: true
Code in knx.yaml:
sensor:
-
name: “solar_leistung_gesamt_knx”
state_address: “2/0/16” # Ersetze dies durch die Gruppenadresse deines KNX-Sensors
type: ‘power’ # Ersetze dies durch den Typ deines Sensors (z.B. ‘temperature’, ‘humidity’, etc.) -
name: “hausverbrauch_gesamt_knx”
state_address: “2/0/4”
type: ‘power’ -
name: “pv_ueberschuss_wallbox_knx”
state_address: “2/0/29”
type: ‘power’
Any idea would be great. Thanks in advance!
HA: 2025.1.4