Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
PowerHome Programming
 PowerHome Messageboard : PowerHome Programming
Subject Topic: Brultech ECM-1240 SQL Database Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
smarty
Super User
Super User
Avatar

Joined: May 21 2006
Location: United States
Online Status: Offline
Posts: 728
Posted: July 21 2010 at 20:31 | IP Logged Quote smarty

I just got my new Brultech ECM-1240 powermeter connected to my service panel. I can now see individual circuit loads (like Spa, AC1, AC2, oven etc)

I am hoping to find ways to have PH "respond" to the varying wattage levels as electrical loads vary.

For example, I would love to be able to have PowerHome totalize the AC runtime each day. By knowing the outside temp and humidity, I could calculate AC effectivness and judge this over time (know if your compressor is starting to get low on refrigerant etc).

Anyway, the ECM-1240 stores its data is a SQL database composed of only 4 tables (the structure looks very understandable when viewed with a DB viewer- I use SQLite Database Viewer).

My question is this: Is there anyway to use PH's multi-editor to pull information from the ECM-1240 database? If so, I would love to see an example SQL macro/command sequence.

If PH can do this, I am planning to use the "file change" plug-in to sense when the database has been updated and then to trigger whatever SQL based "macro" is needed to pull out the information I specify. My only problem is that I DON'T KNOW SQL.

Anyone have any thoughts on this topic?

__________________
Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
Back to Top View smarty's Profile Search for other posts by smarty
 
smarty
Super User
Super User
Avatar

Joined: May 21 2006
Location: United States
Online Status: Offline
Posts: 728
Posted: July 22 2010 at 16:41 | IP Logged Quote smarty

....NEW APPROACH....

The ECM-1240 does have a option to "Forward Data" via TCP/IP and a PORT number. See the picture below.



When I use a port sniffer to see what the Brultech ECM-1240 is sending out, I can see the following information:



I can see all the data being sent out every 3 seconds (3 seconds is configurable). Cool!!!!

Now, is there a way to maybe use the UDP plugin to trigger when new data is sent out? and then get the data into PH.

I have not been able to set up the UDP Listener plugin. Does anyone know how to set it up? I am not sure how to set up the configuration file for the plugin.

Comments???/Help???

__________________
Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
Back to Top View smarty's Profile Search for other posts by smarty
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: July 23 2010 at 12:52 | IP Logged Quote dhoward

Smarty,

Taking a look at the screenshots, I would think you would get the best results by using the PH Socket plugin. I don't see anything in the screenshots that the Brultech is actually sending UDP broadcasts and it appears to be more of a point to point TCP connection.

As such, it should be very simple to setup and give it a try. From the help file, here is the documentation on the PH Socket plugin:

Code:

Raw Socket
Launch Data (ActiveX Classname): PH_Socket.phsocket
Initialization Data: The IP address to connect to, a space, the port to connect to. Can also be left blank to connect manually after launch

This plugin provides raw socket connectivity for PowerHome. If an IP and port is supplied in the Init Data, then a connection will be established when the plugin is loaded. Otherwise, you can initiate a connection manually using the ph_picmd function. This plugin supports several commands via the ph_picmd function. Command 1 will cause the plugin to send the data in the data3 parameter over the socket if a connection is established. Command 2 will establish a connection manually to the IP in the data3 parameter and the port in the data1 parameter (you must not be currently connected). Command 3 will disconnect the socket if it's currently connected. Command 4 will return the status of the current connection (0 = connected, 1 = not connected). Command 5 returns the current remote IP of the socket. Command 6 returns the remote port of the socket.
The plugin will also fire generic plugin triggers. The trigger for command 1, option 1 will be fired when data is received on the socket. The trigger for command 1, option 2 will be fired when the socket establishes a connection. The trigger for command 1, option 3 will be fired when the socket disconnects.


You won't be sending any TCP data via the ph_picmd function and will instead just create a generic plugin trigger for command 1, option 1. Use one of the macros or formulas that displays all of the Local and Temp variables to determine which one contains the data you're interested in.

Im very interested in hearing how all this works out so please post your results.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
smarty
Super User
Super User
Avatar

Joined: May 21 2006
Location: United States
Online Status: Offline
Posts: 728
Posted: July 23 2010 at 16:56 | IP Logged Quote smarty

Dave,
Great to hear that things are working out, and great to have you back!

Yes, the Raw Socket plugin did the trick.

A trigger off this plugin with command 1, option 1, triggers each time the ECM-1240 sends out data.

The [TEMP] variables contain all the passed information.

For others to reference, I use a formula button for viewing all the [TEMP] variables when the trigger fires:

