ryanwinter/hass-rainforest-emu-2

Unable to detect EMU-2 device

Closed this issue · 8 comments

After installing HACS (1.25.1) and Rainforest-emu-2 integration (1.2.0), the emu-2 device is never actually detected by HA.

Setup:
HA (2022.5.5) docker container on Ubuntu VM under proxmox
conbee and rainforest USB passthru to VM and mapped to docker container
EMU-2 connected to power meter and showing live values on-device.
Rainforest integration shows up in HACS menu, but no device ever detected by HA (so port selection dialog never shows)

(Tried with multiple USB cables and with/without batteries in EMU. Conbee functions properly on passthru with 8 sensors in HA)

Hey @masta-bhawk,

I'm a bit confused, so you installed v1.2.0 from HACS, anId then restarted Home Assistant.
Next you added the integration from the Integrations page in Home Assistant, but are you saying that you arent getting the dialog to choose the device like this one below?
image

If this dialog isnt showing up, then I believe that means the setup flow is throwing an error. If thats the case, I think you would see something in the home_assistant.log file with error details.

The other thing to test, is make sure you can see output from the EMU-2 device within the VM. You could use a serial monitor like minicom to open the device and confirm you are seeing output.
Also make sure that Home Assistant has permissions to access the device.

It is working now!

In case it helps someone else, the root cause was that the USB emulation in proxmox was set to use USB3 mode. Once I disabled that and rebooted the Ubuntu VM, when HA started backup the emu-2 was detected, the dialog above showed correctly, and now all is well, even plugging in to the energy dashboard just fine.

Thanks for a great integration!

PS: Just to close the loop on the original observation and what was tried. You are correct that the dialog never showed because the emu-2 device was never detected by HA discovery. HA Logs showed nothing useful (other than a warning about the custom integrations that weren't tested). Minicom actually wouldn't connect because the /dev/serial/by-id/...[rainforest]... string was too long. Setting a symbolic link to point to that did allow minicom to connect. But in the end, once the usb3 emulation in prox was turned off, HA ended up detecting it just fine (on /dev/ttyACM0 ) and now all seems to be functioning great.

Thanks for the update, looking at the logic I think there are two issues:

  1. I'm using "serial.tools.list_ports.comports", and it looks like this method isn't find the serial port. Not sure if there is much I can do here.
  2. If no com ports are detected, then it should prompt the user to enter the com port. This flow appears to be failing.

I'm going to at least attempt to fix 2, so that if the com port isnt detected you can still manually enter the port.

@ryanwinter I'm having the same issue. I don't see the dialog during install. I'm using a virtual serial port in virtualbox running haos.

I can get data on the serial port, just need to work out how to get the port configured and I'm off and going.

image

I don't see anything relevant in the logs. Perhaps you can add a bunch of logging in the config flow and I can re-install to gather the info you need to fix this?

2022-06-19 06:13:07 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-06-19 06:13:07 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration rainforest_emu_2 which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-06-19 06:13:07 WARNING (Recorder) [homeassistant.components.recorder.util] The system could not validate that the sqlite3 database at //config/home-assistant_v2.db was shutdown cleanly
2022-06-19 06:13:07 WARNING (Recorder) [homeassistant.components.recorder.util] Ended unfinished session (id=12 from 2022-06-19 13:12:49.809033)
2022-06-19 06:13:12 INFO (Thread-3) [homeassistant.components.mqtt.client] Connected to MQTT server core-mosquitto:1883 (0)
2022-06-19 06:13:12 DEBUG (MainThread) [homeassistant.components.mqtt.client] Subscribing to homeassistant/+/+/config, mid: 1
2022-06-19 06:13:13 DEBUG (MainThread) [homeassistant.components.mqtt.client] Subscribing to homeassistant/+/+/+/config, mid: 2
2022-06-19 06:13:13 DEBUG (MainThread) [homeassistant.components.mqtt.client] Subscribing to tasmota/discovery/#, mid: 3
2022-06-19 06:13:16 WARNING (MainThread) [aioesphomeapi.reconnect_logic] Can't connect to ESPHome API for plug3 @ 192.168.101.13: Error connecting to ('192.168.101.13', 6053): [Errno 113] Connect call failed ('192.168.101.13', 6053)
2022-06-19 06:13:21 DEBUG (MainThread) [homeassistant.components.mqtt.trigger] Attaching MQTT trigger for topic: 'home/attic/workshop/button', payload: '1'
2022-06-19 06:13:21 DEBUG (MainThread) [homeassistant.components.mqtt.trigger] Attaching MQTT trigger for topic: 'home/attic/workshop/button', payload: '2'
2022-06-19 06:13:21 DEBUG (MainThread) [homeassistant.components.mqtt.trigger] Attaching MQTT trigger for topic: 'home/attic/workshop/button', payload: '3'
2022-06-19 06:13:21 DEBUG (MainThread) [homeassistant.components.mqtt.client] Subscribing to home/attic/workshop/button, mid: 4
2022-06-19 06:13:21 DEBUG (MainThread) [homeassistant.components.mqtt.client] Subscribing to home/attic/workshop/button, mid: 5
2022-06-19 06:13:21 DEBUG (MainThread) [homeassistant.components.mqtt.client] Subscribing to home/attic/workshop/button, mid: 6
2022-06-19 06:13:23 DEBUG (MainThread) [homeassistant.components.mqtt.client] Transmitting message on homeassistant/status: 'online', mid: 7```

I switched to usb passthrough (from serial port forwarding) and the plugin found the device vid/pid just fine and works well. Let me know if you want to debug the serial config path some more.

I have an open work item to replicate the problem when no usb ports are found, looks like its crashing out. Just havent had time to look at this yet :(

I have changed the logic for adding serial ports as I think there was something wrong there before in #20.