Mqtt:number is not updating to MQTT 3.4.0.M3

  • Platform information:
    • Hardware: i5/8G/2 TB
    • OS: Ubuntu 22.04LTS
    • Java Runtime Environment: openjdk 11.0.16.1 2022-07-19 LTS
    • openHAB version: 3.4.0.M3
  • Issue of the topic: mqtt:number cannot set a value but mqtt:switch does
  • Please post configurations (if applicable):
UID: mqtt:topic:c4c2baaffc
label: T
thingTypeUID: mqtt:topic
configuration:
  payloadNotAvailable: '{"state":"offline"}'
  availabilityTopic: zigbee2mqtt/Thermostat/availability
  payloadAvailable: '{"state":"online"}'
bridgeUID: mqtt:broker:81edc1d2b7
channels:
  - id: temperature_setpoint_hold
    channelTypeUID: mqtt:switch
    label: Temperature Setpoint Hold
    description: Prevent changes. `false` = run normally. `true` = no changes.
    configuration:
      commandTopic: zigbee2mqtt/Thermostat/set/temperature_setpoint_hold
      stateTopic: zigbee2mqtt/Thermostat/temperature_setpoint_hold
      off: "false"
      on: "true"
  - id: occupied_cooling_setpoint
    channelTypeUID: mqtt:number
    label: Cooling Temperature
    description: Temperature setpoint
    configuration:
      commandTopic: zigbee2mqtt/Thermostat/set/occupied_cooling_setpoint
      stateTopic: zigbee2mqtt/Thermostat/occupied_cooling_setpoint
  • If logs where generated please post these here using code fences:

Logs do not generate errors beyond the standard item update events for either manually setting the value or mqtt state resetting the value. No error messages appear.

I created the Thing, then created default items from the channels; the items will follow the topic settings correctly from the device. State topic values work perfectly.

When I update the switch’s item, OpenHab sends a message to the command topic with the correct value. This sending is true if I use the PaperUI or the API to set the switch’s item value. Both work correctly.

The only method to command the number channel is to use the API. When I update the number’s item via the API, OpenHab will not send the command topic or value. There are no messages in the log nor mosquito’s log (MQTT). OpenHab never sends the published message in MQTT.

The Item is set to default, not follow.

A reboot and a complete reboot do not make a difference.

If I manually send the topic and value using mosquito’s commands, the command channel is correct and updates the device. The only missing difference is that mqtt:number does not send a command, but mqtt:switch does.

According to Help MQTT Things and Channels - Bindings | openHAB the number channel should update the mqtt topic in the command.

This issue seems to be the same as the unanswered Sending a Number-item with MQTT

Why? Can you share how you are doing this, with an example code?

Please share your Item configuration.

Please be aware that openHAB3.x has no Paper UI, it’s called Main UI.

There are two different methods to manipulate an Item, these are postUpdate and sendCommand.
If switching an Item in the UI, openHAB will do a sendCommand, that is: send the according Command to all bound channels, which will evantually end in sending the command through the commandTopic in case of mqtt.
The other method, postUpdate will take place if an Item is updated from an addon channel, the stateTopic in case of mqtt.
There will be no command at all when a postUpdate is send, buit only an update/change of the state of the Item.
The API does allow both methods as well as rules or the karaf console. When it comes to the UI, there should be a sendCommand each time one changes the value of an Item.

Did you use MQTT explorer (or something similar) to check whether a topic is sent at all?

1 Like

Because the Number Item does not allow editing the number in 3.4.

The item “configuration” consists of New Linked Item on the channel and clicking Save.

I am using the API Explorer


Thank you. I was not aware and will adjust my verbiage.

I was also not aware of this. This works and explains much. Thank you.

Yes, I was doing this and how I knew that the postUpdate didn’t send the command.

Your explanation solves the issue. Thank you.

1 Like