Hello
The latest version of HA announces a new integration of MQTT sensors. I still don’t understand how it is done.
Here is my old binding. Can you help me with the new integration of the MQTT sensors?
sensor Gartenwasser2:
- platform: mqtt
state_topic: "Pumpenschacht/Steuerung/Temperatur"
name: "Pumpenschacht - Temperatur im Schaltkasten - Hauswand-Kies"
unique_id: pumpenschacht_temp_schaltkasten
unit_of_measurement: "°C"
device_class: power
- platform: mqtt
state_topic: "Pumpenschacht/Wasser/Volumen"
name: "Pumpenschacht - Wasservolumen im Schacht"
unique_id: pumpenschacht_wasservolumen_im_schacht
unit_of_measurement: "Liter"
value_template: '{{ value | round(0) }}'
device_class: power
- platform: mqtt
state_topic: "Pumpenschacht/Switch1/Switch1"
name: "Pumpenschacht - Schalter 1"
unique_id: pumpenschacht_schalter1
unit_of_measurement: " "
value_template: '{{ value | round(0) }}'
device_class: power
sensor Testumgebung:
- platform: mqtt
state_topic: "Testumgebung/BMP280/Pressure"
name: "Testumgebung - Druck"
unique_id: testumgebung_druck
unit_of_measurement: "hPa"
value_template: '{{ value | round(1) }}'
device_class: power
It should look something like this:
# Example configuration.yaml entry
mqtt:
sensor:
- state_topic: "home/bedroom/temperature"
But what does it have to look like if you have several sensors.
Many thanks for the quick response.
I have integrated a switch as a normal sensor. Isn’t it better to include it as a binary sensor? “1” and “0” are reported via MQTT.
Here is my integration so far:
I tried to incorporate your hints into my configuration.yaml. (Only the one with the binary sensor is still missing)
My system is still quite small and still under construction.
I would like to ask you guys to check if everything is up to date.
My configuration.yaml
# Loads default set of integrations. Do not remove.
default_config:
# Text to speech
tts:
- platform: google_translate
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
mqtt:
sensor:
- state_topic: "Pumpenschacht/Steuerung/Temperatur"
name: "Pumpenschacht - Temperatur im Schaltkasten - Hauswand-Kies"
unique_id: pumpenschacht_temp_schaltkasten
unit_of_measurement: "°C"
device_class: power
- state_topic: "Pumpenschacht/Steuerung/Druck"
name: "Pumpenschacht - Druck im Schaltkasten - Hauswand-Kies"
unique_id: pumpenschacht_druck_im_schaltkasten
unit_of_measurement: "hPa"
device_class: power
- state_topic: "Pumpenschacht/Steuerung/Spannung"
name: "Pumpenschacht - Spannung im Schaltkasten - Hauswand-Kies"
unique_id: pumpenschacht_spannung_im_schaltkasten
unit_of_measurement: "Volt"
device_class: power
- state_topic: "Pumpenschacht/Steuerung/Temperatur_Schacht"
name: "Pumpenschacht - Temperatur im Schacht"
unique_id: pumpenschacht_temperatur_im_schacht
unit_of_measurement: "°C"
device_class: power
- state_topic: "Pumpenschacht/Wasser/Hoehe"
name: "Pumpenschacht - Wasserstand im Schacht"
unique_id: pumpenschacht_wasserstand_im_schacht
unit_of_measurement: "Meter"
device_class: power
- state_topic: "Pumpenschacht/Wasser/Volumen"
name: "Pumpenschacht - Wasservolumen im Schacht"
unique_id: pumpenschacht_wasservolumen_im_schacht
unit_of_measurement: "Liter"
value_template: '{{ value | round(0) }}'
device_class: power
- state_topic: "Pumpenschacht/Switch1/Switch1"
name: "Pumpenschacht - Schalter 1"
unique_id: pumpenschacht_schalter1
unit_of_measurement: " "
value_template: '{{ value | round(0) }}'
device_class: power
- state_topic: "Pumpenschacht/Switch2/Switch2"
name: "Pumpenschacht - Schalter 2"
unique_id: pumpenschacht_schalter2
unit_of_measurement: " "
value_template: '{{ value | round(0) }}'
device_class: power
- state_topic: "Pumpenschacht/Switch3/Switch3"
name: "Pumpenschacht - Schalter 3"
unique_id: pumpenschacht_schalter3
unit_of_measurement: " "
value_template: '{{ value | round(0) }}'
device_class: power
- state_topic: "Testumgebung/BMP280/Pressure"
name: "Testumgebung - Druck"
unique_id: testumgebung_druck
unit_of_measurement: "hPa"
value_template: '{{ value | round(1) }}'
device_class: power
sensor SensorMinimum:
- platform: statistics
name: "Wasserstand Minimum über 4 Stunden"
entity_id: sensor.pumpenschacht_wasservolumen_im_schacht #wasserstand_minimum
state_characteristic: value_min
sampling_size: 1440
input_number:
slider1:
name: Slider
initial: 100
min: 50
max: 400
step: 10
box1:
name: Numeric Input Box
initial: 30
min: -20
max: 35
step: 1
mode: box
number1:
min: 0
max: 100
step: 10
unit_of_measurement: "%"
mode: slider
climate:
- platform: generic_thermostat
name: Test-pumpe-wasser-halten
heater: switch.switch_pumpe_seite_strasse_deaktivieren
target_sensor: sensor.pumpenschacht_wasservolumen_im_schacht
min_temp: 150
max_temp: 400
target_temp: 300
hot_tolerance: 20
initial_hvac_mode: "off"
precision: 1
ac_mode: false
input_select:
pumpenmodus_test:
name: Pumpenmodus_test
options:
- Winter
- Automatische Bewässerung
- Wasser sammeln
pumen_modus:
name: Pumpenmodus
options:
- Normalzustand
- Automatische Bewässerung der Beete oder Vorgarten
- Wasser sammeln
initial: Normalzustand
icon: mdi:water-pump