How do requests sent to the hub get routed to the appropriate device handler?


(Yoda Genes) #1

Hi,

I have a question concerning the networkDeviceId property of a Device.

I have the Smartthings MQTT Bridge installed. https://github.com/stjohnjohnson/smartthings-mqtt-bridge.

There is a node app that runs on a raspberry pi that acts as a bridge between a MQTT broker and a Smartthings device handler.

I also had the Google assistant relay running on my raspberry pi which also uses a device handler.

The problem I am seeing is that the the MQTT app requires a mac address to be used in order that the node app can communicate with Smartthings but that mac address is already being used by the google assistant.

My question is…how can a request be sent to the hub and routed to a particular device handler? From what I am guessing, the hub is looking at the mac address of the client and matching that against the networkdeviceid of the device. The node code that initiates that request is below:

request.post({
        url: 'http://' + callback,
        json: {
            name: device,
            type: property,
            value: contents,
            command: (!pieces[2] || pieces[2] && pieces[2] === config.mqtt[SUFFIX_COMMAND])
        }
    }

If that is the case, is it possible to include the networkdeviceid of the device you wish the request to be routed to?

I looked around the forums and saw @Gecko had been talking to one of the smartthings engineers voicing his concerns about a mac address being used implicitly as a networkid and the potential issue that would occur if there were two devices running on the same mac address. Was this addressed somehow?

Many thanks