This is pretty awesome - thanks for sharing. I’ve been debating getting one of these but hadn’t hard the time to start from scratch - looks like you’ve done all the heavy lifting already
Question - do you have this hooked up to a Raspberry Pi where Home Assistant is running? Any other setup needed to get the device talking with the Pi?
I wanted to let you know that updating to version .92 breaks this custom component, even with switching around the folders/naming convention to meet the new requirements. Any chance you could update the project for the newest version of Home Assistant? Your project works great, and there is such little info on this sensor.
@hasbro, give it a try now. @BrianHanifin migrated the component to the new format and updated the readme (File structure migration) – Do note that the component was renamed from emu2 -> rainforest
@jrhorrisberger Thank you for doing the hard work making it in the first place! I just got it ready for Home Assistant 0.91 (and beyond) for selfsh reasons… then decided not to be selfish and contributed it back to your repository.
Great work, and thank you for the work on this. The update does work perfectly now with .92.
I did want to add that (at least on Hass.io) that initially it did not work even after a few reboots. What I discovered was through dmesg, that the correct recognition of the device wasn’t happening at boot. By unplugging and plugging it back in while the system was up, the dmesg returned the correct profile and set it up on * /dev/ttyACM1. Also, I discovered that not all micro-usb cables are able to transfer the data, including the one that came with my unit. Both on Hass.io and on Windows, nothing would happen when I plugged it in, I tried 3 different cables and suddenly one of the worked. I hope this helps someone out in the future if they are having similar issues.
Also, the device works great with the new “utility_meter” and “statistics” platforms that are included in Home Assistant.
Ensure that the EMU-2™ is powered only by its AC adapter, and there are no batteries installed; power from the batteries may interfere with operation of the USB port.
I did have issues getting my laptop to recognize the emu2 with batteries when I first started playing around with it. However, it seemed to work with batteries on the pi, so I left them in. I’m going to try taking the batteries out of mine completely to see if the issue goes away.
@jrhorrisberger I took the batteries out as part of my troubleshooting. My issue was definitely the micro-usb cable. Certain cables just will not work, it is very strange, but after trying at least 4 different ones it suddenly worked. After unplugging while the system was running and then plugging it back in while the system was still running, then reboot. It has been logging reliably for several days and also survived an OS reboot (no batteries). Maybe the batteries keep the power on, and when it isn’t powered by batteries, it gives it a chance to boot while the OS is starting up and has a better chance at being recognized? Just a guess.
I installed you custom component using 0.92.1 and the device loads without error however the data isn’t instantiated … I tried and few inserts/restarts and a reboot … I can see /dev/ttyACM0 load in dmesg … when i cat /dev/ttyACM0 I can see the correct xml data stream from the EMU-2 … any ideas what I’m doing wrong ? ( running on Ubuntu 18.04 on intel NUC )
@danmarotta5 – I was thinking on it today and was on the fence about it being a dependency error or some sort of string parsing issue, but you beat me to it. Glad you were able to get it working!
@danmarotta5 / @hasbro – I updated your findings to the first post (and github) to save time for others in future
Has anyone had problems with the values this is outputting being ridiculously high at times, and other times perfectly reasonable? For example it is showing “4,294,966.287 kWh”.
Looking more closely, that dip in the middle is overnight where it reads (1.22 kWh). So, maybe it is always reading that high. Is there a setting on the device I need to change? Or do I need to divide by 1,000,000 to get the correct answer?
@BrianHanifin – I’ve not seen this before. I don’t know if the EMU2 sets the Multiplier/Divisor or if this comes from the utility. I suspect the values from the XML/serial are weird? The value in HA should match the one on this screen (There is a PR on github to fix the units from kWh -> kW)
Oh, I had never seen that particular screen before because I hadn’t set a cost per hWh. It is currently showing -1.0¢/hr and -3.281kW. Apparently there isn’t a way to set the price the power company gives for sending my overage back to the grid 3¢, while I think they charge like 33¢ per kWh used. (I really need to get some solar batteries.)
I tried the new code. Unfortunately the component is still showing showing 4,294,964.042 kWh. But at least I can see that the device, I believe has the correct values displaying.
@Krapstar I am experiencing the same problem and think I have some insight thanks to help from Rainforest, but I’m not smart enough to determine how it should be fixed in the script. Apparently when you have solar generation and the net demand is negative, the data is returned in hex signed 2s compliment format. The current code is converting it to decimal incorrectly.