Crossbar for IoT, advice on how to build it

#1

Hi crossbar and autobahn comunity.

I need some advice on how to accomplish my project on IoT devices. Here is a exerpt of what I want to archive, and some ideas on how to implement it:

  • A bunch of IoT devices, all of them implements the same api, so for example all can turn on/off a light, take a picture, etc. I need Callees here.

  • At the same time all of them have sensors. I need Publishers here

  • A central component, wich keeps records in a database of the data sensed on the devices. Subscriber here.

  • A way to control the IoT devices. Here is when I get lost…

I need advice here, so for example, how do I call a remote procedure on the device No. 4?. And before that, how do I know wich devices are connected?

I cannot rely on internet connection, so basically all the IoT devices can go offline at random times.

0 Likes

#2

A device can register a remote procedure, and then the server can call it. So you could have one procedure that takes arguments or one procedure for each task. Any end of the system can be a publisher or subscriber, or a caller or a callee.

0 Likes

#3

The problem is that I have many devices with the same api, as they all would register the same callees, I can’t call a specific one.

By the meantime I’m giving each device a specific hardcoded ID, so ther register they callees in the form ‘iot.device.ID.task’… it is not a elegant solution, but is working.

0 Likes

#4

A slightly more elegant solution might be to have your devices be given an ID by the master when the wamp.metaevent.session.on_join event occurs. (see: https://github.com/crossbario/crossbar/wiki/Session-Metaevents)

You could then either use the session.id in the namespace or push them into a central array and return their index number as the ID to be used by the client.

When the on_leave event occurs, you can then de-register the zombie procedures from the master.

Rgds,
Reda

···

On Thursday, 20 November 2014 22:56:00 UTC, Dennis Xiloj wrote:

The problem is that I have many devices with the same api, as they all would register the same callees, I can’t call a specific one.

By the meantime I’m giving each device a specific hardcoded ID, so ther register they callees in the form ‘iot.device.ID.task’… it is not a elegant solution, but is working.

0 Likes

#5

Another solution that would still be better than hardcoding would be to use the something based on the IP or the Mac address of the network adapter on the client using an OS library for your ID. Example: https://www.npmjs.org/package/getmac

···

On Thursday, 20 November 2014 23:21:30 UTC, reda...@gmail.com wrote:

A slightly more elegant solution might be to have your devices be given an ID by the master when the wamp.metaevent.session.on_join event occurs. (see: https://github.com/crossbario/crossbar/wiki/Session-Metaevents)

You could then either use the session.id in the namespace or push them into a central array and return their index number as the ID to be used by the client.

When the on_leave event occurs, you can then de-register the zombie procedures from the master.

Rgds,
Reda

On Thursday, 20 November 2014 22:56:00 UTC, Dennis Xiloj wrote:

The problem is that I have many devices with the same api, as they all would register the same callees, I can’t call a specific one.

By the meantime I’m giving each device a specific hardcoded ID, so ther register they callees in the form ‘iot.device.ID.task’… it is not a elegant solution, but is working.

0 Likes

#6

Very interesting!, I’d have no idea that was possible. Im experimenting right now with auto-generated IDs and a procedure to maintain an array of connected clients.

Thanks!

···

El jueves, 20 de noviembre de 2014 17:21:30 UTC-6, reda...@gmail.com escribió:

A slightly more elegant solution might be to have your devices be given an ID by the master when the wamp.metaevent.session.on_join event occurs. (see: https://github.com/crossbario/crossbar/wiki/Session-Metaevents)

You could then either use the session.id in the namespace or push them into a central array and return their index number as the ID to be used by the client.

When the on_leave event occurs, you can then de-register the zombie procedures from the master.

Rgds,
Reda

On Thursday, 20 November 2014 22:56:00 UTC, Dennis Xiloj wrote:

The problem is that I have many devices with the same api, as they all would register the same callees, I can’t call a specific one.

By the meantime I’m giving each device a specific hardcoded ID, so ther register they callees in the form ‘iot.device.ID.task’… it is not a elegant solution, but is working.

0 Likes