MQTT Client - Beta

OMG! I got it working!

Finally I can connect my Hubitat and Home Assistant!

For those wanting to dive into this. I found this code to be very helpful
https://raw.githubusercontent.com/PrayerfulDrop/Hubitat/master/drivers/Generic%20MQTT%20Client.groovy

I had to change this well written code to a hard coded mess.

def parse(String description) {
log.debug description
log.debug interfaces.mqtt.parseMessage(description)

def onoff = description 
    if (onoff == "topic: L2hvbWUvZGlzaHdhc2hlci9zdGF0ZQ==, payload: T04=")
    	createEvent(name: "switch", value: "on")
    else if (onoff == "topic: L2hvbWUvZGlzaHdhc2hlci9zdGF0ZQ==, payload: T0ZG")
        createEvent(name: "switch", value: "off")
    }

The code is now a virtual switch controller using MQTT. When I send the payload of ON or OFF the switch changes state. Any help to make the driver more generic would be appreciated. The original code appears to be directed to a more specific topic/payload value.

3 Likes