flowext

package module
v0.0.0-...-8969683 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2014 License: MIT Imports: 13 Imported by: 0

README

flow-ext


Flow based Extensions, Gadgets, Decoders etc for jcw/flow based apps.

  • Update 2014/04/23: Added RangeMap Gadget.
  • Update 2014/04/21: Updated SerialPortEx Gadget.
  • Update 2014/04/26: MQTTServerEx packages reorganised to make them more flexible like SerialPortEx.

Decoders


Pressure and Temperature

Bmp085 and Bmp085Batt, effectively a decoder for the Bosch BMP085 and used within the Jeelabs Pressure Plug

See more info about the decoders

Gadgets


Generic

ReadlineStdIn

Sometimes you may want to pipe data into Jeebus/Housemon from the commandline. Perhaps you have a python script that outputs data to its stdout. Use this Gadget to capture line orientated input to your apps stdin. To use, simply include this line in your imports

	_ "github.com/TheDistractor/flow-ext/gadgets/jeebus/io/readline"  //ReadlineStdIn

You now have a ReadlineStdIn Gadget whos' .Out pin represents the line orientated data read from stdin. You you can hook this pin up to an Input pin of another gadget.

RangeMap

It is often a requirement to map a value from one range constraint to another, for instance mapping a 10bit ADC (0-1023) to an 8bit PWM (0-255). The RangeMap Gadget helps you achieve just that. My main use for this is to actually map a 8bit (light intensity) LDR value from roomnode's to an on/off (0/1).

Usage:

Add to imports:

	_ "github.com/TheDistractor/flow-ext/gadgets/generic/conversions/rangemap"  //RangeMapper

Provide the input range values as flow.Tag's such as:

    { tag: "fromlow", data: 0, to: "map.Param" }
    { tag: "fromhi", data: 255, to: "map.Param" }
    { tag: "tolow", data: 0, to: "map.Param" }
    { tag: "tohi", data: 1023, to: "map.Param" }

(This example will map a typical PWM value back to an 10bit ADC range).

Then wire up the .In and .Out pins within your circuit. The .In pin could be the value from a sensor feed (via the MQTTSub Gadget). The .Out pin could be to the .To pin of a Serial Gadget connected to an arduino/jeenode controlling another device.

If your arduino was driving a relay, you could use the light intensity to switch it on/off using something like:

    { tag: "fromlow", data: 255, to: "map.Param" }
    { tag: "fromhi", data: 0, to: "map.Param" }
    { tag: "tolow", data: 0, to: "map.Param" }
    { tag: "tohi", data: 1, to: "map.Param" }

i.e If the light intensity is more than 50% (128) the output would be 1 and less that 50%, it would be 0. You could reverse the login by switching the 'fromlow' and 'fromhi' values.

Flow focused

DeadOutPin

This utility Gadget can be used within a circuit to sit on an input PIN of another Gadget that would normally expect Input flows, but in cases where your circuit does not want to supply any. This will stop your Gadget from spinning on nil input values. I would expect this Gadget to be un-necessary in future revisions of 'flow', but for now it can help Gadget development in specific cases. I use it in gadgets that can have multiple inputs, that in some circuits only 'some' of the inputs are connected.

Add to imports:

	_ "github.com/TheDistractor/flow-ext/gadgets/flow/deadoutpin"  //DeadOutPin

Incorporate into a circuit:

    { from: "<DeadOutPin>.Out", to:"<TargetGadget>.To"} #stop it complaining
HouseMon focused

LogArchiverTGZ

This Gadget takes the output from the Core Logger gadget as its input. It also takes an input mask to specify its actions. A typical setup is to set the output mask to monthly (tar) to add each daily log to a monthly tar file. We then take the output of this gadget, and supply it as the input to another instance of LogArchiverTGZ, but this time with a mask of monthly (gz), which will take the monthly tar file from the previous gadget instance and turn it into a tar.gz file. More info to follow, however the package has some documentation already.