ph_usermessage("temp1= " + ph_getvar_s(2,1) + " temp2= " + ph_getvar_s(2,2) + " temp3= " + ph_getvar_s(2,3) + " temp4= " + ph_getvar_s(2,4) + " temp5= " + ph_getvar_s(2,5) + " temp6= " + ph_getvar_s(2,6) + " temp7= " + ph_getvar_s(2,7) + " temp8= " + ph_getvar_s(2,8) + " temp9= " + ph_getvar_s(2,9) + " temp10= " + ph_getvar_s(2,10))

From this formula, you will end up with:

temp1= 2 temp2= 0 temp3= 259 temp4= 7080 temp5= CH1PAa=1082&CH2PAa=2&CH1PPa=1082&CH2PPa=1&CH1Aa=9.2&CH2Aa=0. 3&Paux1a=6&Paux2a=1001&Paux3a=0&Paux4a=0&Paux5a=0&KWhCH1a=34 1.05&KWhCH2a=0.693&KWhAux1a=25.432&KWhAux2a=81.587&KWhAux3a= 0.358&KWhAux4a=90.042&KWhAux5a=0.035&Timea=08:18:38&Volta=25 0.2&DevSNa=205744 temp6= 27 temp7= RAWSOCKET temp8= 1 temp9= 1 temp10= 192.168.0.106

You can see that "temp5" is where all the data of interest resides.

I then use ph_regexdiff to extract out the data from [TEMP5].

WaHoo!!! PowerHome can now understand and act off my home power consumption. GOOD STUFF!!!

Edited by smarty - July 23 2010 at 17:03


__________________
Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
Back to Top View smarty's Profile Search for other posts by smarty
 
dhoward
Admin Group
Admin Group
Avatar

Joined: June 29 2001
Location: United States
Online Status: Offline
Posts: 4447
Posted: July 23 2010 at 21:39 | IP Logged Quote dhoward

Smarty,

Awesome! Glad the Socket plugin did the trick. I was going to suggest using one of the regex functions to extract the data but see you're way ahead of me.

Ive been interested in monitoring my power consumption for a loonnng time (primarily concerned with instantaneous kwh being drawn from the entire house) so was very interested when I saw your post. Im not even sure what kind of hardware will do what I want but will do some research on the Brultech to see if it will fill the bill for me.

Dave.
Back to Top View dhoward's Profile Search for other posts by dhoward Visit dhoward's Homepage
 
smarty
Super User
Super User
Avatar

Joined: May 21 2006
Location: United States
Online Status: Offline
Posts: 728
Posted: July 24 2010 at 09:52 | IP Logged Quote smarty

The ECM-1240 can monitors 7 channels/circuits, 2 of which could be net (production minus consumption) power. Units can be "stacked" such that additional circuits can be measured (7/unit). It measures true, load factor power.

Presently, it seems a fair number of "cocooners" think that this meter is one of the better ones available, (price is fairly reasonable as well).

Here is their link:

Webpage

Steve



__________________
Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
Back to Top View smarty's Profile Search for other posts by smarty
 
PCarp
Newbie
Newbie
Avatar

Joined: June 21 2011
Location: United States
Online Status: Offline
Posts: 16
Posted: June 21 2011 at 23:41 | IP Logged Quote PCarp

How is the ph_regexdiff statement formatted to extract the
information in temp5= ?

Thanks
Paul



Edited by PCarp - June 22 2011 at 23:06
Back to Top View PCarp's Profile Search for other posts by PCarp
 
smarty
Super User
Super User
Avatar

Joined: May 21 2006
Location: United States
Online Status: Offline
Posts: 728
Posted: June 23 2011 at 09:51 | IP Logged Quote smarty

See the zipped macro that I exported. Hope this helps.2011-06-23_095326_ECM-1240.zip

Edited by smarty - June 23 2011 at 09:53


__________________
Elk - Insteon - BlueIris - DMC1 - PowerHome - XLobby - HA_Bridge w/Dots - Brultech
Back to Top View smarty's Profile Search for other posts by smarty
 
PCarp
Newbie
Newbie
Avatar

Joined: June 21 2011
Location: United States
Online Status: Offline
Posts: 16
Posted: June 23 2011 at 10:42 | IP Logged Quote PCarp

Smarty,

Thanks for the information, after looking at the macro I can see why I was having problems.

I will be able to try it out this evening.

Thanks
Paul
Back to Top View PCarp's Profile Search for other posts by PCarp
 
PCarp
Newbie
Newbie
Avatar

Joined: June 21 2011
Location: United States
Online Status: Offline
Posts: 16
Posted: June 25 2011 at 20:18 | IP Logged Quote PCarp

Smarty,

The macro cleared up my problems. I am able now to import the ECM-1240 data into PowerHome.

I am waiting on a couple more ECM-1240 devices to finish up the project. Apparently Canada has a postal strike going on currently so I am not sure when I will be able to complete it.

Thanks
Paul
Back to Top View PCarp's Profile Search for other posts by PCarp
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum