core icon indicating copy to clipboard operation
core copied to clipboard

Rainforest Eagle RFA-Z109 Incorrectly identified as EAGLE-200

Open jensenbox opened this issue 3 years ago • 8 comments

The problem

When targeting a Rainforest Eagle RFA-Z109 (EAGLE-100) the code incorrectly determines that the unit is an EAGLE-200 and proceeds to attempt to communicate with it using the wrong API.

What version of Home Assistant Core has the issue?

Home Assistant 2022.3.7

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

rainforest_eagle

Link to integration documentation on our website

https://www.home-assistant.io/integrations/rainforest_eagle

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2022-03-29 23:46:05 ERROR (MainThread) [homeassistant.components.rainforest_eagle.data] Unexpected error fetching 0020ad data: 'Device'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 187, in _async_refresh
    self.data = await self._async_update_data()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 147, in _async_update_data
    return await self.update_method()
  File "/usr/src/homeassistant/homeassistant/components/rainforest_eagle/data.py", line 154, in _async_update_data_200
    data = await eagle200_meter.get_device_query()
  File "/usr/local/lib/python3.9/site-packages/aioeagle/electric_meter.py", line 109, in get_device_query
    self.details = data["Device"]["DeviceDetails"]
KeyError: 'Device'
2022-03-29 23:46:05 DEBUG (MainThread) [homeassistant.components.rainforest_eagle.data] Finished fetching 0020ad data in 1.872 seconds (success: False)


### Additional information

