CurrentCost Component for Home Assistant

Thanks for the feedback. Glad to know it’s now working :wink:

To answer your previous question to how did I install the current cost component, it was originally manually installed then updated using HACS.
Can you tell me why I have channel 1,2 & 3
Appliance 1 & Channel 1 are the Envi main screen which is actually appliance 0
Then I have 2 IAMS setup on the Envi appliance 1 & 2

From Developer Tools
sensor.current_cost
Temperature: 19.9 ºC
Appliance 0: 208 W
Appliance 1: 10 W
Appliance 2: 5 W
Appliance 3: null
Appliance 4: null
Appliance 5: null
Appliance 6: null
Appliance 7: null
Appliance 8: null
Appliance 9: null
Channel 1: 208 W
Channel 2: 0 W
Channel 3: 0 W
unit_of_measurement: W
friendly_name: Current Cost
icon: mdi:flash-circle
device_class: power

From Configuration.yaml

  - platform: currentcost
    serial_port: /dev/serial/by-id/usb-Prolific_Technology_Inc._USB-Serial_Controller-if00-port0
    name: Current Cost
    baudrate: 57600
    devices:
      - 0
      - 1
      - 2
      - 3
      - 4
      - 5
      - 6
      - 7
      - 8
      - 9
  - platform: template
    sensors:
      currentcost_temperature:
        entity_id: sensor.current_cost
        unit_of_measurement: '°C'
        value_template: '{{ state_attr("sensor.current_cost", "Temperature")[:-3] | float }}'
        friendly_name: CurrentCost Temperature
      currentcost_power:
        entity_id: sensor.current_cost
        unit_of_measurement: 'w'
        value_template: '{{ state_attr("sensor.current_cost", "Appliance 0")[:-2] | int }}'
        friendly_name: CurrentCost Power
      currentcost_1:
        entity_id: sensor.current_cost
        unit_of_measurement: 'w'
        value_template: '{{ state_attr("sensor.current_cost", "Appliance 1")[:-2] | int }}'
        friendly_name: CurrentCost 1
      currentcost_2:
        entity_id: sensor.current_cost
        unit_of_measurement: 'w'
        value_template: '{{ state_attr("sensor.current_cost", "Appliance 2")[:-2] | int }}'
        friendly_name: CurrentCost 2````

You have 3 possible channels on your EnviR.
You’re currently only using Channel 1, to 208W in total
Appliance 0 is the total consumption, so also 208W
You then have you 2 additional IAMs on Channel 1, Appliance 1 and Channel 1, Appliance 2 respectively.
Hope this makes sense

To sound rather THICK, No!
I don’t get the Channel 1, Appliance 1 & 2
I’ve used this equipment for many years, long before HA and was only ever aware of Appliances 0 - 9 and I could pair any transmitter to any appliance
Is this something you have implemented as you have developed the component or something I have missed from day 1?
Ah!, I think I might have just grasped it, is it to do with single phase power or 3 phase power and the 3 lightning symbols on the Envi display

That would probably be it.
I also only have Channel 1 in use, and to be honest not tried to plug the clamp in a different socket (there are 3).
The channel info comes from the data on the serial port connection so I’m just displaying it…

You must be using the older / larger transmitter that has 3 sockets (D cell batteries) myself & my daughter are using the smaller transmitters that have 1 RJ connector socket (C cell batteries) I do have some of the type you have but they are currently unused.
On my system I’m not using current clamps, I’m using 2 OptiSmarts (1 for solar & 1 for electric) & 1 GaSmart (gas)
I only have a current clamp on the electric at my daughters house. They do have 2 smart meters but I’m not sure on compatibility of equipment with them for HA. I would love to get there gas into HA so I can make a direct comparison to my own household usage.
It seems impossible to get hold of the OptiSmart & GaSmart sensors anymore but Envi’s, EnviR’s & current clamps are regularly available on ebay. Even IAM’s come up for sale now & again.

Hi this project is going great but I found a bit of an issue with the device itself. I went looking for a leak and I found one. I’ve recently bought some Gosund metering plugs and I found I was using more power than they calculated I basically cut out all but two outlets being monitored by the gosund (they are flashed to tasmota) At this point they measured 75 watts and the current cost was measuring 150 watts Part of the reason is the VA which was 125VA for 75 watts which gives a powerfactor of 0.6 ok so that explained 50 watts of difference. but still left 25 watts then I found this manual http://www.currentcost.com/download/CurrentCost%20EnviR%20Man-Singles.pdf The clamp measures current in the meter tail but to calculate watts it multiplys current by 240 volts to get watts. Currently my mains supply seems to be 228Volts it was 230 Volts earlier a bit of math and the difference in power on a 150 watts is about 10 watts. The clamp meter can be tuned according to this manual from 200 - 260 volts in 10 volt steps.

