Hello,
I have developed a daemon for the DIY sensors that I have on my
boat, starting with a BME280 temperature, pressure and humidity
sensor. The daemon is a simple plugin based architecture which can
take data from multiple plugins which are essentially Python
modules. It acts as a Signal K server on the network. I only
implemented WebSocket for now.
I have a few questions:
For reference, here is the output from my code:
Ilkers-MBP:~ itemir$ wscat --connect
'ws://192.168.1.2:1923/signalk/v1/stream?subscribe=all'
connected (press CTRL+C to quit)
< {"timestamp": "2016-10-05T04:15:42.839646+00:00", "self":
"self", "version": "0.0.1", "name": "signalk-server"}
< {"updates": [{"timestamp":
"2016-10-05T04:15:46.332212+00:00", "values": [{"path":
"environment.inside.temperature", "value": 22.964940532787296},
{"path": "environment.outside.pressure", "value":
101669.46334475203}, {"path": "environment.inside.humidity",
"value": 48.645098289722895}], "source": "sources.boatsensord"}],
"context": "vessels.self"}
< {"updates": [{"timestamp":
"2016-10-05T04:15:51.460690+00:00", "values": [{"path":
"environment.inside.temperature", "value": 22.916005042948473},
{"path": "environment.outside.pressure", "value":
101670.2761034649}, {"path": "environment.inside.humidity",
"value": 48.716331745739964}], "source": "sources.boatsensord"}],
"context": "vessels.self"}
>
If you want to poke at it, available at
https://github.com/itemir/boatsensord
Thanks,
Ilker
(I just pushed a small fix, function without discovery was broken)
For a lightweight sensor server I would not worry about full SK
compliance. For my own ESP8266 temperature sensing node my plan is to
have it discover the primary SK server and start pushing line oriented
SK deltas over tcp. Work in progress, needs the tcp server part also.
> * Now that I have two Signal K servers on my Raspberry Pi (my own and
> Node server) running on two different ports, how can I multiplex them?
> o I saw the multiplexer code
> <https://github.com/SignalK/signalk-multiplexer-node>, but
> doesn't have much documentation. Any instructions I can follow?
Multiplexer really isn't a component to use for multiplexing different
types of streams.
> o I also saw mdns-ws
>
> <https://github.com/SignalK/signalk-server-node/blob/master/providers/mdns-ws.js>
> provider for the Node server. I tried to leverage it to have
> Node server read from my Signal K server by tweaking it, which
> didn't succeed. I then tried original mdns-ws provider with
> another Signal K node server for comparison, I couldn't make it
> work either. Is this approach right to multiplex two streams
> (one Signal K from my own code, and another NMEA stream from TCP)?
mdns-ws out of the box connects to all discovered SK servers and
starts streaming from them over ws. As your server doesn't support
discovery you need to tweak it to connect by configured ip. Certainly
doable and probably of general interest. Feel like doing that?
NMEA stream over TCP is not related to mdns nor ws. You need to create
a separate pipedProvider for it: tcp => nmea0183-signalk. See
https://github.com/SignalK/signalk-server-node/blob/master/settings/volare-tcp-settings.json#L24-L46
The idea with pipedProviders is that you create one for each of your
inputs and splice together the processing elements that you need. For
example if you have a tcp server sending out line oriented SK deltas
you would create pipedProvider tcp => liner => from_json: tcp
providers the byte stream, liner chops it to lines and from_json
parses each line from JSON string to js object.