ryanwinter/hass-rainforest-emu-2

Adding device crashes HA

Opened this issue · 5 comments

I've got the current stable version of HA running on an RPI4 through hass.

When I attempt to add my EMU-2 through a direct USB connection, Home Assistant locks up solid. The Pi 4 still responds, if I'm sshed in it still works, but I get nothing further in the HA logs until a power cycle.

I also tried with the EMU-2 plugged into a powered hub, and had the same result.

Is there a way I can get better diagnostic information? I ran HA with DEBUG logs enabled and still didn't see anything useful output when I attempted to add the EMU-2. The device add screen shows /dev/ttyACM0 and knows it's an EMU-2 device (it recognizes it as a new device), but once I choose the port and tell it to add, bam, hang.

Hi @akramer,

So its freezing up during the configuration stage? There is some debug during that stage but you will have to manually turn on debug for this particular component like this:

logger:
  default: error
  logs:
    custom_components.rainforest_emu_2: debug

After this, can you try and configure the integration again and post the output?

It sounds like it is trying to open the serial port assigned to the device but is failing for some reason. This shouldnt cause HA to lock up, so I suspect I am missing some sort of error and either its getting stuck in a retry loop, or some exception took down the application. I have an 8 second timer in there which should kick in.

You will

Ryan

I got around to testing this again and... it worked properly. Sigh. Here's the debug log info in case it helps, there was one error, or something like that:

2022-11-08 12:40:54.479 INFO (MainThread) [custom_components.rainforest_emu_2.emu2] Starting serial_read loop
2022-11-08 12:40:58.502 DEBUG (MainThread) [custom_components.rainforest_emu_2.emu2] received 21: <InstantaneousDemand>
2022-11-08 12:40:58.509 DEBUG (MainThread) [custom_components.rainforest_emu_2.emu2] received 45: <DeviceMacId><elided></DeviceMacId>
2022-11-08 12:40:58.513 DEBUG (MainThread) [custom_components.rainforest_emu_2.emu2] received 43: <MeterMacId><elided></MeterMacId>
2022-11-08 12:40:58.517 DEBUG (MainThread) [custom_components.rainforest_emu_2.emu2] received 33: <TimeStamp>0x2afd7b58</TimeStamp>
2022-11-08 12:40:58.521 DEBUG (MainThread) [custom_components.rainforest_emu_2.emu2] received 25: <Demand>0x0002ed</Demand>
2022-11-08 12:40:58.525 DEBUG (MainThread) [custom_components.rainforest_emu_2.emu2] received 35: <Multiplier>0x00000003</Multiplier>
2022-11-08 12:40:58.528 DEBUG (MainThread) [custom_components.rainforest_emu_2.emu2] received 29: <Divisor>0x000003e8</Divisor>
2022-11-08 12:40:58.532 DEBUG (MainThread) [custom_components.rainforest_emu_2.emu2] received 31: <DigitsRight>0x03</DigitsRight>
2022-11-08 12:40:58.536 DEBUG (MainThread) [custom_components.rainforest_emu_2.emu2] received 29: <DigitsLeft>0x05</DigitsLeft>
2022-11-08 12:40:58.540 DEBUG (MainThread) [custom_components.rainforest_emu_2.emu2] received 44: <SuppressLeadingZero>Y</SuppressLeadingZero>
2022-11-08 12:40:58.542 DEBUG (MainThread) [custom_components.rainforest_emu_2.emu2] received 22: </InstantaneousDemand>
2022-11-08 12:40:59.488 DEBUG (MainThread) [custom_components.rainforest_emu_2.emu2] XML write b'<Command><Name>get_device_info</Name></Command>'
2022-11-08 12:40:59.500 DEBUG (MainThread) [custom_components.rainforest_emu_2.emu2] received 12: <DeviceInfo>
2022-11-08 12:40:59.507 DEBUG (MainThread) [custom_components.rainforest_emu_2.emu2] received 45: <DeviceMacId><elided></DeviceMacId>
2022-11-08 12:40:59.511 DEBUG (MainThread) [custom_components.rainforest_emu_2.emu2] received 45: <InstallCode><elided></InstallCode>
2022-11-08 12:40:59.517 DEBUG (MainThread) [custom_components.rainforest_emu_2.emu2] received 53: <LinkKey><elided></LinkKey>
2022-11-08 12:40:59.522 DEBUG (MainThread) [custom_components.rainforest_emu_2.emu2] received 35: <FWVersion>2.0.0 (7400)</FWVersion>
2022-11-08 12:40:59.526 DEBUG (MainThread) [custom_components.rainforest_emu_2.emu2] received 28: <HWVersion>2.7.3</HWVersion>
2022-11-08 12:40:59.528 DEBUG (MainThread) [custom_components.rainforest_emu_2.emu2] received 29: <ImageType>0x2201</ImageType>
2022-11-08 12:40:59.534 DEBUG (MainThread) [custom_components.rainforest_emu_2.emu2] received 56: <Manufacturer>Rainforest Automation, Inc.</Manufacturer>
2022-11-08 12:40:59.538 DEBUG (MainThread) [custom_components.rainforest_emu_2.emu2] received 38: <ModelId>Z105-2-EMU2-LEDD_JM</ModelId>
2022-11-08 12:40:59.542 DEBUG (MainThread) [custom_components.rainforest_emu_2.emu2] received 37: <DateCode>20220131356a0605</DateCode>
2022-11-08 12:40:59.545 DEBUG (MainThread) [custom_components.rainforest_emu_2.emu2] received 13: </DeviceInfo>
2022-11-08 12:41:02.494 DEBUG (MainThread) [custom_components.rainforest_emu_2.config_flow] Cancelled, caught 
2022-11-08 12:41:02.508 DEBUG (MainThread) [custom_components.rainforest_emu_2.emu2] Requesting data <class 'custom_components.rainforest_emu_2.emu2_entities.DeviceInfo'>
2022-11-08 12:41:02.518 INFO (MainThread) [custom_components.rainforest_emu_2.emu2] Starting serial_read loop

Did you ever find a solution to this one? I'm having the same issue.

My solution was to try again a few days later. It just worked. I don't know if the version of HA changed, or the phase of the moon, or what. It's been rock solid since then.

Well, I'm glad its working for someone. Just tried hooking up my EMU2 again after its been sitting since september. I figured enough things have changed since then but I am still getting the same issue :(

Hopefully @ryanwinter gets a chance dig into this a little bit more, I see he's been working on this a little bit last week. There's a whole plethora of people who have this exact same issue over on the Hassio forums