![image](https://user-images.githubusercontent.com/189265/160769200-5e333327-89a7-4bdb-ad94-1f70539b2d4d.png)

This line of code never gets executed as it returns prematurely: https://github.com/home-assistant/core/blob/dev/homeassistant/components/rainforest_eagle/data.py#L85

jensenbox avatar Mar 30 '22 06:03 jensenbox

Hey there @gtdiehl, @jcalbert, mind taking a look at this issue as it has been labeled with an integration (rainforest_eagle) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

I ran in to this issue when adding my Eagle-100 device so I did some investigating.

There are a few things that are going on. First, uEagle doesn't have the support for the call that is needed to look up the model information. The other is that the Rainforest Eagle integration is not quite checking for the right values from uEagle. I made some changes and currently have them in a HACS module here: https://github.com/dkirker/hacs-rainforest_eagle-temp I haven't yet opened a PR to the main Home Assistant repository. uEagle will need an upstream change added first.

dkirker avatar Apr 11 '22 04:04 dkirker

I ran into the same problem. The integration with the Eagle appeared to work with my RFA-Z109, and correct meter data was being recorded in HomeAssistant. However, it only worked temporarily. The device would frequently go into a bad state, and its HTTP homepage would show this :

image

At that point, no data could be collected by from it by HAOS anymore. Sometimes, it would still upload to rainforestcloud for a period of time. Eventually, it would become completely DOA, until rebooted. Unfortunately, Rainforest support was useless. All they can say is that it's an EOL product and will not fix anything on the device side.

Disabling the HA Eagle integration made the problem go away, so it was definitely the trigger for this device problem. It's a bit disconcerting that correct data is returned, but then it goes to a bad state. Using the wrong API might be triggering the problem. But I would sooner guess some sort of memory leak on the device causing the issue. I worked around the problem by putting my Eagle on a Kasa smartplug, and having HA reboot the Eagle every 3 hours using that smartplug. The Eagle now no longer goes into the bad state with that reboot frequency. Daily, 12 hour or 6 hour reboots weren't good enough. I see another problem with the HA integration, though. Very occasionally, when the Eagle reboots, the HA Eagle integration gets stuck and can no longer communicate. This is fairly rare obviously, since I'm rebooting the Eagle 4 times a day. It just happened tonight, though, and I was in my hot tub with the sauna heating. There is a nice straight line/. The only fix I found to get HAOS to resume collecting data from the mete rwas to reboot HAOS. I will file a separate issue about this.

@dkirker , I'd love to test your fix, and I do have HACS installed. But I would like to retain the existing meter data that was collected. Is it possible for me to try your fixed integration, and do so ?

madbrain76 avatar Apr 13 '22 11:04 madbrain76

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jul 12 '22 12:07 github-actions[bot]

This issue has not been fixed in the latest HA.

madbrain76 avatar Jul 14 '22 21:07 madbrain76

@madbrain76 you seem to have commented on a different issue to the incorrectly identified device version.

There has been a change to use a patched version of the uEagle library (https://github.com/hastarin/eagle100) that should have improved things in that it can sometimes recover from this errored state. Unfortunately it's still not 100% and given it's a fault in the hardware I wouldn't expect a resolution for that.

Personally I've been rebooting my device when it stops working lately, but admit when I find the time I may use Wattvision as an intermediate along with REST sensor instead of the integration due to this bug in the device firmware.

In terms of the incorrectly identified version perhaps @dkirker can update his work and submit a PR if he can spare the time.

hastarin avatar Jul 27 '22 02:07 hastarin

@hastarin You are right, my comment was not quite for the same issue. I did however run into the issue where my RFA-Z109 gets identified at Eagle-200 . I'd love to be able to test the fix to uEagle with HA.

Perhaps if the device detection can't be done automatically in a reliable way, there could be a configuration option for this integration, maybe a checkbox or drop-down to select the RFA-Z109 or Eagle-200 ? Rainforest is also working on their Eagle 3, which was supposed to be released earlier this year.

madbrain76 avatar Sep 20 '22 20:09 madbrain76

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

I am quite new to home assistant & I am trying to integrate my Rainforest Automation Eagle-100 into hass.

I'm having the same issue with my Eagle-100. It worked at first then goes unresponsive. I want to test this fix but I am unsure how to import the "fix" in the uEagle library (https://github.com/hastarin/eagle100). I've looked over the README.md and requirements.txt but I don't know what to do this the data from setup.py, how do I correctly apply this?

Sorry, I'm a bit of a noob and need a little more hand-holding, for now.

Thanks for any insight

tossil avatar Jan 15 '23 16:01 tossil

tossil, you can install HACS and add a custom repository from there. https://hacs.xyz/docs/faq/custom_repositories/

I am using https://github.com/dkirker/hacs-rainforest_eagle-temp .

I think that may be fixing the identification bug, but it won't fix the bug where the Eagle becomes intermittently unavailable. I have managed to work around that issue by

  1. putting a smartplug on the Eagle to reboot the Eagle every 3 hours
  2. resetting the Eagle integration every 3 hours as well

This is the YAML I use which has my Eagle-100 working reliably.

alias: Restart Eagle
description: ""
trigger:
  - platform: time
    at: "00:00:00"
  - platform: time
    at: "03:00:00"
  - platform: time
    at: "06:00:00"
  - platform: time
    at: "09:00:00"
  - platform: time
    at: "12:00:00"
  - platform: time
    at: "15:00:00"
  - platform: time
    at: "18:00:00"
  - platform: time
    at: "21:00:00"
condition: []
action:
  - type: turn_off
    device_id: e0c5041207d9a09970c3e17accc4d41e
    entity_id: switch.garage_eagle
    domain: switch
  - delay:
      hours: 0
      minutes: 0
      seconds: 2
      milliseconds: 0
  - type: turn_on
    device_id: e0c5041207d9a09970c3e17accc4d41e
    entity_id: switch.garage_eagle
    domain: switch
  - service: homeassistant.reload_config_entry
    data: {}
    target:
      device_id: e2ffe9059dcda09474bfaf8ada6d6c35
mode: single

In the above snippet, e0c5041207d9a09970c3e17accc4d41e is the ID of a Kasa KP125 smartplug I used on which I plugged in the Eagle. And e2ffe9059dcda09474bfaf8ada6d6c35 is the ID of the Eagle integration. I created this automation through the GUI.

madbrain76 avatar Jan 16 '23 20:01 madbrain76

@tossil the "fix" is already in but as I've stated above it helps, but doesn't fix the issue. In the last few days my trick of restarting the device (via a power plug) and then restarting the integration seems to have stopped working.

I think I'll finally have to give up on the integration and switch to the REST sensor via Wattvision which doesn't seem to cause the device to hang, at least not anywhere near as often.

hastarin avatar Jan 17 '23 04:01 hastarin

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.