Comments (15)
Did you run the device simulator?
https://docs.edgexfoundry.org/Ch-ExamplesAddingMQTTDevice.html#run-an-mqtt-device-simulator
Did you set up the correct host IP?
The following Host depends on your environment.
# 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 = "192.168.16.68"
Port = "1883"
ClientId = "CommandPublisher"
User = ""
Password = ""
Topic = "CommandTopic"
from device-mqtt-go.
Hello,
Thanks for your response, I use the correct host (broker ip address) as you can see in the zip file, which contains the configuration, the profile and the docker-compose file.
Thank you for your help
from device-mqtt-go.
PS: In the Zip file i don't include the ClientID but i tried with the clientID provided by the doc and it's not working.
from device-mqtt-go.
@anonyle47
The MQTT device simulator should subscribe to the CommandTopic to receive the request and return the response to the ResponseTopic but it not work after you modified it.
I tried to copy and paste the original content from the document and then it works fine.
from device-mqtt-go.
Hello @weichou1229 ,
I tried with the js script provided by the doc , but it's not working because the function publish, subscribe and schedule is not recognized. Also, in the js script provided by the doc "method": "get" is not added so i add to the script and I launched the mock-device.js with node. After this modification i had the result observe in the first post.
Now i retry to launch the mock-device.js with the docker but in the device-mqtt application, i don't see the randnumbers sended by the mock-device.js. And when i try to do a PUT command, I have the error : Handler - execReadCmd: error for Device: MQ_DEVICE cmd: testrandnum, can not fetch command response: method=get cmd=randnum /api/v1/device/affede12-44c2-4dba-bda8-42a68a372b06/testrandnum
Thank you for your help
from device-mqtt-go.
@anonyle47
Could you provide the detail steps which contains HTTP request content and terminal command? Then I can reproduce the issue to help you identify the problem.
from device-mqtt-go.
Hello,
weichou1229 I send you the screenshot which contains all required steps that you asked.
I noticed three errors:
- The first one linked with js (function not definied)
- The URL (created by edgex for the command) seems not generated at each execution
- A problem linked with registration, it seems the previous configuration with the wrong ip address of the broker are used ( I modified the docker-compose.yaml by removing the line 463 that is related to registry). After removed it, I noticed that the configuration used is correct and it takes the valid ip address which is 172.18.0.1 (you can see that in this picture below)
On the other hand, When I run curl -X PUT -d '{"message":"Hello!"}' http://172.18.0.1:48082/api/v1/device/291674cb-d8d0-4b2a-bf45-00f23be9dc7a/command/726eeb1c-c487-4fa6-9984-51540a00a5db directly another ip address is generated which is 172.19.0.1
(you can see that in this picture below)
I used the new IP 172.19.0.1 in the curl command curl -X PUT -d '{"message":"Hello!"}' http://172.19.0.1:48082/api/v1/device/291674cb-d8d0-4b2a-bf45-00f23be9dc7a/command/726eeb1c-c487-4fa6-9984-51540a00a5db , I saw this error below
Could you help me to know why the next IP is generated knowing that in local my IP is 172.18.0.1, which it isn't normal ?
Another question I could not use GET and PUT commands using edgex's URLS.
Thank you so much.
(I don't know if we can use teamviewer or another App in orde to access my pc remotly. If yes I'll send you all infos)
My email : [email protected]
You can see here all steps that I did.
screen_step.zip
from device-mqtt-go.
The first one linked with js (function not definied)
You should use mqtt-scripts to run the mock-device.js, the docker image already warp the js lib.
The URL (created by edgex for the command) seems not generated at each execution
Sorry, I don't know what you mean.
A problem linked with registration, it seems the previous configuration with the wrong ip address of the broker are used ( I modified the docker-compose.yaml by removing the line 463 that is related to registry). After removed it, I noticed that the configuration used is correct and it takes the valid ip address which is 172.18.0.1 (you can see that in this picture below)
This config will create a device entity. If you want to modify it, you should remove the device entity and restart the device service, or you could just shout down services and remove the old data with command docker-compose down -v
# 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 = "192.168.16.68"
Port = "1883"
ClientId = "CommandPublisher"
User = ""
Password = ""
Topic = "CommandTopic"
[[DeviceList.AutoEvents]]
Frequency = "30s"
OnChange = false
Resource = "testrandnum"
So I thought you just use the wrong IP in your configuration, please remove the old data and setup the IP correctly and then restart the service.
from device-mqtt-go.
Hello @weichou1229 ,
I have removed the old data with docker-compose down -v, but I have the same error.
Picture 1:
You can see the results of the mqtt docker :
In fact, I don't know why, the mqtt-script container doesn't send the randnum. I used the python script of issues #114 and I have the same error as it mentioned in the first picture. I don't understand this error.
Also, I have another question about the registry process when I use this command :
curl http://localhost:48071/api/v1/registration -X POST -s -S -d @- <<EOF
{
"name":"MQTT_DEVICE",
"addressable":{
"name":"broker",
"protocol":"tcp",
"address":"172.19.0.1",
"port":1883,
"publisher":"IncomingDataSubscriber",
"user":"",
"password":"",
"topic":"DataTopic"
},
"format":"JSON",
"encryption":{
"encryptionAlgorithm":"",
"encryptionKey":"",
"initializingVector":""
},
"enable":true,
"destination":"MQTT_TOPIC"
}
This command isn't included in the part 6.5 MQTT . I tested it but it doesn't work , I see the same error as it mentioned in the picture 1.
Could you help me to find the solution?
Thank you for your help
from device-mqtt-go.
Hello @weichou1229 ,
I resolved the problem, the command put and get wasn't functional due to the configuration in Apache. It's necessary to configure the file apache2.conf in <var/www> the parameter Allow override is set to none and it must be set to All.
Thank you for your help
from device-mqtt-go.
Hi @anonyle47,
I'm glad you solved the error, but the file in question you talk about where it's located? In the device service container?
Could you give me more information?
from device-mqtt-go.
Hello @Salvocll ,
It depends of the version of your Apache, I have Apache2 and the configuration file is located in /etc/apache2/apache2.conf
from device-mqtt-go.
@anonyle47 , but it is not named apache2 anywhere in the EdgeX guide.. how can it affect the operation of the commands to the device service?
from device-mqtt-go.
@Salvocll , when I tried to do the command get or put I realised thanks to postman that my error was linked to the error 500. And when I google that error I realised that the error is linked with Apache. This error is related with the permission.
from device-mqtt-go.
from device-mqtt-go.
Related Issues (20)
- 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
- Edgex mqtt error HOT 11
- jpeg images send to edgex HOT 2
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.