I have some MQTT sensors defined (motion, power consumption, …). But none of them is shown in any dropdown list in Lovelace. But they exist and I can use them manually, for example, I can define this history-graph, the state of the entities is shown, the entities are listed when I edit the card, but I can’t select them. The only way to use them is to know the entity ID and to write it manually in the YAML editor.
entities:
- sensor.luftung_leistung
- sensor.luftung_verbrauch
- sensor.motion_terrasse
hours_to_show: 72
refresh_interval: 120
title: Test MQTT sensors
type: history-graph
In the history-graph I can manually use them.
But when I use them on a sensor card, where they worked fine in the past
entity: sensor.luftung_leistung
hours_to_show: 72
id: test_luftung_leistung
title: Lüftung Leistung
type: sensor
I get on the right:
Entity not available: sensor.luftung_leistung
These MQTT sensors are also not shown in the list of existing entitites, in dropdown lists for automations, scripts and so on. It looks like Lovelace doesn’t know them.
I can’t say in which release this happened, because history graphs where they are used still showing the content. I found this issue only now when I was looking for the history of some specific sensors.
This is my definition in configuration.yaml
sensor:
- platform: mqtt
name: "Helligkeit Terrasse"
state_topic: "/SmartHome/BewegungT/brightness"
unit_of_measurement: "Licht"
- platform: mqtt
name: "Helligkeit Vorhof"
state_topic: "/SmartHome/BewegungV/brightness"
unit_of_measurement: "Licht"
- platform: mqtt
name: "State Terrasse"
state_topic: "/SmartHome/BewegungT/state"
- platform: mqtt
name: "State Vorhof"
state_topic: "/SmartHome/BewegungV/state"
- platform: mqtt
name: "Motion Terrasse"
state_topic: "/SmartHome/BewegungT/motion"
- platform: mqtt
name: "Motion Vorhof"
state_topic: "/SmartHome/BewegungV/motion"
- platform: mqtt
name: "Bewegung Anz Terrasse"
state_topic: "/SmartHome/BewegungT/trigger_cnt"
unit_of_measurement: "Bewegung"
- platform: mqtt
name: "Bewegung Anz Vorhof"
state_topic: "/SmartHome/BewegungV/trigger_cnt"
unit_of_measurement: "Bewegung"
- platform: mqtt
name: "Lüftung Leistung"
state_topic: "/SmartHome/SD_ventilator_Pwr/power"
unit_of_measurement: "W"
- platform: mqtt
name: "Lüftung Verbrauch"
state_topic: "/SmartHome/SD_ventilator_Pwr/energy"
unit_of_measurement: "kWh"
value_template: "{{value | float / 1000}}"
on the other hand lights defined via MQTT are working like “normal” entities. This is the definition in lights.yaml
- platform: mqtt
name: "Licht Aussen"
# icon: mdi:lightbulb
state_topic: "/SmartHome/licht_aussen/state"
command_topic: "/SmartHome/licht_aussen/state/value"
#availability_topic: "fhem/licht/aussen/available"
payload_on: "on"
payload_off: "off"
# state_on: "on"
# state_off: "off"
optimistic: false
qos: 0
retain: true
# value_template: >
# {% if value == "on" or value == "off" %}
# {{ value }}
# {% else %}
# {{ states('switch.licht_aussen') }}
# {% endif %}
- platform: mqtt
name: "Licht Terrasse"
# icon: mdi:lightbulb
state_topic: "/SmartHome/licht_terrasse/state"
command_topic: "/SmartHome/licht_terrasse/state/value"
#availability_topic: "fhem/licht/terrasse/available"
payload_on: "on"
payload_off: "off"
# state_on: "on"
# state_off: "off"
optimistic: false
qos: 0
retain: true
# value_template: >
# {% if value == "on" or value == "off" %}
# {{ value }}
# {% else %}
# {{ states('switch.licht_terrasse') }}
# {% endif %}
- platform: mqtt
name: "Küche"
# icon: mdi:lightbulb
state_topic: "/SmartHome/licht_kueche/state"
command_topic: "/SmartHome/licht_kueche/state/value"
#availability_topic: "fhem/licht/kueche/available"
payload_on: "on"
payload_off: "off"
# state_on: "on"
# state_off: "off"
optimistic: false
qos: 0
retain: true
# value_template: >
# {% if value == "on" or value == "off" %}
# {{ value }}
# {% else %}
# {{ states('switch.kuche') }}
# {% endif %}