mcclown / pyseneye Goto Github PK
View Code? Open in Web Editor NEWA module for interacting with Seneye range of aquarium and pond sensors
License: Apache License 2.0
A module for interacting with Seneye range of aquarium and pond sensors
License: Apache License 2.0
Currently the flags are just stored as an array of two bytes. It's not being parsed currently, so it's only available as raw data.
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.8/dist-packages/pyseneye/sud.py", line 608, in action
raise TimeoutError("Operation timed out reading response.")
TimeoutError: Operation timed out reading response.
Hi,
I have installed as suggested with pip install pyseneye and all completes as expected.
However when I try to run it generates the errors below and wont connect etc. I have a seneye device connected and it can be seen in lsusb with correct details.
Not sure what I'm doing wrong but all supported welcomed so I can get onto to writing my own code to send via MQTT etc.
Errors on python
No abc available for python
Hope that you can assist.
Alan
Tested on Raspberry Pi 1 B with latest Raspbian distro, fully upgraded. Seneye SUD v 4.0.4@14200000.
After adding manual udev rule in /etc/udev/rules.d/10-usb.rules I got past USB access denied message:
ACTION=="add" \ , SUBSYSTEMS=="usb" \ , ENV{DEVTYPE}=="usb_device" \ , ATTRS{idProduct}=="2204" \ , ATTRS{idVendor}=="24f7" \ , GROUP="plugdev" \ , MODE="0777"
Then reloading udev config as root:
udevadm control --reload-rules && udevadm trigger
I finally was able to use pyseneye interactively and get through these commands:
from pyseneye.sud import SUDevice, Action
d = SUDevice()
d.action(Action.ENTER_INTERACTIVE_MODE)
Timing out at:
s = d.action(Action.SENSOR_READING)
File "/home/pi/.local/lib/python3.7/site-packages/pyseneye/sud.py", line 608, in action
My foo is not strong enough to find the problem, but I wonder if there may have been some changes to how you should interpret the seneye from the version you made pyseneye for, and the version I am using?
Everything starts out fine. USB shows as Bus 002 Device 008: ID 24f7:2204
`>>> from pyseneye.sud import SUDevice, Action
d = SUDevice()
d.action(Action.ENTER_INTERACTIVE_MODE)
<pyseneye.sud.EnterInteractiveResponse object at 0x7f8ac53d9dd8>`
At this point, the light on the Seneye comes on and stays solid red
When trying to get the sensor reading, the following happens
>>> s = d.action(Action.SENSOR_READING) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python3.6/dist-packages/pyseneye/sud.py", line 608, in action raise TimeoutError("Operation timed out reading response.") TimeoutError: Operation timed out reading response.
Trying to run a sensor reading again results in the following
>>> s = d.action(Action.SENSOR_READING) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python3.6/dist-packages/pyseneye/sud.py", line 584, in action self._write(cdef.cmd_str) File "/usr/local/lib/python3.6/dist-packages/pyseneye/sud.py", line 557, in _write return self._instance.write(self._ep_out, msg) File "/usr/local/lib/python3.6/dist-packages/usb/core.py", line 948, in write self.__get_timeout(timeout) File "/usr/local/lib/python3.6/dist-packages/usb/backend/libusb1.py", line 842, in intr_write timeout) File "/usr/local/lib/python3.6/dist-packages/usb/backend/libusb1.py", line 920, in __write _check(retval) File "/usr/local/lib/python3.6/dist-packages/usb/backend/libusb1.py", line 595, in _check raise USBError(_strerror(ret), ret, _libusb_errno[ret]) usb.core.USBError: [Errno 19] No such device (it may have been disconnected)
Running Ubuntu 18.04.1 LTS in a VM, USB is passthrough from Windows 10 host.
This is tested with a client that is querying the SUD once every 30 mins. When it fails I'm seeing the error shown before.
Platform Hass.io 0.87.0 on Raspberry Pi
2019-03-07 22:39:57 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.seneye_nh3 fails
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 221, in async_update_ha_state
await self.async_device_update()
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 347, in async_device_update
await self.async_update()
File "/config/custom_components/sensor/seneye.py", line 148, in async_update
await self._data.async_update()
File "/config/custom_components/sensor/seneye.py", line 164, in _async_update
device = SUDevice()
File "/config/deps/lib/python3.6/site-packages/pyseneye/sud.py", line 527, in init
if dev.is_kernel_driver_active(0):
File "/config/deps/lib/python3.6/site-packages/usb/core.py", line 1061, in is_kernel_driver_active
self._ctx.managed_open()
File "/config/deps/lib/python3.6/site-packages/usb/core.py", line 102, in wrapper
return f(self, *args, **kwargs)
File "/config/deps/lib/python3.6/site-packages/usb/core.py", line 120, in managed_open
self.handle = self.backend.open_device(self.dev)
File "/config/deps/lib/python3.6/site-packages/usb/backend/libusb1.py", line 786, in open_device
return _DeviceHandle(dev)
File "/config/deps/lib/python3.6/site-packages/usb/backend/libusb1.py", line 643, in init
_check(_lib.libusb_open(self.devid, byref(self.handle)))
File "/config/deps/lib/python3.6/site-packages/usb/backend/libusb1.py", line 595, in _check
raise USBError(_strerror(ret), ret, _libusb_errno[ret])
usb.core.USBError: [Errno 19] No such device (it may have been disconnected)
Hi,
Been using this code for 2 years now and will be adding a second USB to the Pi and want to extract values from both. I can see that d=SUDevice() delivers the serial number, but despite many attempts I cannot work out how to use <pyseneye.sud.SUDevice object at 0x76a505d0> my response, in the next request d.action(Action.ENTER_INTERACTIVE_MODE) to allow me to retrieve data from 2 USB Seneye connected to 1 RPi.
Sure its a simple fix but it has me scratching my head here.
Regards
Currently SUD interface is used. I want to add support for the API as an option, for people who want to use the Seneye.me cloud features as well.
Latest Raspian, RPI 3B+ Seneye SUD connected and visible via lsusb, I get the following error when attempting to use:
root tankpi: ~ # lsusb -v
Bus 001 Device 007: ID 24f7:2204
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 0
bDeviceSubClass 0
bDeviceProtocol 2
bMaxPacketSize0 64
idVendor 0x24f7
idProduct 0x2204
bcdDevice 1.25
iManufacturer 1 Seneye ltd
iProduct 2 Seneye SUD v 3.0.2
iSerial 3 F50020C55AC29B49AF298D090A006017
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 0x0037
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 250mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 4
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 0
bInterfaceProtocol 0
iInterface 4 HID
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.00
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 33
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01 EP 1 OUT
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x02 EP 2 OUT
bmAttributes 2
Transfer Type Bulk
Synch Type None
Usage Type Data
wMaxPacketSize 0x0040 1x 64 bytes
bInterval 0
can't get device qualifier: Resource temporarily unavailable
can't get debug descriptor: Resource temporarily unavailable
Device Status: 0x0000
(Bus Powered)
root tankpi: ~ # python3
Python 3.7.3 (default, Apr 3 2019, 05:39:12)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
from pyseneye.sud import SUDDevice, Action
Traceback (most recent call last):
File "", line 1, in
ImportError: cannot import name 'SUDDevice' from 'pyseneye.sud' (/usr/local/lib/python3.7/dist-packages/pyseneye/sud.py)
Hi,
Is this code compatible with SUD V6 ? If no, what modifications have to be done ? (productId ? ...)
Best regards.
Currently only some basic unit tests have been implemented, they provide 95% code coverage but full unit tests need to be added.
from pyseneye.sud import SUDDevice, Action
Traceback (most recent call last):
File "", line 1, in
ImportError: cannot import name 'SUDDevice' from 'pyseneye.sud' (/usr/local/lib/python3.8/dist-packages/pyseneye/sud.py)
Comments would be appreciated, both on Linux and Windows, both give me the same issue. In Linux I can see the USB device and serial number is connected to the PC, from dmesg.
Tried different computers, and two different SUDs
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.