Unexpected behavoir Selection sitemap

I have made a sidemap item to control my wake-up alarm The times are converted to the minute in the day

Selection item=WekkerTijd mappings=[420="07:00", 435="07:15", 450="07:30", 405="06:45", 390="06:30"]

The WekkerTijd Item is as follows

Number WekkerTijd           "Wekker is ingesteld voor  [JS(numtotime.js):%s]"    <alarm_clock>   {channel="mqtt:topic:MQTTgeneric:wekkerTijd"}

The numtotime mapping is to bring back the original time (435 = 07:15)

(function(i) {
  if (input >= 0 && input <= 1439) {
    var hr = Math.floor(input / 60);
    var min = input - hr * 60;

    return (hr < 10 ? "0" : "") + hr + ":" + (min < 10 ? "0" : "") + min;
  } else {
    return "12:00";
  }
})(input);

When I change the selection in the UI The Item receives the command and is changed back to UNDEF

2019-11-29 09:28:04.543 [ome.event.ItemCommandEvent] - Item 'WekkerTijd' received command 435
2019-11-29 09:28:04.549 [nt.ItemStatePredictedEvent] - WekkerTijd predicted to become 435
2019-11-29 09:28:04.563 [vent.ItemStateChangedEvent] - WekkerTijd changed from UNDEF to 435
2019-11-29 09:28:04.574 [vent.ItemStateChangedEvent] - WekkerTijd changed from 435 to UNDEF

How can I prevent this behaviour.

Many thanks for any help.

Unlink from MQTT. That’s probably not a helpful suggestion, but the MQTT binding is forcing Item state to what it thinks is best.
I imagine you need the channel to forward the new value to some clock; what you’d like is a “write only” channel. I’m not sure if you can configure such a thing, but start by looking at your MQTT Thing/channel config.
Or, make it a channel that reads new value successfully from MQTT after command. That’ll require changes at the target device/service.

This behaviour of the MQTT binding also causes problems for people using restore-on-startup, and as I understand it recent binding versions no longer do this (forcing UNDEF for no active message)

Hello @rossko57

That did the trick there was also a type error in my MQTT binding. It received the value but it was not sent out by openHAB because typed the wrong MQTT command topic
Thanks for pointing me out to the proper direction in MQTT.