Comments (7)
@clem844 I'm not sure, could you try to remove the device entity by metadata API and then restart the device-mqtt-go again.
It seems you didn't update the device Protocols successfully.
device-service didn't update the device entity, so you should update by yourself.
edgex-device-mqtt | level=DEBUG ts=2019-07-16T13:22:21.450101482Z app=edgex-device-mqtt source=devices.go:25 msg="Device MQ_DEVICE exists, using the existing one"
from device-mqtt-go.
@clem844 Could you provide your configuration.toml file? I can test it on my side.
from device-mqtt-go.
Here is the configuration.toml file:
# configuration.toml
[Writable]
LogLevel = 'DEBUG'
[Service]
Host = "edgex-device-mqtt"
Port = 49982
ConnectRetries = 3
Labels = []
OpenMsg = "device mqtt started"
Timeout = 5000
EnableAsyncReadings = true
AsyncBufferSize = 16
[Registry]
Host = "edgex-core-consul"
Port = 8500
CheckInterval = "10s"
FailLimit = 3
FailWaitTime = 10
Type = "consul"
[Logging]
EnableRemote = false
File = "./device-mqtt.log"
[Clients]
[Clients.Data]
Name = "edgex-core-data"
Protocol = "http"
Host = "edgex-core-data"
Port = 48080
Timeout = 50000
[Clients.Metadata]
Name = "edgex-core-metadata"
Protocol = "http"
Host = "edgex-core-metadata"
Port = 48081
Timeout = 50000
[Clients.Logging]
Name = "edgex-support-logging"
Protocol = "http"
Host ="edgex-support-logging"
Port = 48061
[Device]
DataTransform = true
InitCmd = ""
InitCmdArgs = ""
MaxCmdOps = 128
MaxCmdValueLen = 256
RemoveCmd = ""
RemoveCmdArgs = ""
ProfilesDir = "/custom-config"
# Pre-define Devices
[[DeviceList]]
Name = "MQ_DEVICE"
Profile = "Test.Device.MQTT.Profile"
Description = "General MQTT device"
Labels = [ "MQTT"]
[DeviceList.Protocols]
[DeviceList.Protocols.mqtt]
Schema = "tcp"
Host = "172.21.0.16"
Port = "1883"
ClientId = "CommandPublisher"
User = ""
Password = ""
Topic = "CommandTopic"
[[DeviceList.AutoEvents]]
Frequency = "30s"
OnChange = false
Resource = "testrandnum"
# Driver configs
[Driver]
IncomingSchema = "tcp"
IncomingHost = "172.21.0.16"
IncomingPort = "1883"
IncomingUser = ""
IncomingPassword = ""
IncomingQos = "0"
IncomingKeepAlive = "3600"
IncomingClientId = "IncomingDataSubscriber"
IncomingTopic = "DataTopic"
ResponseSchema = "tcp"
ResponseHost = "172.21.0.16"
ResponsePort = "1883"
ResponseUser = ""
ResponsePassword = ""
ResponseQos = "0"
ResponseKeepAlive = "3600"
ResponseClientId = "CommandResponseSubscriber"
ResponseTopic = "ResponseTopic"
from device-mqtt-go.
@clem844
It seems work on my laptop.
$ docker logs edgex-device-mqtt
Init: useRegistry: consul://edgex-core-consul:8500 profile: confDir: /custom-config
Check registry is up... http://edgex-core-consul:8500
Pushing configuration into Registry...
Loading configuration from: /custom-config/configuration.toml
Register in registry...
Calling service.Start.
EnableRemote is false, using local log file
level=INFO ts=2019-08-08T01:42:27.9901669Z app=edgex-device-mqtt source=init.go:137 msg="Check Metadata service's status ..."
level=INFO ts=2019-08-08T01:42:27.9903187Z app=edgex-device-mqtt source=init.go:137 msg="Check Data service's status ..."
...
...
level=DEBUG ts=2019-08-08T01:42:28.1105155Z app=edgex-device-mqtt source=devices.go:60 msg="Adding Device: {\"origin\":1565228548110,\"description\":\"General MQTT device\",\"name\":\"MQ_DEVICE\",\"adminState\":\"UNLOCKED\",\"operatingState\":\"ENABLED\",\"protocols\":{\"mqtt\":{\"ClientId\":\"CommandPublisher\",\"Host\":\"192.168.0.2\",\"Password\":\"\",\"Port\":\"1883\",\"Schema\":\"tcp\",\"Topic\":\"CommandTopic\",\"User\":\"\"}},\"labels\":[\"MQTT\"],\"service\":{\"origin\":1565228548024,\"description\":\"\",\"id\":\"08435225-67e5-440f-b484-dc0c54396a9f\",\"name\":\"edgex-device-mqtt\",\"lastConnected\":0,\"lastReported\":0,\"operatingState\":\"ENABLED\",\"labels\":[],\"addressable\":{\"origin\":1565228548021,\"id\":\"ebcf79f7-942f-4f38-b9ab-24eacd519aa7\",\"name\":\"edgex-device-mqtt\",\"protocol\":\"HTTP\",\"method\":\"POST\",\"address\":\"edgex-device-mqtt\",\"port\":49982,\"path\":\"/api/v1/callback\",\"baseURL\":\"HTTP://edgex-device-mqtt:49982\",\"url\":\"HTTP://edgex-device-mqtt:49982/api/v1/callback\"},\"adminState\":\"UNLOCKED\"},\"profile\":{\"description\":\"Test device profile\",\"id\":\"23c51ec5-17fd-4c77-9243-53dcaeb55424\",\"name\":\"Test.Device.MQTT.Profile\",\"manufacturer\":\"iot\",\"model\":\"MQTT-DEVICE\",\"labels\":[\"mqtt\",\"test\"],\"deviceResources\":[{\"description\":\"device random number\",\"name\":\"randnum\",\"properties\":{\"value\":{\"type\":\"Float64\",\"readWrite\":\"R\",\"size\":\"4\",\"floatEncoding\":\"eNotation\"},\"units\":{\"type\":\"String\",\"readWrite\":\"R\"}}},{\"description\":\"device awake\",\"name\":\"ping\",\"properties\":{\"value\":{\"type\":\"String\",\"readWrite\":\"R\",\"defaultValue\":\"pong\",\"size\":\"0\"},\"units\":{\"type\":\"String\",\"readWrite\":\"R\"}}},{\"description\":\"device message\",\"name\":\"message\",\"properties\":{\"value\":{\"type\":\"String\",\"readWrite\":\"W\",\"size\":\"0\"},\"units\":{\"type\":\"String\",\"readWrite\":\"R\"}}}],\"deviceCommands\":[{\"name\":\"testrandnum\",\"get\":[{\"index\":\"1\",\"operation\":\"get\",\"object\":\"randnum\",\"parameter\":\"randnum\"}]},{\"name\":\"testping\",\"get\":[{\"index\":\"1\",\"operation\":\"get\",\"object\":\"ping\",\"parameter\":\"ping\"}]},{\"name\":\"testmessage\",\"get\":[{\"index\":\"1\",\"operation\":\"get\",\"object\":\"message\",\"parameter\":\"message\"}],\"set\":[{\"index\":\"1\",\"operation\":\"set\",\"object\":\"message\",\"parameter\":\"message\"}]}],\"coreCommands\":[{\"name\":\"testrandnum\",\"get\":{\"path\":\"/api/v1/device/{deviceId}/testrandnum\",\"responses\":[{\"code\":\"200\",\"description\":\"get the random value\",\"expectedValues\":[\"randnum\"]},{\"code\":\"503\",\"description\":\"service unavailable\"}]},\"put\":{}},{\"name\":\"testping\",\"get\":{\"path\":\"/api/v1/device/{deviceId}/testping\",\"responses\":[{\"code\":\"200\",\"description\":\"ping the device\",\"expectedValues\":[\"ping\"]},{\"code\":\"503\",\"description\":\"service unavailable\"}]},\"put\":{}},{\"name\":\"testmessage\",\"get\":{\"path\":\"/api/v1/device/{deviceId}/testmessage\",\"responses\":[{\"code\":\"200\",\"description\":\"get the message\",\"expectedValues\":[\"message\"]},{\"code\":\"503\",\"description\":\"service unavailable\"}]},\"put\":{\"path\":\"/api/v1/device/{deviceId}/testmessage\",\"responses\":[{\"code\":\"204\",\"description\":\"set the message.\"},{\"code\":\"503\",\"description\":\"service unavailable\"}],\"parameterNames\":[\"message\"]}}]},\"autoEvents\":[{\"frequency\":\"30s\",\"resource\":\"testrandnum\"}]}"
level=DEBUG ts=2019-08-08T01:42:28.1283144Z app=edgex-device-mqtt source=restrouter.go:21 msg="init status rest controller"
level=INFO ts=2019-08-08T01:42:28.1284865Z app=edgex-device-mqtt source=driver.go:279 msg="Create MQTT client and connection: uri=tcp://:@192.168.0.2:1883 clientID=CommandResponseSubscriber "
level=INFO ts=2019-08-08T01:42:28.1285956Z app=edgex-device-mqtt source=driver.go:279 msg="Create MQTT client and connection: uri=tcp://:@192.168.0.2:1883 clientID=IncomingDataSubscriber "
level=DEBUG ts=2019-08-08T01:42:28.1308509Z app=edgex-device-mqtt source=restrouter.go:24 msg="init command rest controller"
level=DEBUG ts=2019-08-08T01:42:28.1330238Z app=edgex-device-mqtt source=restrouter.go:30 msg="init callback rest controller"
level=DEBUG ts=2019-08-08T01:42:28.1398987Z app=edgex-device-mqtt source=restrouter.go:33 msg="init other rest controller"
level=INFO ts=2019-08-08T01:42:28.1402404Z app=edgex-device-mqtt source=responselistener.go:52 msg="[Response listener] Start command response listening. "
level=INFO ts=2019-08-08T01:42:28.1422256Z app=edgex-device-mqtt source=incominglistener.go:54 msg="[Incoming listener] Start incoming data listening. "
level=DEBUG ts=2019-08-08T01:42:28.1425166Z app=edgex-device-mqtt source=restrouter.go:37 msg="init the metrics and config rest controller each"
level=INFO ts=2019-08-08T01:42:28.1444432Z app=edgex-device-mqtt source=service.go:120 msg="*Service Start() called, name=edgex-device-mqtt, version=1.0.0"
level=INFO ts=2019-08-08T01:42:28.1494503Z app=edgex-device-mqtt source=service.go:126 msg="Listening on port: 49982"
level=INFO ts=2019-08-08T01:42:28.1514161Z app=edgex-device-mqtt source=service.go:127 msg="Service started in: 535.0428ms"
level=DEBUG ts=2019-08-08T01:42:28.1529579Z app=edgex-device-mqtt source=service.go:129 msg="*Service Start() exit"
level=INFO ts=2019-08-08T01:42:30.0092372Z app=edgex-device-mqtt source=incominglistener.go:100 msg="[Incoming listener] Incoming reading received: topic=DataTopic msg={\"name\":\"MQ_DEVICE\",\"cmd\":\"randnum\",\"randnum\":\"28.8\"}"
level=DEBUG ts=2019-08-08T01:42:30.0135913Z app=edgex-device-mqtt source=utils.go:67 correlation-id=6878ed39-4f28-4534-b6c5-2b985b1c3d67 msg="SendEvent: EventClient.MarshalEvent encoded event"
level=INFO ts=2019-08-08T01:42:30.3375243Z app=edgex-device-mqtt source=utils.go:77 Content-Type=application/json correlation-id=6878ed39-4f28-4534-b6c5-2b985b1c3d67 msg="SendEvent: Pushed event to core data"
level=INFO ts=2019-08-08T01:42:45.0045586Z app=edgex-device-mqtt source=incominglistener.go:100 msg="[Incoming listener] Incoming reading received: topic=DataTopic msg={\"name\":\"MQ_DEVICE\",\"cmd\":\"randnum\",\"randnum\":\"26.9\"}"
level=DEBUG ts=2019-08-08T01:42:45.0089369Z app=edgex-device-mqtt source=utils.go:67 correlation-id=5bcb6487-3e63-4cbe-9157-93e62b4b90ec msg="SendEvent: EventClient.MarshalEvent encoded event"
level=INFO ts=2019-08-08T01:42:45.0142331Z app=edgex-device-mqtt source=utils.go:77 Content-Type=application/json correlation-id=5bcb6487-3e63-4cbe-9157-93e62b4b90ec msg="SendEvent: Pushed event to core data"
level=DEBUG ts=2019-08-08T01:42:58.1098226Z app=edgex-device-mqtt source=executor.go:42 msg="AutoEvent - executing {\"frequency\":\"30s\",\"resource\":\"testrandnum\"}"
level=DEBUG ts=2019-08-08T01:42:58.1137897Z app=edgex-device-mqtt source=command.go:200 msg="Handler - execReadCmd: deviceResource: randnum"
level=DEBUG ts=2019-08-08T01:42:58.1161792Z app=edgex-device-mqtt source=command.go:207 msg="Handler - execReadCmd: deviceResource: {\"description\":\"device random number\",\"name\":\"randnum\",\"properties\":{\"value\":{\"type\":\"Float64\",\"readWrite\":\"R\",\"size\":\"4\",\"floatEncoding\":\"eNotation\"},\"units\":{\"type\":\"String\",\"readWrite\":\"R\"}}}"
level=INFO ts=2019-08-08T01:42:58.1182637Z app=edgex-device-mqtt source=driver.go:279 msg="Create MQTT client and connection: uri=tcp://:@192.168.0.2:1883 clientID=CommandPublisher "
level=INFO ts=2019-08-08T01:42:58.1237791Z app=edgex-device-mqtt source=driver.go:154 msg="Publish command: {\"cmd\":\"randnum\",\"method\":\"get\",\"uuid\":\"5d4b7e22b8dd790001f79765\"}"
level=INFO ts=2019-08-08T01:42:58.1289226Z app=edgex-device-mqtt source=responselistener.go:63 msg="[Response listener] Command response received: topic=ResponseTopic uuid=5d4b7e22b8dd790001f79765 msg={\"cmd\":\"randnum\",\"method\":\"get\",\"uuid\":\"5d4b7e22b8dd790001f79765\",\"randnum\":12.123}"
-
You can check the ip by query core-metadata API like http://localhost:48081/api/v1/device/name/MQ_DEVICE
-
What's your EdgeX version?
I use the Edinburgh release and follow the doc .
from device-mqtt-go.
I'm using Edinburgh release with Redis DB. I tried with the very last docker-compose file (docker-compose-redis-edinburgh-no-secty-1.0.1.yml).
Query to core-metadata gives 127.0.0.1 as host for "CommandPublisher" client. I changed the IP to a new broker IP address and localhost is not mentioned anywhere in the configuration file. As previously mentioned, "CommandResponseSubscriber" and "IncomingDataSubscriber" correctly connect to the broker...
PS: I'm also following the doc
from device-mqtt-go.
@weichou1229 Thank you. I did what you suggested and also had to completely restart all containers and it finally works.
from device-mqtt-go.
Hi @clem844 clem844, can you pls explain what changses you made in this issue to solve it. I am facing similar issue.
from device-mqtt-go.
Related Issues (20)
- A confusion about the MQTT Device Service HOT 6
- Security: Implement CGO binary hardening
- Add "make lint" target and add to "make test" target
- Bump device-sdk-go version and update configuration.toml
- What will be the path to mqtt-scripts HOT 2
- How to receive another data frame. HOT 2
- Upgrade github.com/eclipse/paho.mqtt.golang from 1.3.5 to 1.4.1 HOT 1
- How to recognize the command from which devices. HOT 2
- Testping command returns EOF HOT 3
- ERROR: libcurl-7.80.0-r1: package mentioned in index not found. HOT 2
- fail to unmarshal event, AddEventRequest.Event.Readings[0].ValueType field validation failed on the edgex-dto-value-type tag HOT 6
- why started http2write command with mutil threads , but for many devices ,all of concur size of http is only 4? HOT 7
- How to run built image via docker run, and via docker-compose file HOT 6
- 编译2.3.0发行版本时,报错,无法完成编译 HOT 2
- Make multi-level topics the only implementation HOT 3
- Change configuration and device toml files to yaml
- device-mqtt leaks message bus credentials HOT 3
- {WIP BUG] New Async multi-reading support breaks handling of basic single reading
- No support for certificate based secure communication HOT 2
- bad device value need detail and response error message HOT 5
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 device-mqtt-go.