sgupta999/mqtt-bridge-smartthings

Strange MQTT "translations"

Closed this issue · 3 comments

Im working with a tv light in ST with RGB.

I can turn i off in mqtt: smartthings/Tv/switch/cmd, payload off and i get
MQTT --> ST - Topic: [smartthings/Tv/switch/cmd][off] [Tv][switch][off]

But when i want to turn it on it changes switch to level
I send smartthings/Tv/switch/cmd, payload on, but i get
MQTT --> ST - Topic: [smartthings/Tv/level/cmd][on] [Tv][level][on]

And of course it wont turn on

I found in mbs-server.js that switch on is converted to level, i changed it from level to switch, and now it works

				// If sending switch data and there is already a nonzero level value, send level instead
				// SmartThings will turn the device on
				if (property === 'switch' && contents === 'on' &&
					history[topicLevelCommand] > 0) {
					winston.info('Passing level instead of switch on');
					property = 'switch';
					contents = history[topicLevelCommand];
				}				
				postRequest(topic, contents, device, property, value, cmd, incoming);

I am assuming you are using HASS.io and not devices.yml - thats the legacy implementation and I would not change it.

I would instead try to use devices.yml

but its the mqtt command response that is converted to level and not switch... No im not using hass.io, im using node red