Ticket #1067 (new)

Opened 6 years ago

Last modified 4 years ago

Support for defining SWAP devices with sensors

Reported by: gw0 Owned by: kostko
Priority: minor Milestone: Next milestone
Component: nodewatcher/modules Version:
Keywords: Cc: Musti
Related nodes: Realization state:
Blocking: 1058 Effort: normal
Blocked by: Security sensitive: no

Description

It seems that it would be much simpler and straightforward to create new custom sensors using an Arduino device. There is also a library for implementing a protocol called SWAP (Simple Wireless Abstract Protocol) on Arduino that is simple and flexible enough. Configuration of SWAP devices is done through a specially formatted XML files. They are simple to understand and designed for reading from various sensors, therefore it will probably be good that the new Nodewatcher would support or at least is designed to support them some day.

It still needs to be decided how to implement this:

  • as pre-prepared XML configuration files in our code repository for various sensors where the user than selects which ones are attached to his router
  • as a user configurable field where the user prepares and enters the correct XML for his node
  • as an abstract sensor definition in a new SWAP devices related nodewatcher module

For reading the data it would probably be good that the node itself reads and stores the data for some time and passes it to nodewatcher when a request comes in (to circumvent missing data in graphs because of packet loss). For this Python with pyswap library would be needed on nodes.

Change History

comment:1 in reply to: ↑ description Changed 6 years ago by kostko

Replying to gw0:

For this Python with pyswap library would be needed on nodes.

This is not going to work, Python is much too large for embedded devices. Since SWAP is a simple protocol, I believe a C implementation either exists or must be written in order for this to work.

comment:2 Changed 6 years ago by Musti

  • Blocking set to 1067

Python on the router wont work, SWAP gateway must be implemented in C.

comment:3 Changed 6 years ago by Musti

  • Blocking changed from 1067 to 1058, 1067

comment:4 Changed 6 years ago by Musti

Python on the router wont work, SWAP gateway must be implemented in C.

comment:5 Changed 6 years ago by kostko

  • Blocking changed from 1058, 1067 to 1058

comment:6 Changed 6 years ago by valentt

What are your thoughts about MQTT protocol? It seams like it could become an official Internet of Things protocol... and there are libraries for Arduino and server for openwrt called mosquitto.

Last edited 6 years ago by valentt (previous) (diff)

comment:7 Changed 6 years ago by Musti

Worth testing!

comment:8 follow-up: ↓ 9 Changed 6 years ago by gw0

In my opinion it is not worth testing neither SWAP protocol or MQTT protocols, because they look like just yet another custom protocol with premature optimizations for doing the same thing. There is nothing this protocols can accomplish than can not be done through a simple HTTP REST-like interface that is much simpler to develop, debug and use.

The original motivation for this ticket was not to use SWAP protocol, but to check out the way sensors/devices are being defined in the XML configuration and integrate best ideas from there into Nodewatcher. With other words to standardize sensor definitions, not the protocol how the values are transferred.

Last edited 6 years ago by gw0 (previous) (diff)

comment:9 in reply to: ↑ 8 ; follow-up: ↓ 11 Changed 6 years ago by mitar

Replying to gw0:

The original motivation for this ticket was not to use SWAP protocol, but to check out the way sensors/devices are being defined in the XML configuration and integrate best ideas from there into Nodewatcher.

But you talked about using Python on nodes? Why?

comment:10 Changed 6 years ago by mitar

  • Milestone changed from 3.0b to Next milestone

comment:11 in reply to: ↑ 9 Changed 6 years ago by gw0

Replying to mitar:

But you talked about using Python on nodes? Why?

I mentioned Python, because of pyswap that provides an event-based interface that frees your application from having to store devices, registers or parameters by itself. Something like this would probably simplify the implementation of caching on nodes.

comment:12 Changed 6 years ago by mitar

I don't understand that part. So you are saying that we could use the format to be able to generate correct configuration and parameters from sensors in nodewatcher. What is wrong if we store all this on the node? If it is generated automatically, it is not a problem? Or are you saying that we might want to support that you plug in new sensors without reflashing the router? And that this library would allow such use case?

Anyway, Python is too big for those routers, so this is no go.

comment:13 Changed 6 years ago by gw0

I am trying to say do not custom-complicate things if there are standard ways and formats for describing sensors (SWAP XML).

comment:14 Changed 4 years ago by valentt

How about using ESP8266 devices?

comment:15 Changed 4 years ago by Musti

Possibly both, with ESP as gateway for SWAP.

#1271

Note: See TracTickets for help on using tickets.