TLDR: I needed the powered USB hub, and I needed to use the sensor name in the template that I manually set; then, after rebooting a few times and waiting an hour Used Power showed up as a usable statistic. There were also some code changes mainly for cosmetic reasons.
Just to follow up on how I eventually got things to work. I went through several iterations of the config, and finally settled on this version:
The main problem with the config was because I assigned a name to the sensor (name: EMU-2), I had to use the name I gave it rather than the default (rainforst_energy_monitoring_unit). In hindsight, this should have been obvious, but oh well.
Other changes I made locally included changing the sensor.py file in a number of placed. I fixed the exception by making the change to line 140 of the file as mentioned in my previous comment, and then I added properties to the EMU2Sensor class for:
device_class
unique_id
friendly_name
Iām not sure if these changes are required, but it was nice to at least have the sensor show up as an energy device and the entity UI to not display that annoying message about not having a unique_id.
After doing all that stuff, Used Power showed up in the list of statistics I could use to monitor my grid consumption. I think the names suggested by others in previous posts are probably better, but it seemed like a good idea at the time. I also averaged out a few of my power bills to create a static cost for power, and put that into the energy dashboard.
Finally, I made my own custom dashboard just for fun that shows the history of the EMU-2 device. it turns out the state of this device is the same number that is output on the screen of the EMU-2 unit. My custom dashboard currently looks like this:
I have this integration setup throgh HACS, but I noticed that recently I no longer have any attributes on my emu2 sensor, which means my template sensors dont work and the energy dashboard doesnāt update. Has anyone else had this isssue? The integration is working properly. The real time power consumption matches my Sense, I just dont have attributes.
Howdy everyone, I just got an EMU2 (well not yet itās on order) I was pumped to add it to my HA install but realized now that itās a USB tie in, unfortunately I run my HA in hyper-v and that doesnāt passthrough USB (I donāt want to change it around at all). Is there any other way to tie this in or use a pi to connect it to HA somehow? Amazing on all the work you have done on this!
Iāve never used it, but looks up ser2net (I think). It would allow for serial over ethernet. So I would assume you could plug it into a PI and pipe it over to HA? Just guessing here though.
I just released an updated EMU-2 integration to HACS, which integrates with the energy monitor system. I have it working on FreeBSD, but would really like feedback for Linux as I think there might be a problem with the detection loop.
I had some problems with this in that the read loop would appear to lock up but wasnāt sure if that was just my implementation. I ended up rolling back to WSL1 which supports USB peripherals.
I have been using your integration with HASIO on the Blue hardware. I actually switched to your from the jrhorrisberger component because I liked your code more
I was very happy to just have integration work without manually editing YAML (and not worrying about the /dev/tty changing if I reboot the OS. So no more configurations for the sensor, template, or utility meter required to work with the power dashboard.
Ryan, I wish I could help you find our USB problem with Home Assistant OS on my Pi 4, but in frustration, and after trying multiple Integrations, I sent the EMU-2 back to Amazon. I tried everything I could think of including a different Integration using MQTT but could never get HA to see my EMU-2.
Although the unit connected correctly with my PG&E, it would never get real-time pricing that was supposed to happen as well. Kind of made the device useless to me, even if I got it connected with HA.
In the meantime, someone gave me a Sense Energy Monitor and Iāll be installing that this weekend.
Thanx again for your initial help and troubleshooting.
Iām having this problem too. I tried to key off the emu2 itself, but thatās wildly inaccurate for building usage stats. I am not sure if itās a problem with the integration or with HA itself. For me it started after I upgraded to 2022.4.6 a few days ago.
I ended up switching to the above new module instead of ārainforestā. The one above is working much better and can even be configured from the UI. Iām then keying off of it for the usage stats which have been accurate.
Information on how to get the data to be recognized by the energy pane in home assistant would be amazing please.
I cannot find documentation on how to get the data to Home assistantās Energy pane; any help would be greatly appreciated.
Thanks!
** edit: once setup.
go to Settings in the HA front end
go to Dashboards
find āEnergyā click on it
follow steps in the HACS setup instructions.
wait a while for data to come in
Did you see any errors before you saw this one? This error pops up when the device isnāt connected to Home Assistant.
This could happen if either the HA is unable to open the serial port, or it could be the read thread crashed somehow in which case I would hope it logged an error.
Funny, I too have done something very much like this with the control software that Iāve been developing over the years running on Google Apps Script. I like to be extra conservative, so I assume that if the five-minute price is a new maximum for the hour, that it will probably get worse and use that price for decisionmaking.
var weighted5MinutePrice = (weightedHourPrice * minute + fivePrice * (60.0 - minute)) / 60.0; // Use 5 minute price heavily at start of hour, little at end
var estimatedHourPrice = Math.max(weighted5MinutePrice, weightedHourPrice);