MQTT: Value of sensor via MQTT from ioBroker always unknown

Hi,

I try to integrate a value from my ioBroker installation in HA via MQTT. The ioBroker just sends raw “true” or “false” as MQTT message:

Topic: homeassistant/Anwesend/AndreasQoS: 0

true

The configuration for the sensor is:

    - name: "Anwesend Andreas"
      state_topic: "homeassistant/Anwesend/Andreas"
      value_template: "{{ value }}"
      unique_id: "iob_anwesend.andreas0001"

bind in configuration.yaml via:

mqtt:
  sensor: !include sensors.yaml

I have tried nearly every option i could find for value_template but the state is always shown as “unknown” (in dev section and if i bind the entity to a dashboard.

Has anyone an idea, how i can transform the raw “true” or “false” to somethin like on and off or another kind of “real” boolean?

Thanks.

Hello TepMan,

Your topic is not formed correctly for discovery.
Re-read this. You need to lead with an integration. MQTT - Home Assistant

Also I use MQTT Discovery ibn this Blueprint, perhaps the example would help.
HA_Blueprints/Automations/Octoprint_Additional_Buttons_Helper.yaml at 2c8a5d942a24a4f00611f4d04f9ca6cb0832508c · SirGoodenough/HA_Blueprints · GitHub.

Hi @Sir_Goodenough,

thanks for your reply. That auto discovery won’t work is not the problem, therefor i configured the sensor in the yaml.

The problem is, that the value wasn’t read. But now i am a step further. The value is read as true or false with the code above.

The next question now is, how do i convert the value that HA understands it as a kind of boolean, to use it e.g. for setting the icon color depending on the state.