I was thinking it might be better to do a fix in software maybe (power / 240) x 230 = actual VA or the current supply voltage. Maybe this could be done in the current cost integration. Using a constant or a metered voltage.

Looks like quite a lot of devices have poor power factors , I don’t know who wins the consumer or the electricity board.

I just found this review of the current cost meter on Amazon and it really sums up the issues with this meter or maybe indicator is more apt.
strictly speaking it measures current and multiplys by voltage to get a value which is not watts but VA W= VA * pf when I went hunting for missing Watts I calibrated as best I could my Gosund power metering sockets with an incandescent bulb of 52 watts with this load the power factor was 1 and my socket meter agreed it giving WVA pf frequrency and power used. This is how I found most of my loads were switched mode PSU’s with little power correction. I went to the breaker box and got down to two circuits with a gsund measuring each circuit the Watts added up to 75 the VA was 125 and Power factor 0.6 CurrentCost was steady at 150 watts I was still short 25 watts. I then found in an old manual that the current cost meter is set at 240 volts by default (it can be tuned to give between 200 - 260 in 10 volt steps) with Ireland being based on 230 volt that gave maybe another 10 watts and I think 15 watts can be metering error , voltage and frequency variation. Not bad really.

The current cost meter was designed to indicate how much power you were using, relatively. I think it achieves that goal, it doesn’t tell you figures that allow you to calculate your bill but the figures are going to be high so not more than you expect. In the context of home assistant it does give you an idea of when you want to run your more demanding loads e.g when fossil fuel is low and so are CO2 emmissions Anyway 10 years ago AW had these meters sussed out.



A. W.

3.0 out of 5 stars Power Factor Problems

Reviewed in the United Kingdom on 29 September 2011

Verified Purchase

The unit is easy to install, and will quickly show you how much apparent power your house is using, but unfortunately that’s not what you’re billed for in the UK.

The included software is terrible, and the statistical aggregation on the unit doesn’t allow for Generation, so it’s not terribly useful for solar either (though it will at least log it as an appliance, appearing as usage rather than generation).

Because of power factor issues, it will accumulate usage that simply does not exist. For instance, my solar inverter appears to use 80W at night, and there’s no way to exclude this. The unit streams data out on a data cable, which is good, and dumps it’s history on every odd hour of the day. However, it does include the phantom current.

The samples in the unit are timestamped, but there is no date, and the clock stops when you are in any setup menus, or downloading on demand.

Individual appliance monitors report real power instead of apparent power, which lets you get a measure of how much it’s really costing for an appliance, but the whole house reading is always too high (unless everything in your house has a power factor of 1.0, which it won’t).

Take the results with a pinch of salt. This and most other clamp meters will behave the same way. For example, dimming lights on a standard dimmer switch makes your meter move slower, but this unit will not show any significant decrease power consumption when you do so.

That said, the unit does let you see when someone’s left their hair straighteners or PC on, so it may save you some money in the long run.

In addition, compared to the Bluetooth unit for my solar PV inverter, the entire system (this, 1 appliance unit, and 3 clamps) is still cheaper than that option.

Thanks. I agree with the above and although I recently updated the component to make it chinoiseries with the new energy feature in HA as well as extract some of the historical data, I do take the readings with a pinch of salt. Indeed clamp meters week never be 100% accurate.
I’ve already ordered parts to build an home assistant glow and read off the flashing led on the meter. This not only should be more accurate but it will also allow me to track gas usage.

It is in proportion to your electricity usage thou it just needs some conditioning.

There are 2 sources for error the voltage and the power factor and that can be calculated from a power monitoring plug so if i have va of 125 and w of 75 then pf = 0.6 and voltage of 230 instead of 240 about .96 then that gives 0.576 so the current cost figure of 150va is actually more like 86.4 real watts It’s not perfect but it is close.

With the power readings corrected my power usage seems to vary about a couple of units a day or about 30 cents so even with inaccuracy its still going to be accurate to within 10 euro a month. So really all thats needed is a figure to convert the current cost value of VA into a real watts value. this could be a helper float or measured from a socket sensor value or even aggregate values .

I just realised that there is a problem with this solution unmeasured resistive loads e.g an electric shower would be resistive and a large proportion of the load. which kinda means splitting the measured loads from the unmeasured but thats math really.

I take it you meant to achieve this via a template sensor, not a request for a change request for the component right?

It’s a bit complicated isn’t it :slight_smile: The Current Cost is reporting VA not Watts assuming 240V supply if the supply is less then VA is over estimated. So the real VA figure should be a fraction of the reported VA e.g actual VA = VA * (actual V / 240) if thats 230 instead of 240 then its about 0.96 .

A simple correction might be to measure the KWH recorded on the meter over a time period and the KWH recorded by current cost and adjust the value to suit e.g if the meter records 180 kwh and current cost 240 then 0.75 would be a figure to use. It won’t always be right but it would probably make the figures closer.

