Rainforest Automation EMU-2 (Energy Component)

Looks like HassOS 6 core-2021.6 broke the integration…anyone else seeing it?

Broken for me as well as of a week or so ago with core-2021.6. Had to roll back to a previous core-2021.5 version. Updating to Home Assistant OS 6.0 itself is fine for me, just not the new core version.

Broken for me as well with core-2021.6.5.

Broken here as well. Would be happy to help, but I’m new to a lot of this.

Welp, I actually got it working. I had to add the following line to manifest.json and restart, then everything started working.

"version": "0.2.1",

2 Likes

Great find! Was able to finally upgrade! (for those who are adding that version item to the json, be sure to make sure that you paste in normal quotes, not smart quotes)

1 Like

Thanks for the catch. Edited the post with the correct quotes.

Does this integration conflict with ZigBee dongles used with ZHA or ZigBee2MQTT?

This seems to have broken again for me… is anyone else seeing this?
I get:

Platform error: sensor - Integration 'rainforest' not found.

Thanks

Mine is still working fine.

core-2021.8.8
supervisor-2021.06.8

Ugh. ok. was working great now it’s broken for me, and I can’t seem to figure out how to get it back…
Thanks

If you have any logs or configs to share I’m happy to help with a second set of eyes.

Much appreciated!
however, after many hairs pulled, it turns out it was the usb cable… as outlined in the readme…

Thank you tho!

Hello All,

Thanks to this great thread I have set my EMU-2 up and have the basic sensor reading into HA.

I have used @damienheiser fork due to the fixes / updates made in the post above.

Now I am a little stuck. My aim was to be able to feed this into HA’s new energy platform but when I try and “Add Consumption” it tells that “No Matching Statistics were found”.

Here are my attributes:

Price Tier

Price

Net kWh

30393.1

Delivered kWh

30393.1

Received kWh

0

Custom Price

This makes sense as the main number of the sensor is the actual draw at that point in time. I know I’m not feeding anything into the grid (my solar isn’t powerful enough yet).

Net kWh and Delivered kWh are the same and seem to match my meter reading. Which I guess is all the energy it has ever processed.

Any tips on where I go from here?

I figured it all out. Logging my understanding here for my own reference rather than anything else and brining what I have read together.

I run HA in an Hass.io VM on unRAID. Unlike my ConBeeII Zigbee USB, I did not have to do anything any to pass this through to the VM. Just the normal supported method via the GUI.

I installed the component via HACS which was very easy.

The default configuration for setting up the integration worked perfectly:

  - platform: rainforest
    port: '/dev/ttyACM0'

As I decided to install the updated component by @damienheiser I couldn’t figure out the values. After reading the post again and some playing:

Delivered kWh: Total energy delivered from the grid.
Received kWh: Total energy fed into the grid
Net kWh: Delivered kWh - Received kWh

For the Cumulative Sensor I used the code in post #32 mainly but it had to be changed to get the “Delivered kWh” attribute for me rather than “Cumulative kWh” attribute. The latter coming from a different version of the component.

  - platform: template
    sensors: 
      energy_meter:
        unique_id: cumulative_kWh
        friendly_name: "Cumulative kWh"
        unit_of_measurement: 'kWh'
        value_template: "{{ state_attr('sensor.rainforest_energy_monitoring_unit','Delivered kWh') }}"
        device_class: energy

I added the device_class: energy to the code. This allowed the utility_meter variables to show up as a source in the new HA dashboard.

utility_meter:
  total_quarter_hourly_energy:
    source: sensor.energy_meter
    cycle: quarter-hourly
  total_hourly_energy: 
    source: sensor.energy_meter 
    cycle: hourly 
  total_daily_energy: 
    source: sensor.energy_meter 
    cycle: daily 
  total_monthly_energy: 
    source: sensor.energy_meter 
    cycle: monthly

Then I added “total_hourly_energy” as a Grid Consumption source in the new HA energy dashboard.

I am now totally up and working. :slight_smile:

2 Likes

@danioj

Thank you for including your understanding; I was able to complete the setup using your post as a guide.

One additional thing I would like to figure out is if it’s possible to split the delivered and received power into separate sensors for the new energy dashboard. Does anyone have that working with this component?

I think I have this up and running with delivered and received grid power. Just to outline my steps:

  1. Add @damienheiser repository to HACS (GitHub - damienheiser/ha-rainforest-emu2)
  2. Add following to configuration.yaml:
# Enery Monitoring
sensor:
  - platform: rainforest
    port: '/dev/ttyACM0'
  - platform: template
    sensors: 
      grid_energy_delivered:
        unique_id: delivered_kWh
        friendly_name: "Delivered kWh"
        unit_of_measurement: 'kWh'
        value_template: "{{ state_attr('sensor.rainforest_energy_monitoring_unit','Delivered kWh') }}"
        device_class: energy
      grid_energy_received:
        unique_id: received_kWh
        friendly_name: "Received kWh"
        unit_of_measurement: 'kWh'
        value_template: "{{ state_attr('sensor.rainforest_energy_monitoring_unit','Received kWh') }}"
        device_class: energy

utility_meter:
  grid_energy_consumed: 
    source: sensor.grid_energy_delivered 
    name: 'Grid Energy Consumed'
  grid_energy_returned: 
    source: sensor.grid_energy_received
    name: 'Grid Energy Returned'
  1. Add the utility meter sensors to the energy dashboard (delivered = consumption, received = return)

With the new energy dashboard, I think all the input you need is a running total of the energy and the statistical breakdown by hour, day, month, etc. is calculated for you.

1 Like

I’m receiving an uncaught exception here using the custom component
hassio 7.0 / core 2021.12.4 / supervisor 2021.12.2

Logger: root
Source: custom_components/rainforest/sensor.py:147
Integration: rainforest
First occurred: 11:52:20 AM (1 occurrences)
Last logged: 11:52:20 AM

Uncaught thread exception

Traceback (most recent call last): 
File "/usr/local/lib/python3.9/threading.py", line 973, in _bootstrap_inner self.run() 
File "/usr/local/lib/python3.9/threading.py", line 910, in run self._target(*self._args, **self._kwargs) 
File "/config/custom_components/rainforest/sensor.py", line 147, in serial_read demand = int(xmlTree.find('Demand').text, 16) 
TypeError: int() can't convert non-string with explicit base

figured this out, my unit will occasionally show no value for kw and it was breaking the conversion. submitted a pull request on GH

1 Like

@hopeless1 am hoping you have a moment to clue me in on adding the repo. It’s not working for me on core-2021.11.3 / HASS 6.6.

21-12-24 08:06:58 INFO (MainThread) [supervisor.store.git] Cloning add-on https://github.com/damienheiser/ha-rainforest-emu2 repository
21-12-24 08:06:59 ERROR (MainThread) [supervisor.store] https://github.com/damienheiser/ha-rainforest-emu2 is not a valid add-on repository
21-12-24 08:06:59 INFO (MainThread) [supervisor.resolution.module] Create new issue IssueType.CORRUPT_REPOSITORY - ContextType.STORE / 264d7836
21-12-24 08:06:59 INFO (MainThread) [supervisor.resolution.module] Create new suggestion SuggestionType.EXECUTE_REMOVE - ContextType.STORE / 264d7836
21-12-24 08:07:01 WARNING (MainThread) [supervisor.store.data] No repository information exists at /data/addons/git/264d7836
21-12-24 08:07:01 INFO (MainThread) [supervisor.store] Loading add-ons from store: 62 all - 0 new - 0 remove
21-12-24 08:07:01 INFO (MainThread) [supervisor.resolution.fixups.store_execute_remove] Remove invalid Store: 264d7836
21-12-24 08:07:01 INFO (MainThread) [supervisor.store.git] Removing custom add-on repository https://github.com/damienheiser/ha-rainforest-emu2

Thank you.