gluap / pyduofern Goto Github PK
View Code? Open in Web Editor NEWLicense: GNU General Public License v2.0
License: GNU General Public License v2.0
Hi,
the USB-Stick DuoFern 70000093 is not available anymore.
The DuoFern 70000093 is a Z-Wave USB stick, can it be replaced by a Aeotec AEOEZW090-C?
The latest available source tarball from PyPI doesn't contain all files needed to run the tests.
]$ ls -lisa pyduofern-0.34.0/pyduofern/tests/
total 20
5661034 4 drwxr-xr-x. 5 x21 x21 4096 Sep 3 08:47 .
5661033 4 drwxr-xr-x. 3 x21 x21 4096 Sep 3 08:47 ..
5661035 4 drwxr-xr-x. 2 x21 x21 4096 Sep 3 08:47 files
5661036 4 drwxr-xr-x. 2 x21 x21 4096 Sep 3 08:47 recording
5661037 4 drwxr-xr-x. 2 x21 x21 4096 Sep 3 08:47 replaydata
Hi,
Python is completely new for me and I just managed to pair my five roller shutter motors and I am able to open and close them. Amazing work, thank you so far!
But I didn't find an option in the duofern_cli.py script to STOP a moving motor.
The example for home assistant implies that it's possible that it should possible.
Is there something I overlooked or is it not possible via the CLI?
Thank you!
Hello,
How can I update an existing (working) pyduofern integration on my HA?
Do I loose anything with upgrade?
Thank you for the help.
Hi, first thank you for your efforts! Currently I havent bought products from rademacher, but I want to.
I just want to be sure that I have understood the project correctly before buying something that expensive.
When I am going to buy rolltron products (for example the rademacher rolltron 1200), then I will only need the duofern usb stick plugged into my raspberry pi running Homeassistant OS and with this custom integration it should work?
I just want to be sure, that Homeassistant OS will work fine and that I dont need another bridge from rademacher.
Are the „ DuoFern Heizkörperstellantrieb 2 “ also supported?
Thank you in advance for answering the questions :)
Hi, I just updated to HA 0.89 and the duofern custom component stopped working.
I already tried to update to the latest version (commit 29a0505) but it fails to initialize.
Error log:
Error while setting up platform duofern
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_platform.py", line 128, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File "/usr/local/lib/python3.7/asyncio/tasks.py", line 416, 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/duofern/cover.py", line 20, in setup_platform
stick = hass.data[DOMAIN]['stick']
KeyError: 'duofern'
my configuration.yaml:
cover:
- platform: duofern
serial_port: /dev/ttyUSB1
config_file: duofern.json
code: !secret duofern_code
Hi,
is there a possibility to add the Duofern Umweltsensor 9475 and the Duofern Connect Aktor 9477 to your plugin. Would be great to make automations directly in Hass/HA with the weather informations. Would be great to, I can close my Markise if it starts raining or its to much windy.
In the duofern.json I can see that the Umweltsensor and the Connect aktor are connected yet. Maybe there are only the configuration lost and it is easily for you!?
Duofern APi as ported from perl allows for a number of commands not available via homeassistant. It should be feasible to register them for calling through the services API of homeassistant.
I have started some work to get this running in my branch of your project
https://github.com/bugfinder/pyduofern
apparently all ids some in as lowercase on my system, maybe the items you tested were
all numerical up to now.
with my changes and a little debug code I can get the ID of the pushed button, but now
I do not have enough knowledge of home-assistant (or actually of python in general ...)
to get this working as a usable sensor in HA.
what I get with debugging is:
[/usr/lib/python3.6/site-packages/pyduofern/duofern.py] DUOFERN taster msg: 0f01071a0000010300000000040002ad23116faffe00
[/usr/lib/python3.6/site-packages/pyduofern/duofern.py] DUOFERN taster code: ad2311
[/usr/lib/python3.6/site-packages/pyduofern/duofern.py] DUOFERN taster chan: 03
[/usr/lib/python3.6/site-packages/pyduofern/duofern.py] DUOFERN taster id: 071a
[/usr/lib/python3.6/site-packages/pyduofern/duofern.py] DUOFERN taster chans: ['03']
[/usr/lib/python3.6/site-packages/pyduofern/duofern.py] DUOFERN taster msg: 0f01071a0000010400000000040002ad23116faffe00
[/usr/lib/python3.6/site-packages/pyduofern/duofern.py] DUOFERN taster code: ad2311
[/usr/lib/python3.6/site-packages/pyduofern/duofern.py] DUOFERN taster chan: 04
[/usr/lib/python3.6/site-packages/pyduofern/duofern.py] DUOFERN taster id: 071a
[/usr/lib/python3.6/site-packages/pyduofern/duofern.py] DUOFERN taster chans: ['04']
[/usr/lib/python3.6/site-packages/pyduofern/duofern.py] DUOFERN taster msg: 0f01071a0000010500000000040002ad23116faffe00
[/usr/lib/python3.6/site-packages/pyduofern/duofern.py] DUOFERN taster code: ad2311
[/usr/lib/python3.6/site-packages/pyduofern/duofern.py] DUOFERN taster chan: 05
[/usr/lib/python3.6/site-packages/pyduofern/duofern.py] DUOFERN taster id: 071a
[/usr/lib/python3.6/site-packages/pyduofern/duofern.py] DUOFERN taster chans: ['05']
so I do get the action "071a" -> "pressed" as "id" and the button number
between "01" and "06" as "chan".
how to continue from there ?
To decouple the Home Assistant Host from the host with the USB Device, it might make sense to utilize the cover.mqtt integration instead of having a custom component.
The duofern.start_pairing
and duofern.sync_devices
custom services wouldn't be possible though.
We could probably map them to switch.mqtt entities
I got one of the Duofern smoke detectors (ER10018992 and 32001664) for testing and it doesn't seem to be recognized. The IDs are correctly defined in the definitions.py from what I can see.
Smoke detector: https://github.com/gluap/pyduofern/blob/master/pyduofern/definitions.py#L55
Start smoke: https://github.com/gluap/pyduofern/blob/master/pyduofern/definitions.py#L76
End smoke: https://github.com/gluap/pyduofern/blob/master/pyduofern/definitions.py#L77
Pairing:
homeassistant_1 | 2020-08-20 11:53:24 WARNING (SyncWorker_37) [custom_components.duofern] start pairing
homeassistant_1 | 2020-08-20 11:53:24 INFO (Thread-4) [/usr/local/lib/python3.8/site-packages/pyduofern/duofern_stick.py] sending 04000000000000000000000000000000000000000000 from write queue, 0 msgs left in queue
homeassistant_1 | 2020-08-20 11:53:32 INFO (Thread-4) [/usr/local/lib/python3.8/site-packages/pyduofern/duofern_stick.py] got pairing reply
homeassistant_1 | 2020-08-20 11:53:32 INFO (Thread-4) [/usr/local/lib/python3.8/site-packages/pyduofern/duofern.py] detected unknown device, ID=ab49b6
homeassistant_1 | 2020-08-20 11:53:32 INFO (Thread-4) [/usr/local/lib/python3.8/site-packages/pyduofern/duofern.py] DUOFERN device paired, ID ab49b6
homeassistant_1 | 2020-08-20 11:53:32 INFO (Thread-4) [/usr/local/lib/python3.8/site-packages/pyduofern/duofern_stick.py] paired new device 40535c
homeassistant_1 | 2020-08-20 11:53:32 INFO (Thread-4) [/usr/local/lib/python3.8/site-packages/pyduofern/duofern_stick.py] paired new device 40bb37
homeassistant_1 | 2020-08-20 11:53:32 INFO (Thread-4) [/usr/local/lib/python3.8/site-packages/pyduofern/duofern_stick.py] paired new device ab49b6
homeassistant_1 | 2020-08-20 11:53:54 INFO (Thread-4) [/usr/local/lib/python3.8/site-packages/pyduofern/duofern_stick.py] sending 05000000000000000000000000000000000000000000 from write queue, 1 msgs left in queue
homeassistant_1 | 2020-08-20 11:53:54 INFO (Thread-4) [/usr/local/lib/python3.8/site-packages/pyduofern/duofern_stick.py] sending 05000000000000000000000000000000000000000000 from write queue, 0 msgs left in queue
Test alarm:
homeassistant_1 | 2020-08-20 12:11:38 WARNING (Thread-4) [/usr/local/lib/python3.8/site-packages/pyduofern/duofern.py] unknown message 0fff071e0100010000000000100002ab49b66f8d1c00
homeassistant_1 | 2020-08-20 12:11:38 ERROR (Thread-4) [/usr/local/lib/python3.8/site-packages/pyduofern/duofern_stick.py] '071e'
homeassistant_1 | Traceback (most recent call last):
homeassistant_1 | File "/usr/local/lib/python3.8/site-packages/pyduofern/duofern_stick.py", line 595, in run
homeassistant_1 | self.process_message(in_data)
homeassistant_1 | File "/usr/local/lib/python3.8/site-packages/pyduofern/duofern_stick.py", line 227, in process_message
homeassistant_1 | self.duofern_parser.parse(message)
homeassistant_1 | File "/usr/local/lib/python3.8/site-packages/pyduofern/duofern.py", line 562, in parse
homeassistant_1 | chan = msg[sensorMsg[id]['chan'] * 2 + 2:sensorMsg[id]['chan'] * 2 + 4]
homeassistant_1 | KeyError: '071e'
homeassistant_1 | 2020-08-20 12:12:24 WARNING (Thread-4) [/usr/local/lib/python3.8/site-packages/pyduofern/duofern.py] unknown message 0fff071f0100010000000000100002ab49b66f8d1c00
homeassistant_1 | 2020-08-20 12:12:24 ERROR (Thread-4) [/usr/local/lib/python3.8/site-packages/pyduofern/duofern_stick.py] '071f'
homeassistant_1 | Traceback (most recent call last):
homeassistant_1 | File "/usr/local/lib/python3.8/site-packages/pyduofern/duofern_stick.py", line 595, in run
homeassistant_1 | self.process_message(in_data)
homeassistant_1 | File "/usr/local/lib/python3.8/site-packages/pyduofern/duofern_stick.py", line 227, in process_message
homeassistant_1 | self.duofern_parser.parse(message)
homeassistant_1 | File "/usr/local/lib/python3.8/site-packages/pyduofern/duofern.py", line 562, in parse
homeassistant_1 | chan = msg[sensorMsg[id]['chan'] * 2 + 2:sensorMsg[id]['chan'] * 2 + 4]
homeassistant_1 | KeyError: '071f'
Might just be looking for lowercase 071e and 071f but they are uppercase in definitions.py.
I have bought a RolloTube I-line Duofern Medium roller shutter. Unfortuantely Rademacher has changes the pairing code from 6 digits to 10 digits.
Pairing isnot possible and I got errors:
Output:
entering pairing mode
2021-07-04 18:23:45,858: sending 04000000000000000000000000000000000000000000 from write queue, 0 msgs left in queue
2021-07-04 18:23:46,386: got pairing reply
2021-07-04 18:23:46,386: detected unknown device, ID=XXXXXX
2021-07-04 18:23:46,388: DUOFERN device paired, ID XXXXXX
2021-07-04 18:23:46,393: paired new device XXXXXX
2021-07-04 18:23:48,178: Unknown msg: 0fff0606000112400301000000000XXXXXXYYYYYY
2021-07-04 18:23:53,249: DUOFERN unknown msg: YYYYYYce3005a1a1100000000000XXXXXXXffffff01
2021-07-04 18:24:45,621: sending 05000000000000000000000000000000000000000000 from write queue, 1 msgs left in queue
2021-07-04 18:24:45,640: sending 05000000000000000000000000000000000000000000 from write queue, 0 msgs left in queue
It would be nice to have the custom component available in HACS so updating is easier.
The requirements are listed here: https://hacs.xyz/docs/publish/start
While it's possible to get a sub directory added as repository it probably would make more sense to copy the current HA component to a new repository?
Hi
Thank you for you great work.
I followed your readme file for the installation with Hassio and had an issue where the duofern was not initialized properly. After looking around in the code I found that in the init python file two lines were mentioning /dev/serial/by-id/usb-Rademacher_DuoFern_USB-Stick_WR04ZFP4-if00-port0
but in the gui in the hardware tab mine said /dev/serial/by-id/usb-Rademacher_DuoFern_USB-Stick_WR029BQK-if00-port0.
I replaced these two mentions with the one I got and it's working like a charm.
Maybe add this step in your documentation so that other n00bs like me don't search what they did wrong for hours.
Keep up the good work and thanks again
found a new device ID for another USB Stick.
/dev/serial/by-id/usb-Rademacher_DuoFern_USB-Stick_WR04ZFNM-if00-port0
I don't know what happened, but when I try to to start the script, I get the following error:
Traceback (most recent call last):
File "/home/openhabian/.local/bin/duofern_cli.py", line 26, in <module>
from pyduofern.duofern_stick import DuofernStickThreaded
ModuleNotFoundError: No module named 'pyduofern'
I'm an absolute noob in python, but when I try to install the package it looks fine:
openhabian@openHABianPi:/ $ pip3 install pyduofern
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Requirement already satisfied: pyduofern in /home/openhabian/.local/lib/python3.7/site-packages (0.34.1)
Requirement already satisfied: pyserial-asyncio in /home/openhabian/.local/lib/python3.7/site-packages (from pyduofern) (0.5)
Requirement already satisfied: pyserial in /home/openhabian/.local/lib/python3.7/site-packages (from pyduofern) (3.5)
openhabian@openHABianPi:/ $
Where's my mistake/problem? Thanks!
Hello,
thanks for all your great efforts for bringing great functionality to the world!
Followed your manual to for udev using the serial.
Reinserted the stick: alias works
Initializing the stick with "duofern_cli.py --code <your chosen 4 digit hex code here>" shows "Permission denied for TtyS0".
Can be fixed with chmod a+rw.
-> then works. However I don't get why this is necessary (and it's also not pointed out in your manual).
When starting pairing mode with "duofern_cli.py --pair --pairtime 60" then following exception is thrown:
entering pairing mode
Traceback (most recent call last):
File "/home//.local/bin/duofern_cli.py", line 301, in
stick._initialize()
File "/home//.local/lib/python3.7/site-packages/pyduofern/duofern_stick.py", line 550, in _initialize
raise DuofernTimeoutException("Initialization failed ")
pyduofern.exceptions.DuofernTimeoutException: Initialization failed
Please note that the stick is constantly blinking the green LED. When insterted for few seconds the red & green LEDs are constantly on, then only the green LED is blinking and the red one is off.
THANK YOU SO MUCH FOR YOUR SUPPORT!!!
There is a new logger warning with 0.109:
2020-04-30 11:58:57 WARNING (MainThread) [homeassistant.helpers.translation] duofern: the '.translations' directory has been moved, the new name is 'translations', starting with Home Assistant 0.111 your translations will no longer load if you do not move/rename this
Solution:
rename
pyduofern/examples/homeassistant/custom_components/duofern/.translations/
to
pyduofern/examples/homeassistant/custom_components/duofern/translations/
Hi, I just came across your pyduofern. I own an old homepilot 1 and I would like to get rid of it and use it's DuoFern stick standalone. I have paired 13 Rollotube RTFM 10/16 Z Funk motors. All of them had a label with a 6-digit code for pairing and I also know the device codes that I use together with my homepilot's http-api. As I am afraid of a hardware breakdown I am looking for a solution to only use the duofern stick. I once saw the perl code from fhem but I don't use fhem (only openhab) and also I am not at all familiar with perl. I can read and write c, c++ and python.
Is it possible to use your python module on a raspberry pi or similar and communicate with the stick attached to the pi? I guess it would not be necessary to pair the motors again. Am I right? What functions do I have to use in order to send commands to my motors?
Best regards
Frank
Hello gluap,
I use the custom component for Home Assistant since quite some time and it was rock solid until the switching to 0.34.1.
I did not change anything than replacing the duofern folder in custom_components.
Home Assistant throws this warning at me, but I have no clue how to fix it.
Logger: /usr/local/lib/python3.8/site-packages/pyduofern/duofern_stick.py
Source: /usr/local/lib/python3.8/site-packages/pyduofern/duofern_stick.py:597
First occurred: 9:48:55 PM (1 occurrences)
Last logged: 9:48:55 PM
update_callback() missing 3 required positional arguments: 'id', 'key', and 'value'
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/pyduofern/duofern_stick.py", line 595, in run
self.process_message(in_data)
File "/usr/local/lib/python3.8/site-packages/pyduofern/duofern_stick.py", line 227, in process_message
self.duofern_parser.parse(message)
File "/usr/local/lib/python3.8/site-packages/pyduofern/duofern.py", line 203, in parse
self.update_state(code, "version", ver, "0", channel=channel)
File "/usr/local/lib/python3.8/site-packages/pyduofern/duofern.py", line 128, in update_state
self.changes_callback()
TypeError: update_callback() missing 3 required positional arguments: 'id', 'key', and 'value'
Hope you'll find some time to look into that, I'll revert to 0.30 for now.
Thank you in advance!
Hi,
I managed to get the new version running but when I send a command, this error shows up
2019-04-08 06:52:35 INFO (Thread-3) [/srv/homeassistant/lib/python3.6/site-packages/pyduofern/duofern_stick.py] sending 0D01070100000000000000000000006f301140106e00 from write queue, 0 msgs left in queue
2019-04-08 06:52:35 ERROR (Thread-3) [/srv/homeassistant/lib/python3.6/site-packages/pyduofern/duofern_stick.py] 'id'
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.6/site-packages/pyduofern/duofern_stick.py", line 577, in run
self.process_message(in_data)
File "/srv/homeassistant/lib/python3.6/site-packages/pyduofern/duofern_stick.py", line 227, in process_message
self.duofern_parser.parse(message)
File "/srv/homeassistant/lib/python3.6/site-packages/pyduofern/duofern.py", line 521, in parse
chan = msg[sensorMsg['id']['chan'] * 2 + 2:sensorMsg['id']['chan'] * 2 + 4]
KeyError: 'id'
Config
duofern:
serial_port: /dev/cuaU2
code: !secret duofern_code
Any clue? :D
Hi,
first of all, thanks for this great implementation!
I got everything working on the command line, and I am now trying to get access directly from python working.
Executing your example
from pyduofern.duofern_stick import DuofernStick
import time
stick = DuofernStick(device="/dev/duofernstick") # by default looks for /dev/duofernstick
stick_initialize() # do some initialization sequence with the stick
stick.start() # start the stick in a thread so it keeps communicating with your blinds
time.sleep(10) # let it settle to be able to talk to your blinds.
# your code here
# this uses internal variables of the duofern parser module and likely I will wrap it in
# the future.
print(stick.duofern_parser.modules['by_code']['1ff1d3']['position'])
.. throws error:
Traceback (most recent call last):
File "rollo_test.py", line 4, in <module>
stick = DuofernStick(device="/dev/duofernstick") # by default looks for /dev/duofernstick
File "/usr/local/lib/python3.5/dist-packages/pyduofern/duofern_stick.py", line 85, in __init__
super().__init__(*args, **kwargs)
TypeError: object.__init__() takes no parameters
/dev/duofernstick is available on my system.
Removing the "device="/dev/duofernstick" part from stick object creation code, leaving "stick = DuofernStick()", throws error:
Traceback (most recent call last):
File "rollo_test.py", line 5, in <module>
stick = DuofernStick() # by default looks for /dev/duofernstick
File "/usr/local/lib/python3.5/dist-packages/pyduofern/duofern_stick.py", line 92, in __init__
duofern_parser = Duofern(send_hook=self.add_serial_and_send, changes_callback=changes_callback)
AttributeError: 'DuofernStick' object has no attribute 'add_serial_and_send'
Any idea what I am doing wrong?
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.