That could be enough.

The other way would be to subtract known VA values and wattages from the current cost value assume the unknown is resistive e.g Shower, Cooker your wired appliances. say a reading might be 1500 and known VA = 400 then 1100 + the correct values in watts say 300 (but might be anywhere from 200 - 400 depending what was plugged in) giving a figure thats more like 1400VA which would be close to 1400 watts actually being used.

I don’t know enough to know if that can be achieved with templating. I will learn thou.

Just discovered google mini’s seem to have a hidden key word feature.
e.g
hey google turn on the study lamp results in 1 light and 3 outlets turning on
hey google turn on the f&*king study light results in 1 light turning on.
seriously that works, but I don’t know why.

cheers

john

Yeah it can. Have a look at the doc for the current cost custom component, you’ll see an example of how 3 degrees can be subtracted from the temperature attribute.
You can just as easily change the value template to a multiplication or a combination of both:

template:
  - sensor:
      - name: "CurrentCost Temperature"
        unit_of_measurement: '°C'
        state: '{{ state_attr("sensor.current_cost", "Temperature") | float -3 }}' # Manual adjustment of -3°C in case the temp sensor is high than real temperature
        device_class: temperature

template:

  - sensor:
      - name: "CurrentCost Power"
        unit_of_measurement: 'W'
        state: '{{ state_attr("sensor.current_cost", "Appliance 0") | float * 0.466  }}'
        device_class: power
        state_class: measurement

This makes the figures match close enough when just office or hall are running but then I make a cup of coffee and the kettle runs at 1.75KW and the adjusted figure is now about 1KW intotal although it only runs for about 3 minutes (about 0.085KWH).

I created a history graph of my gosund voltages energy0x_voltage and they vary quite a bit. My Air fryer is showing 239 volts most are about 231/232V and a couple at 230 volts. This might be a calibration issue.

Is it possible to use the state of another devices attribute to modify the value in a template e.g energy01_voltage (eg 232V) so multiply by 232/240
so then the voltage would auto correct the VA read from the current cost meter?

Absolutely. you can do pretty much anything you want with a template. Have fun :slight_smile:

1 Like

Fun :slight_smile: I finally got realtime pf working.


  - sensor:
      - name: "CurrentCost Power"
        unit_of_measurement: 'W'
        state: '{{ state_attr("sensor.current_cost", "Appliance 0") | float * states("sensor.mypf") | float }}'
        device_class: power
        state_class: measurement
#  - sensor:
#      - name: "Dehumidifier Power"
#        unit_of_measurement: 'W'
#        state: '{{ state_attr("sensor.current_cost", "Appliance 2") }}'
#        device_class: power
#        state_class: measurement
  - sensor:
      name: "mypf"
      unit_of_measurement: 'W'
      device_class: power
      state_class: measurement
      state: '{{ (states("sensor.energy03_energy_voltage") | float / 240.0)  | round(3) }}'

I actually created 2 other sensors, while I was figuring this out and learnt a lot.
Some how the template for mypf was wrong and I had a string instead of a float that evaluated to zero. I’m using the voltage reading on a lightly loaded short ring main. There is a voltage drop related to the current drawn and the length of wiring of 2.5mm twin and earth, but on the circuit i used its millivolts. Thanks for your help.

the current cost meter provides a watts value but its really VA with VA assumed to be 240V (it can be changed to be between 200 - 260 volts on the meter) sensor.energy03 is a power metering socket which i used for reference.

The next problem is reactive and resistive loads I can’t measure the overall power factor for the house but most reactive loads are 24/7 for me at a relatively low level but make up most of my usage The bigger resistive loads tend to be on for a short period so the easy option is just subtract a value for imaginary power and call it good enough say 100 va.

1 Like

Just setting this up now! I’ve had CC sitting in a box for 6 or 7 years and it was in use for probably 6 or so years before that in HS. Checked the ‘D’ alkaline batteries and um, go figure, they’re dead! Off to the store I go…

I’m unclear on these two sensors:

  - sensor:
      - name: "CurrentCost Power"
        unit_of_measurement: 'W'
        state: '{{ state_attr("sensor.current_cost", "Appliance 0") }}'
        device_class: power
        state_class: measurement
  - sensor:
      - name: "Dehumidifier Power"
        unit_of_measurement: 'W'
        state: '{{ state_attr("sensor.current_cost", "Appliance 2") }}'
        device_class: power
        state_class: measurement

Appliance 0? Appliance 2?
I only have a CurrentCost model CC128 which I am hooking up in my electrical panel. The box has 3 jacks: 2 - 1 - 3. I’ve only every used jacks 1 & 2 on the two legs of my 240v. Are the sensors related to those connectors?

On your CC monitor check which appliance (which number) the data comes under. If indeed you only have the total power then you don’t need to worry about any additional sensors. Everything will be under appliance 0 by default

I have 1 & 2