RadioBlippers (Simulation)

This Gadget allows you to simulate a number of radioBlip nodes on specific RF Network groups.

NodeMap (extended core Gadget)

NodeMap replaces the core NodeMap gadget to support the Band/Frequency parameter. This will allow you to use:

    { data: "RFb433g5i2,roomNode,boekenkast JC",  to: "nm.Info" }
    { data: "RFb868g5i2,roomNode,keuken",  to: "nm.Info" }

Important: You must also override the Readings gadget if you want your database to process this extended information correctly, and is an absolute must if you have the same group (e.g. g5) on both 868 and 433 Mhz, otherwise one bands data will interleave with another.

( Note: I will be submitting a derivative of this to core shortly)

PutReadings (extended core Gadget)

PutReadings replaces the core PutReadings gadget to support the Band/Frequency parameter. This will allow you to use:

    { data: "RFb433g5i2,roomNode,boekenkast JC",  to: "nm.Info" }
    { data: "RFb868g5i2,roomNode,keuken",  to: "nm.Info" }

Important: You will need the revised NodeMap (see above).

Note:I have also published convert-rf-readings which allows you to convert between the two formats. convert-rf-readings has basic documentation.

OnOffMonitor

OnOffMonitor allows you to manage On/Off events within the context of 'time' and 'duration'. It consumes events you specify from DataSub and generates one or more additional 'related' events. As an example, you can listen for roomNode 'moved' events and generate another event 20min in the future if the state of the endpoint has not changed. You can then hook into this event with another appropriate Gadget to handle the new event.

Jeebus focused

SerialPortEx (extended core Gadget)

The SerialPortEx Gadget is an extended SerialPort. It contains a .Param pin to allow configuration of such things as Baud, Databits & StopBits. It otherwise operates directly as per the standard SerialPort gadget and is directly interchangeable. Its default configuration is as per the core SerialPort Gadget. This Gadget is appropriate if you wish more control over the serial port, such as if you are using an ATTINY based micro like the JNu,ATTiny85,ATTiny84 or a GPS or bluetooth module.

There are actually two 'variants' of this Gadget. They both do the "same" thing, but are implemented in different ways:

  • If you load the Gadget via the serial/compat package, it will just replace the standard SerialPort implementation.
	_ "github.com/TheDistractor/flow-ext/gadgets/jeebus/serial/compat"  //override default SerialPort with SerialPortEx

  • If you use the serial/serialex package it will not replace the standard SerialPort, but rather provide a SerialPortEx Gadget within the Flow Registry.
	_ "github.com/TheDistractor/flow-ext/gadgets/jeebus/serial/serialex"  //provide SerialPortEx
  • If you use serial/extended you will be able to access the native SerialPortEx Gadget, but it will NOT be added to the Flow Registry as a Gadget - in which case registration is up to you to add it to the Registry/Circuit yourself.
	_ "github.com/TheDistractor/flow-ext/gadgets/jeebus/serial/extended"  //SerialPortEx but NOT added to Registry

Update 2014/04/20 - The .Param pin now specifically supports an 'init' parameter, that you can use to send initial data to the serial port in a one off manner (perhaps used to set things up)

    { tag:"init", data: "v", to: "sp.Param" }

The 'init' parameter also supports the concept of a delay (in ms), that can be used to separate time sensitive init sequences:

    { tag:"init", data: {delay:20}, to: "sp.Param" }

These 'init' sequences are replayed in the order they are received.

( Note: I will be submitting a derivative of this to core shortly)

MQTTServerEx

If you choose to use an external MQTT broker like RabbitMQ or Mosquitto, use this Gadget to replace the inbuilt Gadget. it simply provides you with a quick check to confirm an external broker is visible on the chosen url/port. It then steps out of the way allowing your app to talk to the external broker.

This Gadget can be used in three different ways like the SerialPortEx above.

  • Including package as mqtt/compat will replace the core MQTTServer with MQTTServerEx, effectively using a remote broker.
	_ "github.com/TheDistractor/flow-ext/gadgets/network/mqtt/compat"  //override the default server with remote broker
  • Including package as mqtt/mqttex will include MQTTServerEx in the Registry and will not replace MQTTServer.
	_ "github.com/TheDistractor/flow-ext/gadgets/network/mqtt/mqttex"  //override the default server with remote broker
  • Lastly, including package as mqtt/extended will provide the Gadget MQTTServerEx but NOT directly add it to flow Registry. You must add it yourself using whatever alias you prefer.
HTTPServer

This version of HTTPServer supports HTTP(S):// and WS(S)://. It can be loaded to override the existing HTTPServer implementation within the core packages, simply import as:

	_ "github.com/TheDistractor/flow-ext/gadgets/network/http"  //HTTPServer with https and ws-protocol selection

An additional "Feed" input of 'Param' is supplied where you can include the following parameters as flow.Tag{} entries:

'certfile'

'certkey'


   feeds: [
     { tag:"certfile", data: "/path/to/cert.pem", to: "http.Param" }
     { tag:"certkey", data: "/path/to/cert.key", to: "http.Param" }
     #...more feeds
   ]

If you want to use this in Housemon, its HTTPServer is defined in main.go (and overrides the one in json circuit) so you should add the appropriate parameters there:

main.go:

	c.Feed("http.Param", flow.Tag{"certfile", "/path/to/cert.pem"})
	c.Feed("http.Param", flow.Tag{"certkey", "/path/to/cert.key"})

Note: When you add a valid certificate/key your server will switch to HTTPS:// and your websocket support will also switch to WSS:// using whatever PORT you defined. (Your browser/client may warn you if your server certificate is untrusted, you should use the appropriate commands for your os/client to enable this trust)

Important: This revised gadget has been submitted to the core jeebus/housemon repo's , until its features are incorporated you should also check and add the following line to 'jeebus.coffee' within jeebus to enable wss:// support. see here, jeebus.coffee lines 49:50

-      ws = new WebSocket "ws://#{location.host}/ws", [appTag]
 +      wsProto = (if "https:" is document.location.protocol then "wss://" else "ws://")
 +      ws = new WebSocket "#{wsProto}#{location.host}/ws", [appTag]

Documentation

Overview

Numerous Gadgets and Decoders for the Flow based Jeebus/Housemon

This is a convenience package to wrap all the Gadgets/Decoders available in the Library, you can however reference many as separate entities.

Index

Constants

This section is empty.

Variables

View Source
var Version = "0.9.0"

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
decoders
jeelib/bmp085
Decoder for the "BMP085demo.ino" sketch as in: http://github.com/jcw/jeelib/tree/master/examples/Ports/bmp085demo/bmp085demo.ino Decoder Registers as "Node-Bmp085".
Decoder for the "BMP085demo.ino" sketch as in: http://github.com/jcw/jeelib/tree/master/examples/Ports/bmp085demo/bmp085demo.ino Decoder Registers as "Node-Bmp085".
jeelib/bmp085batt
Decoder for the "BMP085demoBatt.ino" sketch as defined: http://github.com/TheDistractor/ino/tree/master/jeelib/examples/Ports/bmp085demobatt/bmp085demobatt.ino This decoder is slightly different than the base BMP085 decoder (also in this package) in that it allows for the node to send back a Battery low flag (the value of which is calculated in your sketch using perhaps the internal bandgap method, as per example above) Registers as "Node-Bmp085Batt".
Decoder for the "BMP085demoBatt.ino" sketch as defined: http://github.com/TheDistractor/ino/tree/master/jeelib/examples/Ports/bmp085demobatt/bmp085demobatt.ino This decoder is slightly different than the base BMP085 decoder (also in this package) in that it allows for the node to send back a Battery low flag (the value of which is calculated in your sketch using perhaps the internal bandgap method, as per example above) Registers as "Node-Bmp085Batt".
gadgets
flow/deadoutpin
provide basic two way rf gateway services
provide basic two way rf gateway services
generic/conversions/rangemap
Package conversions provides Gadgets that offer some form of data conversion process
Package conversions provides Gadgets that offer some form of data conversion process
housemon/logging
Package logging implements various data logging gadgets that enhance the core housemon logger.
Package logging implements various data logging gadgets that enhance the core housemon logger.
housemon/rf/nodemap
package rfdata provides both replacement (enhancements) to the core housemon rfdata package and new functionality not found in the existing core package
package rfdata provides both replacement (enhancements) to the core housemon rfdata package and new functionality not found in the existing core package
housemon/rf/putreadings
package rfdata provides both replacement (enhancements) to the core housemon rfdata package and new functionality not found in the existing core package
package rfdata provides both replacement (enhancements) to the core housemon rfdata package and new functionality not found in the existing core package
housemon/simulation
Various Simulators that can be used with Housemon
Various Simulators that can be used with Housemon
housemon/simulation/radioblippers
Package radioblippers provides a gadget to simulate a network of radioBLIP sketches without needing to deploy either radioBLIP nodes or a receiver node.
Package radioblippers provides a gadget to simulate a network of radioBLIP sketches without needing to deploy either radioBLIP nodes or a receiver node.
housemon/statemanagement
OnOffMonitor Author: TheDistractor, aka-lightbulb A HouseMon Gadget to allow you to react to Boolean (0/1) inputs within a 'time' context This Gadget came about as I wanted to react to situations when I CAN/CANNOT detect movement over a set period - I wanted to make sure lights can be turned off in a rooms where there may be no occupants, just like a traditional time-delay switch may operate, or turn heating on when a room seems to have been occupied for a while, or switch a relay off after it has been running for a set period of time etc, but with the ability to combine this output with other environmental inputs to make a bigger 'decision tree'.
OnOffMonitor Author: TheDistractor, aka-lightbulb A HouseMon Gadget to allow you to react to Boolean (0/1) inputs within a 'time' context This Gadget came about as I wanted to react to situations when I CAN/CANNOT detect movement over a set period - I wanted to make sure lights can be turned off in a rooms where there may be no occupants, just like a traditional time-delay switch may operate, or turn heating on when a room seems to have been occupied for a while, or switch a relay off after it has been running for a set period of time etc, but with the ability to combine this output with other environmental inputs to make a bigger 'decision tree'.
jeebus/io/readline
Package readline supports Readline based Gadgets
Package readline supports Readline based Gadgets
jeebus/serial/compat
Interface to serial port devices (only Linux and Mac OSX).
Interface to serial port devices (only Linux and Mac OSX).
jeebus/serial/extended
Interface to serial port devices (only Linux and Mac OSX).
Interface to serial port devices (only Linux and Mac OSX).
jeebus/serial/serialex
Interface to serial port devices (only Linux and Mac OSX).
Interface to serial port devices (only Linux and Mac OSX).
jeebus/serialproxy/compat
Interface to serial port devices (Linux Mac OSX AND Windows).
Interface to serial port devices (Linux Mac OSX AND Windows).
jeebus/serialproxy/extended
Interface to serial port devices (Linux Mac OSX and Windows).
Interface to serial port devices (Linux Mac OSX and Windows).
jeebus/serialproxy/serialex
Interface to serial port devices (Linux Mac OSX AND Windows).
Interface to serial port devices (Linux Mac OSX AND Windows).
network/mqtt/extended
Package mqtt implements a stub that can replace the inbuilt Jeebus MQTTServer to allow a remote (out of process) MQTT Broker like RabbitMQ or Mosquitto to be used.
Package mqtt implements a stub that can replace the inbuilt Jeebus MQTTServer to allow a remote (out of process) MQTT Broker like RabbitMQ or Mosquitto to be used.
go-helpers
int64utils
Package to supply some []int64 functionality, such as Sort, Inserts.
Package to supply some []int64 functionality, such as Sort, Inserts.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL