Additional MQTT whitespace in OH log!?

Hey there!

when try to change the (select) state of my MQTT thing, my OH log says:

Command '  Free Running' from channel 'mqtt:homeassistant_ESPAltherma:mqtt_broker:ESPAltherma:espaltherma_5Fpl#select' not supported by type 'TextValue': Value   Free Running not within range

Note the extra whitespace in front of the command!

Now, here is my MQTT payload (I’m completely new to MQTT):

{"availability":[{"topic":"espaltherma/LWT","payload_available":"Online","payload_not_available":"Offline"}],"availability_mode":"all","unique_id":"espaltherma_pl","device":{"identifiers":["ESPAltherma"],"manufacturer":"ESPAltherma","model":"M5StickC PLUS ESP32-PICO","name":"ESPAltherma"},"icon":"mdi:solar-power","name":"EspAltherma Power Limit","command_topic":"espaltherma/pl/set","command_template":"{% if value == 'Free Running' %} '0' {% elif value == 'Power Limit 1' %} '1' {% elif value == 'Power Limit 2' %} '2' {% elif value == 'Power Limit 3' %} '3' {% elif value == 'Power Limit 4' %} '4' {% else %} '0' {% endif %}","options":["Free Running","Power Limit 1","Power Limit 2","Power Limit 3","Power Limit 4"],"state_topic":"espaltherma/pl/state","value_template":"{% set mapper = { '0':'Free Running', '1':'Power Limit 1', '2':'Power Limit 2', '3':'Power Limit 3', '4':'Power Limit 4' } %} {% set word = mapper[value] %} {{ word }}"}

Any ideas where the whitespace comes from?

To control my HVAC depending on the availability of solar energy I want to make use of espAltherma in combination with a relay.

  • Platform information:
    • Hardware: RPI4 8GB
    • OS: Ubuntu 22.04 LTS arm64
    • Java Runtime Environment: Zulu17.44+15-CA (build 17.0.8+7-LTS)
    • openHAB version: 4.0.2

Not without seeing the transform that extracted that from the JSON. It’s not clear why you would be extracting that value in the first place. Nothing in that “command_template” is useful for OH for anything in the first place but then again, there is nothing about this JSON that is useful to OH either. It’s all configuration stuff and using a Generic MQTT Thing you have to do that configuration yourself. You can’t dynamically configure it based on this message.

The json is part of the sourcecode of espAltherma. I changed only some ID’s for my purposes. I started the esp-32 and was able to discover the MQTT thing in OH. I added a Item and it works without further configuration. Maybe becaus it’s a HomeAssistant MQTT Component instead of a Generic MQTT Component?

After I have taken the extra whitespace into account, it works as expected.

In that case it’s what ever the binding is doing. I’m not sure there is anything you can do about it beyond filing an issue on the binding.

1 Like

Okay, thanks for helping :slightly_smiling_face:
I will do so when my OH is running again