Switch Channel

Have you tried linking a switch item to a dimmer? More of a MQTT discussion I suppose, but to get it mostly working I created a separate OnOffType channel for the switch, using the same topics as the dimmer channel. Through various trials, I am able to get 0 and 255 sent to the dimmer from the switch channel. The one thing missing is updating OH when the wall switch is activated, the switch channel doesn’t respond (as expected as the state topic is only updated with a number). I have looked at various mapping solutions, and while not complete yet, I have experimented with scale transformation. No success yet, but a simple rule works to update the state of the switch when the dimmer is >0. Is there a better way you know of to achieve this?

The Tutorials and Solutions category is for posting examples, not asking for help. I’ve moved this to a different category,

Us a script transform. Something like the following in JS Scripting.

(function(input){
  var parsed = parseInt(input)
  if(input === NaN) return null; // not parsable
  if(parsed == 0) return 'OFF';
  return 'ON';
})(input)