xAP CurrentCost

The Current Cost device monitors your electricity usage. The data-stream is available via the Current Cost USB/RS232 dongle which plugs into the Livebox either directly or with a USB Hub. The Livebox USB port is the 'type A' port that is situated beneath the two buttons on the side of the Livebox case. The xap-currentcost daemon reads this data and turns it into an xAP message which then makes it available for data logging and event attachment.

When combined with the pachube component you get all the benefits of the CurrentCost web bridge hardware without the cost. As a bonus you can also monitor sensors; something it can't do.

Current Cost Classic Gen1
The first generation of Current Cost monitors, uses a 2400 baud rate and only includes live data in the XML. No historical data.
Current Cost Classic Gen2
The second generation monitor, uses a 9600 baud rate and includes live and historical XML data as per the CC128 XML specification.
Current Cost Envi (CC-128)
The latest Current Cost monitor, uses a 57600 baud rate and includes live and historical XML data. Support up to 9 additional sensors.
eco-manager.jpg EDF EcoManager
A CurrentCost derivative. Uses a 57600 baud rate and includes live and historical XML data. Support up to 14 additional sensors.

The configuration of this device can be done using the HAH web interface

Both the Classic and the ENVI (CC128) model are supported. The /etc/xap.d/xap-currentcost.ini file contains a 'currentcost' section that contains the configuration parameters.

[currentcost]
enable=1
usbserial=/dev/ttyUSB0
model=CC128

The sensor hysteresis is the amount of Watts that must change before a data value is published to the xAP bus. Having this value >0 prevents event jitter. Note that this hysteresis value is only applied to the 'whole house' sensor.

The xAP message that will be generated by the xap-currentcost daemon is a BSC message where the text is the amount of Watts of electricity being used.

The following endpoints will be dynamically created by the daemon once its XML tag has been seen in the data stream from the CC unit.

ch.1
ch.2
ch.3
ch.total
sensor.1
.
.
sensor.N
temp

With the Envi model up to 3 channels for 3-phase power, or a secondary meter box, can be monitored. These will appear as the endpoints ch.1, ch.2 and ch.3

ch.total is a special endpoint that is automatically created when more then one phase of power (channel) is reported. This endpoint is calculated as ch.1 + ch.2 + ch.3

xAP-header
{
v=12
hop=1
uid=FF00DC01
class=xAPBSC.event
source=dbzoo.livebox.CurrentCost:ch.1
}
input.state
{
state=on
text=551
displaytext=551 watts
}

The CC128 UNIT also has a built-in temperature sensor this will also generate its own xAP message. The units are in degrees Celsius.

xAP-header
{
v=12
hop=1
uid=FF00DC02
class=xAPBSC.event
source=dbzoo.livebox.CurrentCost:temp
}
input.state
{
state=on
text=20.6
displaytext=temp 20.6C
}

Once you have registered an account with Pachube you can configure the service to accept data emitted by the currentcost unit. This allows you to graph and use the information you have collected for other purposes, such as detailed analysis, graphing and trending.

By configuring the xap-pachube daemon this data can be recorded and graphed

Current Cost Sensors

The Current Cost unit can be supplied with a number of sensor inputs. The clamp which is supplied with the unit and additional development boards can supply readings from up to 12 sources.

In addition, Current Cost have now released the Individual Appliance Module (IAM). Each IAM allows a specific electrical device to be tracked.

Sensor 0 is designated the 'whole house' sensor. This will always be present and its value(s) correspond to the reading transmitted by a sensor clamp. Up to 3 clamps maybe present, one for each phase. In this example only a single phase is present (ch1). If the others were there, they would appear as ch2 and ch3.

	<msg>
		<src>CC128-v0.11</src>
		<dsb>00014</dsb>
		<time>17:01:54</time>
		<tmpr>18.7</tmpr>
		<sensor>0</sensor>
		<id>00077</id>
		<type>1</type>
		<ch1>
			<watts>00802</watts>
		</ch1>
	</msg>

The digital boards are literally that, boards, not consumer item.

Additional sensor boards can be connected to the CC unit these may feed back an ANALOGUE or DIGITAL reading. The value does not have to be an electricity reading although in the XML purpose it will still be wrapped in a WATT tag. This can be somewhat confusing.

In this example a simple switch has been connected to act as the digital input source.

5020511621_27e6c788cf.jpg

When you use a digital board you get a 0 for an open circuit and 500 for a closed circuit as the WATTS reading.

	<msg>
		<src>CC128-v0.11</src>
		<dsb>00014</dsb>
		<time>17:05:58</time>
		<tmpr>19.0</tmpr>
		<sensor>5</sensor>
		<type>1</type>
		<ch1>
			<watts>00500</watts>
		</ch1>
	</msg>

Resultant xAP message

xap-header
{
v=12
hop=1
uid=FF00DC0B
class=xAPBSC.event
source=dbzoo.livebox.1.CurrentCost:sensor.1
}
input.state
{
state=on
displaytext=Binary
}

An analogue value can also be supplied by a development board once again the value will be wrapped a WATTS tag so user interpretation must be applied to the value returned. In this example an variable resistor has been attached.

5020510113_8da0fe5a21.jpg

Q. Do you get 3 channels returned from this ?

Resultant xAP message

source=dbzoo.livebox.CurrentCost:sensor.2
}
input.state
{
state=on
text=551
displaytext=551 Ohms
}

Photo credit - KevinT

Buy a (IAM) unit on Amazon.

These are great for a quick setup to monitor a give device.

We've observed that when an attached device is switched off, the reading from the IAM can still show a value of 1 or two watts. On one IAM, this value fluctuated between one and two watts. Annoying, because lots of unwanted xAP messages were being produced by the changing value. Now, it's possible to specify a hysteresis setting for each Current Cost sensor. This solves the problem.

It appears that the IAM sends an update to the CC Envi approximately every 7 seconds.

We've noticed that when you have several IAMs paired with the Envi, it seems to suppress the 'history' element on the XML feed. Perhaps the unit is working too hard to support this?

Troubleshooting

If you want to do some debugging, note that there is a baud rate difference between the models:

  • CC128 - 57600-n-8-1
  • Classic - 9600-n-8-1
  • Original Classic - 2400-8-n-1

Examining the datastream from a Current Cost unit. Shutdown the xap-currentcost daemon first. Then, from a telnet session onto the HAH …

microcom -s 57600 /dev/ttyUSB0

Starting the xap-currentcost daemon in debug mode. There are 7 level of debug. 1 the lower, 7 the highest. You must be at 5 or higher to see the inbound SERIAL data.

xap-currentcost -d 5 -s /dev/ttyUSB0 -i br0

Try using xap-snoop or xFx Viewer to see if any xAP message is being sent on the bus.