[OpenTRV-dev] opentrv to emoncms

Bo Herrmannsen bo.herrmannsen at gmail.com
Thu May 7 22:07:18 BST 2015


i have gathered the spare opentrv module and found an extra ftdi cable so
should be good to go,

will try and do this in the weekend and take notes so i can replicate it
once i have reformatted the harddrive attached to the pi

asked damon how to setup the opentrv so it's a "listen only" board.... he
is sure busy as hell so might not be before tomorrow i get an reply

2015-05-07 20:10 GMT+02:00 Aideen McConville <aideen at amcc.myzen.co.uk>:

> and...
>
> It shouldn't be necessary to run node-red as super user.
>
> To get access to serial devices, add your logged in user to the dialout
> group,
>
> $ sudo adduser your-user-id dialout
>
> then logout and login again.
>
> Aideen
>
>
> On 7 May 2015, at 19:03, Aideen McConville <aideen at amcc.myzen.co.uk>
> wrote:
>
> PS I would use the definitive installation instructions from:
>
> http://nodered.org/docs/hardware/raspberrypi.html
>
> Aideen
>
>
> On 7 May 2015, at 16:47, "Aideen McConville" <aideen at amcc.myzen.co.uk>
> wrote:
>
> Yes, that looks like a great starting point.
>
>
>
> You'll need to do a bit of parsing within Node-Red processing blocks. The
> switch node (block) is good for a bit of easy pre-processing.
>
>
>
> Dom Brambley's posts will be helpful too:
>
>
>
> https://www.ibm.com/developerworks/community/blogs/B-Fool/?lang=en
>
>
>
>
>
> *From:* opentrv-dev-bounces at lists.opentrv.org.uk [
> mailto:opentrv-dev-bounces at lists.opentrv.org.uk
> <opentrv-dev-bounces at lists.opentrv.org.uk>] *On Behalf Of *Bo Herrmannsen
> *Sent:* 07 May 2015 16:36
> *To:* Closed list for developer discussions
> *Subject:* Re: [OpenTRV-dev] opentrv to emoncms
>
>
>
> unless i'm mistaken this link has a recipe i could use:
>
>
>
> the current cost part:
> https://jonathanleach1.wordpress.com/2014/02/16/node-red/
>
>
>
> it says that node-red has a direct serial input block...
>
>
>
> my thought now is to take one string in... look for house code for say
> kitchen, and if that code is there....
>
>
>
> then i'm a bit lost yet on how to split up the entire string so that i can
> send off the data to emoncms
>
>
>
> might get it when i have looked a bit more at it....
>
>
>
>
>
> 2015-05-07 16:56 GMT+02:00 Aideen McConville <aideen at amcc.myzen.co.uk>:
>
> Sending data to emonCMS looks like:
>
>
>
>
> http://host/emoncms/input/post.json?json={cc-watts:200,cc-temp:22.5}&apikey=
> …..
>
>
>
> or (since emonCMS version 8.4.?)
>
>
>
>
> http://host/emoncms/input/post.json?node=1&json={cc-watts:200,cc-temp:22.5}&apikey=
> …..
>
>
>
> Currently, with the Conrad units, there's only an idea of house codes,
> rather than individual node codes (I think). You could improvise by setting
> different frost values to differentiate different units
>
>
>
> Ideally, use MQTT early in the mix with a tree structure like
>
> house/opentrv/study/temp
>
> house/opentrv/study/light
>
> house/opentrv/bedroom1/temp
>
> house/emonTx/watts
>
> house/emonTx/pipetemp
>
> etc
>
>
>
> Node-Red makes it easy to connect these things with minimal coding. It is
> well versed in the ways of MQTT, JSON and even emonCMS so lots of examples
> out there (but still with a degree of flux between versions).
>
>
>
> Having several Pi's is power for the course :-)
>
>
>
> *From:* opentrv-dev-bounces at lists.opentrv.org.uk [mailto:
> opentrv-dev-bounces at lists.opentrv.org.uk] *On Behalf Of *Bo Herrmannsen
> *Sent:* 07 May 2015 15:29
> *To:* Closed list for developer discussions
> *Subject:* Re: [OpenTRV-dev] opentrv to emoncms
>
>
>
> hmm
>
>
>
> my idea so far...:
>
>
>
> i have one spare usb port left... use that with and ftdi and extend the
> serial plug so i could wall mount an OpenTRV and use that one to collect
> the data from all the others.
>
>
>
> could the perl example be used to forward the data so they show up in
> emoncms as individual nodes? or how does it work?
>
>
>
> 2015-05-07 16:07 GMT+02:00 Aideen McConville <aideen at amcc.myzen.co.uk>:
>
> Hi Bo,
>
>
>
> I too am interested in collecting data from OpenTRV, OpenEnergyMonitor
> (oem) and other sensors and wrangling it as required (e.g. sending to
> emonCMS and other possible stores/dashboards).
>
>
>
> Rather than modify (and complexify!) the code in individual sensor nodes,
> I am planning to use a central node to receive, store and forward data
> (e.g. using MQTT and Node-Red). It's fairly easy to send data from any
> sensor to emonCMS using oem's input API and the same techniques can be
> useful for the oem sensors themselves (emonTx and emonTH). I can provide a
> simple Perl example on request (sends Currentcost energy meter serial data
> to emonCMS).
>
>
>
> One OpenTRV unit could act as an interim (RFMxx) gateway - listening for
> data from other "busier" units and forwarding it to the main gateway (e.g.
> via a FTDI - USB link to a mini wireless router or Raspberry Pi).
>
>
>
> I currently have one OpenTRV Rev2 board (r4111) talking to a Conrad valve
> drive. It is connected to, and powered by, the USB port of a micro TP-Link
> router via FTDI (same USB BUB as used to talk to Jeenodes and oem units).
> The TP-Link router is running OpenWRT (embedded Linux) and has some USB
> tools and the Mosquitto client software installed (further details on
> request). A Raspberry Pi would work just as well.
>
>
>
> To "see" the serial data from the OpenTRV board, I just need to logon to
> the router and type:
>
>
>
> # stty -F /dev/ttyUSB0 4800 raw -echo
>
>
>
> # cat < /dev/ttyUSB0
>
>
>
> A further step: to remove the ">" lines from the output and pass the rest
> on to a Mosquitto broker (running elsewhere on the network):
> <%22%20lines%20from%20the%20output%20and%20pass%20the%20rest%20on%20to%20a%20Mosquitto%20broker%20(running%20elsewhere%20on%20the%20network):%0d%C2%A0%0d#+awk+'NF+%3E+1'+/dev/ttyUSB0+%7C+mosquitto_pub+-l+-h+192.168.1.112+-t+'house/opentrv/lab'%0D%C2%A0%0DI+can+then+see+the+data+on+a+beefier+linux+box+(one+with+a+hard+drive!)+running+the+broker:%0D%C2%A0%0D$+mosquitto_sub+-t+'house/%23'%0D:%0DFHT8V+TX%0D=F0>
>
>
> <%22%20lines%20from%20the%20output%20and%20pass%20the%20rest%20on%20to%20a%20Mosquitto%20broker%20(running%20elsewhere%20on%20the%20network):%0d%C2%A0%0d#+awk+'NF+%3E+1'+/dev/ttyUSB0+%7C+mosquitto_pub+-l+-h+192.168.1.112+-t+'house/opentrv/lab'%0D%C2%A0%0DI+can+then+see+the+data+on+a+beefier+linux+box+(one+with+a+hard+drive!)+running+the+broker:%0D%C2%A0%0D$+mosquitto_sub+-t+'house/%23'%0D:%0DFHT8V+TX%0D=F0>
>
> # awk 'NF > 1' /dev/ttyUSB0 | mosquitto_pub -l -h 192.168.1.112 -t
> 'house/opentrv/lab'
> <%22%20lines%20from%20the%20output%20and%20pass%20the%20rest%20on%20to%20a%20Mosquitto%20broker%20(running%20elsewhere%20on%20the%20network):%0d%C2%A0%0d#+awk+'NF+%3E+1'+/dev/ttyUSB0+%7C+mosquitto_pub+-l+-h+192.168.1.112+-t+'house/opentrv/lab'%0D%C2%A0%0DI+can+then+see+the+data+on+a+beefier+linux+box+(one+with+a+hard+drive!)+running+the+broker:%0D%C2%A0%0D$+mosquitto_sub+-t+'house/%23'%0D:%0DFHT8V+TX%0D=F0>
>
>
> <%22%20lines%20from%20the%20output%20and%20pass%20the%20rest%20on%20to%20a%20Mosquitto%20broker%20(running%20elsewhere%20on%20the%20network):%0d%C2%A0%0d#+awk+'NF+%3E+1'+/dev/ttyUSB0+%7C+mosquitto_pub+-l+-h+192.168.1.112+-t+'house/opentrv/lab'%0D%C2%A0%0DI+can+then+see+the+data+on+a+beefier+linux+box+(one+with+a+hard+drive!)+running+the+broker:%0D%C2%A0%0D$+mosquitto_sub+-t+'house/%23'%0D:%0DFHT8V+TX%0D=F0>
>
> I can then see the data on a beefier linux box (one with a hard drive!)
> running the broker:
> <%22%20lines%20from%20the%20output%20and%20pass%20the%20rest%20on%20to%20a%20Mosquitto%20broker%20(running%20elsewhere%20on%20the%20network):%0d%C2%A0%0d#+awk+'NF+%3E+1'+/dev/ttyUSB0+%7C+mosquitto_pub+-l+-h+192.168.1.112+-t+'house/opentrv/lab'%0D%C2%A0%0DI+can+then+see+the+data+on+a+beefier+linux+box+(one+with+a+hard+drive!)+running+the+broker:%0D%C2%A0%0D$+mosquitto_sub+-t+'house/%23'%0D:%0DFHT8V+TX%0D=F0>
>
>
> <%22%20lines%20from%20the%20output%20and%20pass%20the%20rest%20on%20to%20a%20Mosquitto%20broker%20(running%20elsewhere%20on%20the%20network):%0d%C2%A0%0d#+awk+'NF+%3E+1'+/dev/ttyUSB0+%7C+mosquitto_pub+-l+-h+192.168.1.112+-t+'house/opentrv/lab'%0D%C2%A0%0DI+can+then+see+the+data+on+a+beefier+linux+box+(one+with+a+hard+drive!)+running+the+broker:%0D%C2%A0%0D$+mosquitto_sub+-t+'house/%23'%0D:%0DFHT8V+TX%0D=F0>
>
> $ mosquitto_sub -t 'house/#'
> <%22%20lines%20from%20the%20output%20and%20pass%20the%20rest%20on%20to%20a%20Mosquitto%20broker%20(running%20elsewhere%20on%20the%20network):%0d%C2%A0%0d#+awk+'NF+%3E+1'+/dev/ttyUSB0+%7C+mosquitto_pub+-l+-h+192.168.1.112+-t+'house/opentrv/lab'%0D%C2%A0%0DI+can+then+see+the+data+on+a+beefier+linux+box+(one+with+a+hard+drive!)+running+the+broker:%0D%C2%A0%0D$+mosquitto_sub+-t+'house/%23'%0D:%0DFHT8V+TX%0D=F0>
>
> :
> <%22%20lines%20from%20the%20output%20and%20pass%20the%20rest%20on%20to%20a%20Mosquitto%20broker%20(running%20elsewhere%20on%20the%20network):%0d%C2%A0%0d#+awk+'NF+%3E+1'+/dev/ttyUSB0+%7C+mosquitto_pub+-l+-h+192.168.1.112+-t+'house/opentrv/lab'%0D%C2%A0%0DI+can+then+see+the+data+on+a+beefier+linux+box+(one+with+a+hard+drive!)+running+the+broker:%0D%C2%A0%0D$+mosquitto_sub+-t+'house/%23'%0D:%0DFHT8V+TX%0D=F0>
>
> FHT8V TX
> <%22%20lines%20from%20the%20output%20and%20pass%20the%20rest%20on%20to%20a%20Mosquitto%20broker%20(running%20elsewhere%20on%20the%20network):%0d%C2%A0%0d#+awk+'NF+%3E+1'+/dev/ttyUSB0+%7C+mosquitto_pub+-l+-h+192.168.1.112+-t+'house/opentrv/lab'%0D%C2%A0%0DI+can+then+see+the+data+on+a+beefier+linux+box+(one+with+a+hard+drive!)+running+the+broker:%0D%C2%A0%0D$+mosquitto_sub+-t+'house/%23'%0D:%0DFHT8V+TX%0D=F0>
>
> =F0%@20C4;T6 1 W255 0 F255 0 W255 0 F255 0;S12 12 21;HC18
> 11;{"@":"120b","L":235,"B|mV":3332,"occ|%":0,"vC|%":0}
> <%22%20lines%20from%20the%20output%20and%20pass%20the%20rest%20on%20to%20a%20Mosquitto%20broker%20(running%20elsewhere%20on%20the%20network):%0d%C2%A0%0d#+awk+'NF+%3E+1'+/dev/ttyUSB0+%7C+mosquitto_pub+-l+-h+192.168.1.112+-t+'house/opentrv/lab'%0D%C2%A0%0DI+can+then+see+the+data+on+a+beefier+linux+box+(one+with+a+hard+drive!)+running+the+broker:%0D%C2%A0%0D$+mosquitto_sub+-t+'house/%23'%0D:%0DFHT8V+TX%0D=F0>
>
> FHT8V TX
>
> FHT8V TX
>
> =F0%@20C5;T6 5 W255 0 F255 0 W255 0 F255 0;S12 12 21;HC18
> 11;{"@":"120b","L":234,"B|mV":3332,"occ|%":0,"vC|%":0}
>
> FHT8V TX
>
> =F0%@20C5;T6 9 W255 0 F255 0 W255 0 F255 0;S12 12 21;HC18
> 11;{"@":"120b","L":234,"B|mV":3332,"occ|%":0,"vC|%":0}
>
> FHT8V TX
>
> FHT8V TX
>
> :
>
>
>
> Not sure if this helps with your quest, but if any particlar details are
> of interest, let me know.
>
>
>
> Aideen
>
>
>
> *From:* opentrv-dev-bounces at lists.opentrv.org.uk [mailto:
> opentrv-dev-bounces at lists.opentrv.org.uk] *On Behalf Of *Bo Herrmannsen
> *Sent:* 05 May 2015 12:11
> *To:* Closed list for developer discussions
> *Subject:* [OpenTRV-dev] opentrv to emoncms
>
>
>
> hi again
>
>
>
> i'm going to fiddle with my bed-roller server box and i wanted to add data
> from the OpenTRV units
>
>
>
>
>
> 2 ways i can think of it
>
>
>
>
>
> 1) Each Opentrv board sends the data to emoncms... they at least work on
> the same freq, but they dont use the same module,... latest rfm lib that
> emontx boards use are updated to be able to use rfm69 but i think their
> boards are still shipped with rfm12 or was it  22....
>
>
>
> anyways my idea was to send commands to the valve, then to emoncms... then
> sleep for the 2 mins or so
>
>
>
>
>
> 2) have one emontx board grap the data it needs from one Opentrv board
> that again wireless gets data from the others.... i have 2 emontx boards
> and one opentrv at my hot water cylinder...
>
>
>
> one of the emontx boards allready gets data from the heatmeter via an IR
> optical serial port
>
>
>
> the other one only monitors my water meter so most of the time it will
> just sit there idle and just report 0 water usage to the emoncms system...
> i think this one will be mostly suited
>
>
>
> right now that board only sends over 2 numbers
>
>
>
> 1) liters an hour
>
> 2) clicks since last reading (liters)
>
>
>
> it reports to emoncms every 4 sec
>
>
>
> so for each opentrv i just need to collect and add:
>
>
>
> 1)battery voltage
>
> 2)temp
>
> 3)light level
>
> 4)valve open %
>
>
>
> i have attached 2 files... one for each of the emontx boards
>
>
>
> the small file is the one for the water meter and the other is for the
> heatmeater, electricity pulse, and hotwater temp...
>
>
>
> my idea is to add something to the watermeter skecth that can grab serial
> data and pick what is needed... i just dont have any clue how.. also the
> serial data from the opentrv must be in the same order or the emontx will
> start to report false data.... maybe have the opentrv buffer the data and
> just update the output when new values are there?
>
>
>
> anyone have idea or could help out?
>
>
>
> the zip file is the sketch for my opentrv that controls the hot water
>
>
>
>
> _______________________________________________
> OpenTRV-dev mailing list
> OpenTRV-dev at lists.opentrv.org.uk
> http://lists.opentrv.org.uk/listinfo/opentrv-dev
>
>
>
>
> _______________________________________________
> OpenTRV-dev mailing list
> OpenTRV-dev at lists.opentrv.org.uk
> http://lists.opentrv.org.uk/listinfo/opentrv-dev
>
>
>
> _______________________________________________
> OpenTRV-dev mailing list
> OpenTRV-dev at lists.opentrv.org.uk
> http://lists.opentrv.org.uk/listinfo/opentrv-dev
>
> _______________________________________________
> OpenTRV-dev mailing list
> OpenTRV-dev at lists.opentrv.org.uk
> http://lists.opentrv.org.uk/listinfo/opentrv-dev
>
>
> _______________________________________________
> OpenTRV-dev mailing list
> OpenTRV-dev at lists.opentrv.org.uk
> http://lists.opentrv.org.uk/listinfo/opentrv-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opentrv.org.uk/pipermail/opentrv-dev/attachments/20150507/2bec699e/attachment-0001.html>


More information about the OpenTRV-dev mailing list