XDK as a mqtt sensor node in a smarthome
응답
16. 5. 10 오전 6:00

Hello - it would be great if we had a simple demo / solution where the xdk could provide it's sensor data on request via mqtt - no stream. I have installed and seen the solution with the bosch iot suite, but i think if we sell in a few days the xdk at conrad electronics such "easy" software application with use of a own mqtt broker on a raspberrypi and only get sensor data if we want that - would be great.
If i would have this easy solution i would be able to implement the xdk im my own smarthome application.
An option to any customer too ?
Actually i have Photon and RedBear Duo SensorNodes running at home with mqtt data transfers.
Ohers with 433Mhz, 868Mhz etc. and RF24.
Would be great to run XDK SensorNodes too.

April 2016 - job is done - thanx a lot to the complete xdk team

 

+1 (1 투표)
XDK as a mqtt sensor node in a smarthome
응답
16. 3. 29 오전 9:33 as a reply to Achim Kern.
There are already some implementations that use MQTT. Look e.g. for http://xdk.bosch-connectivity.com/de/relayr, it is based on PAHO library. Feel free to adapt it to your needs.
+1 (1 투표)
XDK as a mqtt sensor node in a smarthome
응답
16. 3. 29 오후 1:14 as a reply to Kornelius Nägele.
Achim,

I am glad you are interested in the XDK with MQTT.  I have just submitted a more simplistic MQTT demo to be uploaded to the XDK website as a tutorial.  This doesn't have the exact functionality you are looking for but it is easier to navigate than the Bosch IoT Suite code.  You should be able to easily create a new subscribe topic with this code that can set a flag that will tell the XDK to publish data to the MQTT Broker rather than using a timer to stream the data.  Note this new code doens't stream data by default but requires a button press.  So setting up your desired functionality becomes fairly easy.  Below is a quick example of how you can accomplish your task in the code.

in mqttClient.h
  • Add new topic to typdef enum MQTT_SubTopics (add new enumeration before SUBTOPIC_COUNT)
  • Add new SUB_TOPIC_ macro; this is the topic string
in mqttClient..c
  • add mqttSubTopic variable and pointer at top of code
  • add new SUB_TOPIC macro to mqttConnectConfig initialization, along with new QOS
  • mqttRecv - This function contains the data received by the XDK from the broker.  Here the received topic strings are compared with the topic strings you are subscibed to, if the received string matched the new topic to send data then you can set the new flag to send the data and start the timer.
  • mqttClientTask - This is the main task of the MQTT client, here you can edit the if statement and after the data is sent you can monitor the flag set in mqttRecv to stop the timer.
  • mqttClientSubscribe - here is where the XDK subscribes to differnent topics, follow the model set forth in the function to add a new topic
0 (0 투표)