Comments (5)
@jezzaaa Di you find a way to solve this ?
I have exactly the same problem and running both in Docker
from smartthings-mqtt-bridge.
Yes, I hacked the DTH code to prefix the MAC with "MQTT", to make it more likely to be unique.
But I gave up on trying to use MQTT.
from smartthings-mqtt-bridge.
MQTT working for me, let me know if I can help
Could you point me the exact places you had to modify DTH?
I thought it was the way ST hub was communicating, not related to code :
"Yes, the SmartThings local incoming calls work by whitelisting by MAC address. And outgoing calls work by IP"
from smartthings-mqtt-bridge.
I can do most of what I want without MQTT, so there isn't an urgent need. But it'd be nice - when I get a bit of time.
My diff looks like the below:
< // Setting Network Device Id
< def hex = "$settings.mac".toUpperCase().replaceAll(':', '')
< if (device.deviceNetworkId != "$hex") {
< device.deviceNetworkId = "$hex"
< log.debug "Device Network Id set to ${device.deviceNetworkId}"
---
> def hex = ""
> if (device.deviceNetworkId == NULL || device.deviceNetworkId == "") {
> // Setting Network Device Id
> //hex = "MQTT"+$settings.mac.toUpperCase().replaceAll(':', '')
> hex = ipToHex(settings.ip+":"+settings.port)
> log.debug "debug:"+hex
> if (device.deviceNetworkId != "$hex") {
> device.deviceNetworkId = "$hex"
> log.debug "Device Network Id set to $hex -> ${device.deviceNetworkId}"
> }
I originally just prefixed the right-hand-side of the assignment to hex with the string "MQTT". This is now commented out and replaced - not because it didn't work but because it didn't make sense to me to use the MAC address at all.
The MAC address is unique to the device, but not to the services running on the device. Instead, it makes sense to use something that's unique to the service (and doesn't have to be unique to the site because it will always operate in the local network).
So the new code gets the IP address and port number of the listening socket, converts them to hex and joints them together with a colon. In this way, a different service listening on a different port will have a different device ID even when it's running on the same device (thus same MAC).
The call to ipToHex() refers to a function I added, but didn't include in the above diff, for clarity. It looks like this:
// accepts a IP:PORT string and converts it to a hex identifier
// for setting the SmartThings deviceNetworkId
// NOTE: does not handle octet less than 0x10 = 16!
private String ipToHex(String ip) {
def parts = ip.tokenize(':')
def address = parts[0]
def port = parts[1]
def octets = address.tokenize('.')
def hex = ""
log.debug "converting ipToHex"
octets.each {
hex = hex + Integer.toHexString(it as Integer).toUpperCase()
}
hex = hex + ":" + Integer.toHexString(port as Integer).toUpperCase().padLeft(4,'0')
return hex
}
from smartthings-mqtt-bridge.
Great ! Thank you I will def try that !
@stjohnjohnson could we integrate this kind of mod ? I think it would help many people
from smartthings-mqtt-bridge.
Related Issues (20)
- New Smartthings restful API HOT 5
- Socket error on client <unknown>, disconnecting
- Continued support HOT 1
- trying to get this running as a service in windows 10 powershell HOT 1
- Unsure where to add IP / port / MAC to the IDE settings? HOT 2
- Set process.title HOT 1
- SmartApp triggers ok, but bridge.deviceNotification(json) not triggered HOT 1
- Issue during Docker installation with "-v /opt/mqtt-bridge:/config" HOT 1
- Questions... questions... and more questions HOT 1
- Release of new Bridge based on smartthings-mqtt-bridge HOT 5
- MQTT on different port HOT 4
- Python HOT 3
- Docker Exits when starting HOT 1
- the bridge works but nothing on HA HOT 1
- Cant uninstall anything .. HOT 3
- config.yml file does not exist
- New Smartthings app/platform HOT 8
- Config.yml help HOT 1
- No HUB, but using ST cloud
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from smartthings-mqtt-bridge.