ha-wyzesense icon indicating copy to clipboard operation
ha-wyzesense copied to clipboard

hidev/Synology DSM Support

Open stephenmetts opened this issue 6 years ago • 13 comments
trafficstars

Currently many users run home assistant with docker on Synology hardware. The problem this presents is Synology mounts usb with hiddev, not hidraw. I don’t know if it’s possible, but it would be great to support hiddev.

https://www.kernel.org/doc/Documentation/hid/hiddev.txt

https://www.kernel.org/doc/Documentation/hid/hidraw.txt

stephenmetts avatar Aug 30 '19 01:08 stephenmetts

Throwing my vote in for this support as well. I'm using the MQTT/Docker version of this on a Raspberry Pi, but I'd love a native HASS integration with my Synology machine.

gitaroomaan avatar Sep 17 '19 18:09 gitaroomaan

To give more context here, this is the error I get when trying to use /dev/usb/hiddev8

2019-11-09 21:24:00 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up binary_sensor.wyzesense
2019-11-09 21:24:00 DEBUG (SyncWorker_4) [custom_components.wyzesense.binary_sensor] WYZESENSE v0.0.4
2019-11-09 21:24:00 DEBUG (SyncWorker_4) [custom_components.wyzesense.binary_sensor] Attempting to open connection to hub at /dev/usb/hiddev8
2019-11-09 21:24:00 DEBUG (SyncWorker_4) [custom_components.wyzesense.wyzesense_custom] Start Inquiry...
2019-11-09 21:24:00 DEBUG (SyncWorker_4) [custom_components.wyzesense.wyzesense_custom] ===> Sending: Packet: Cmd=4327, Payload=<None>
2019-11-09 21:24:00 DEBUG (SyncWorker_4) [custom_components.wyzesense.wyzesense_custom] Sending: b'aa55430327016c'
2019-11-09 21:24:26 WARNING (MainThread) [homeassistant.components.binary_sensor] Setup of platform wyzesense is taking over 10 seconds.
2019-11-09 21:24:28 ERROR (MainThread) [homeassistant.components.binary_sensor] Error while setting up platform wyzesense
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 150, in _async_setup_platform
    await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/wyzesense/binary_sensor.py", line 82, in setup_platform
    ws = beginConn()
  File "</usr/local/lib/python3.7/site-packages/decorator.py:decorator-gen-2>", line 2, in beginConn
  File "/usr/local/lib/python3.7/site-packages/retry/api.py", line 74, in retry_decorator
    logger)
  File "/usr/local/lib/python3.7/site-packages/retry/api.py", line 33, in __retry_internal
    return f()
  File "/config/custom_components/wyzesense/binary_sensor.py", line 80, in beginConn
    return Open(config[CONF_DEVICE], on_event)
  File "/config/custom_components/wyzesense/wyzesense_custom.py", line 561, in Open
    return Dongle(device, event_handler)
  File "/config/custom_components/wyzesense/wyzesense_custom.py", line 297, in __init__
    self._Start()
  File "/config/custom_components/wyzesense/wyzesense_custom.py", line 492, in _Start
    self._Inquiry()
  File "/config/custom_components/wyzesense/wyzesense_custom.py", line 398, in _Inquiry
    resp = self._DoSimpleCommand(Packet.Inquiry())
  File "/config/custom_components/wyzesense/wyzesense_custom.py", line 393, in _DoSimpleCommand
    self._DoCommand(pkt, cmd_handler, timeout)
  File "/config/custom_components/wyzesense/wyzesense_custom.py", line 379, in _DoCommand
    self._SendPacket(pkt)
  File "/config/custom_components/wyzesense/wyzesense_custom.py", line 331, in _SendPacket
    pkt.Send(self.__fd)
  File "/config/custom_components/wyzesense/wyzesense_custom.py", line 106, in Send
    ss = os.write(fd, pkt)
OSError: [Errno 22] Invalid argument

mgriffin13 avatar Nov 10 '19 16:11 mgriffin13

@gitaroomaan Can you give some more details on which Docker version you're running. Until the native Synology version is working, I think I'll need to use the rPi/MQTT configuration.

mgriffin13 avatar Nov 24 '19 21:11 mgriffin13

@mgriffin13 I'm running this: https://github.com/dariopb/ha-gosenseapp. It's been largely stable over the past couple of months running on a Raspberry Pi 3.

gitaroomaan avatar Nov 25 '19 00:11 gitaroomaan

Same - anyone find an answer for synology?

dave-parsons avatar Jan 21 '20 07:01 dave-parsons

Unfortunately without hidraw support by Synology DSM I don't think this will work. kernel.org seems to indicate that "[hidraw] differs from hiddev in that reports sent and received are not parsed by the HID parser, but are sent to and received from the device unmodified." It seems as if sending and receiving reports unmodified would not be possible if synology mounts it as hiddev.

The one possible alternative is to use https://github.com/dariopb/ha-gosenseapp as @gitaroomaan mentions above with a separate raspberry pi.

I have updated the README to indicate that it does not work with synology dsm.

kevinvincent avatar Jan 22 '20 19:01 kevinvincent

A big motivating factor to moving to Synology was so that I didn't have to run a separate rPi. The other alternative would be to somehow update the library to also support hiddev connections, but I understand that's a ton of work.

mgriffin13 avatar Jan 23 '20 02:01 mgriffin13

would really like to see this happen too!

efurban avatar Mar 05 '20 14:03 efurban

I gave up and bought another mini pc and moved my HA installation to the mini-pc. everything working great there. You can continue to use the Synology for your database and influxdb server, though.

mgriffin13 avatar Mar 06 '20 01:03 mgriffin13

I went with vm and all is working now

efurban avatar Mar 06 '20 13:03 efurban

I'm holding out hope for a version with broader support! I'm running on synology over here.

tismondo avatar May 28 '20 13:05 tismondo

i have this install running on a QNAP server and thought the component wasn't seeing my USB connection. would love for this to be supported.

rootsrocker avatar Jun 03 '20 15:06 rootsrocker

Did anyone get this solved? Have just spent the last few hours trying to get this working. Synology NAS -> Docker -> Home Assistant. Wyse is mounted as hiddev0 not hidraw0 - Causes errors in the log when home assistant boots.

rnodern avatar Jun 12 '20 13:06 rnodern