Integration into Home Assistant via MQTT
Integration into Home Assistant is done via MQTT. This requires setting up the MQTT connection on the presence detector and configuring Home Assistant to query and display the values. The presence detector supports MQTT Discovery from version 2.4. Manual configuration in Home Assistant is no longer necessary from this version, but remains possible. The following short guide explains all the steps required in Home Assistant to receive values from the sensor.
- If you are not yet using an MQTT broker, install the Mosquitto MQTT broker in Home Assistant. You can find it under Settings/Add-ons in the ADD-ON-STORE.
- Under Settings/Devices & Services, install the MQTT service and complete the configuration. If you have installed Mosquitto under Home Assistant, the broker has the same IP address as Home Assistant. The login and password also match those of Home Assistant.
- Supplement the central configuration file configuration.yaml. To do this, first install the File Editor add-on under Settings/Add-ons in the ADD-ON-STORE. Enable its availability in the sidebar. Start the File Editor from there and then go to the folder in the upper left to open files. Select the file configuration.yaml there. The content will now be displayed.
Now add the following configuration according to the configuration for the fill level sensor below. Please note that the indentations must be maintained. Replace TOPIC with the topic you set in the sensor's MQTT configuration.
mqtt: sensor: - name: "Brightness" unique_id: "PS_Brightness" state_topic: "tele/TOPIC/STATE" value_template: "{{ value_json.light }}" unit_of_measurement: "%" icon: mdi:brightness-5 device: identifiers: "PresenceSensor" manufacturer: "Senvolon" name: "Presence Sensor" model: "V1" - name: "Presence" unique_id: "PS_Presence" state_topic: "stat/TOPIC/PRESENCE" icon: mdi:human-male device: identifiers: "PresenceSensor" manufacturer: "Senvolon" name: "Presence Sensor" model: "V1" - name: "Distance" unique_id: "PS_Distance" state_topic: "stat/TOPIC/DETECTION_DIST" unit_of_measurement: "cm" icon: mdi:arrow-expand-horizontal device: identifiers: "PresenceSensor" manufacturer: "Senvolon" name: "Presence Sensor" model: "V1"Ensure that the file contains no errors after the changes. Errors are indicated by a red ! in the upper right. If everything is in order, you will see a green checkmark. Save the configuration.yaml by clicking on the corresponding icon in the top bar.
- Restart Home Assistant. To do this, go to Developer Tools and then click on RESTART on the right.
- The presence detector will now be displayed in the overview. The sensor values will be updated whenever new data is available.
