Rademacher DuoFern

Hi,

Thanks for providing and sharing your solution! I got it to work with python from command line all is working fine, but I got in trouble with implementation to Hass.

I have configured it configuration.yaml with this code:
cover:

  • platform: duofern
    serial_port: /dev/duofernstick
    config_file: /home/homeassistant/.dufoern.json
    code: ‘XXXX’

If I do not set “serial_port”, “config_file” & “code” I got the following error.

2018-05-26 12:28:40 ERROR (MainThread) [homeassistant.config] Invalid config for [cover.duofern]: string value is None for dictionary value @ data[‘code’]. Got None
string value is None for dictionary value @ data[‘config_file’]. Got None
string value is None for dictionary value @ data[‘serial_port’]. Got None. (See ?, line ?). Please check the docs at https://home-assistant.io/components/cover.duofern/

Even there is a Problem and I can’t see the cover in Home Assistant :frowning:

Hopefully someone can help me.

Thanks
Jonny

Hi, anyone already managed to make a hass.io add-on for this?

Hello Jonny,

my config looks like this:

cover:

  • platform: duofern
    serial_port: /dev/duofernstick
    config_file: /home/homeassistant/.duofern.json
    code: xxxx

Please enter your code without the quotes ‘’.

Then iit should be working as exspected.

Tom

1 Like

Hi djonni,

Sorry, I seem to have missed my reply notification. Toms answer looks great, did that fix it?

If there are still issues: could you check the output of ls -l /dev/duofernstick (to verify the device node has the right access permissions)?
To debug what goes wrong when using it in homeassistant could you paste the lines from your homeassistant log file concerning duofern? (you can access the log via the web interface, click on ☰ (menu) on top left, then ⓘ (info) from the menu. See the full log with ↻ (circled arrow, on bottom right).

Cheers, Paul

@eXtatic,
It seems that hass.io is not meant for command line access. Therefore, given that pyduofern currently requires command line script for pairing blinds, it won’t integrate easily into hass.io (unless you open up the container command line and install it in there, but in that case you would have an easier time with plain old raspbian and a virtualenv with homeassistant on top).

So I think: As soon as pairing can be done via GUI one might think about hass.io integration. But currently I’m still working on getting the module ready for pypi release, so I don’t think that I personally will have time to deal with the gui within the next few months.

I would happily accept a pull request if somebody feels the urge to do it though :slight_smile:

Edit: I think the simplest way of supporting pairing via GUI would be to allow sending pairing requests via service calls (which can be triggered from the GUI). Wouldn’t need extra GUI implementation but would allow setting up without the need for command line

Cheers,
Paul

@gluap, too bad to hear that you don’t have time for hass.io migration.

Currently I’m stuck with installation (setup.py fails) in the docker container.
Will try to SSH into the container in the next days to see whats happening.
Unfortunately I’m pretty noob in everything related i.e. Docker, Python, Unix … :nerd_face:

Every bit of help is appreciated!

1 Like

Hi Tom74,

thanks for your help!
Now it works - I don’t know why because I tried it several times with quotes and without quotes.
I copied your configuration into my configuration and yes it works :slight_smile:

Thanks so much!!

@gluap,
I forked your repo and changed the REQUIREMENTS to directly install pyduoferm from GitHub, thus installation on hass.io is now working. I know that this is not appreciated by HA Devs but as soon as you managed the pypi release we’re back on track with an officially supported method for hass.io.

Since i can’t test with HASSbian I don’t know if the installation from GitHub will work for you.

Next step will be the pairing, no clue yet, we’ll see

UPDATE: No luck today, still no clue how to start pairing in hass.io

UPDATE 2: Managed to pair via addon :vulcan_salute:

UPDATE 3: Readme updated in forked repository

4 Likes

Nice to hear that you got it working this quickly with hass.io.

I’m now satisfied with the current state of the module at least what concerns roller shutters (mostly been working on unit tests recently) and will hopefully to push to pypi within the next days.

Next step after that will be to change the homeassistant integration to work with the (now rudimentarily unit-tested) asyncio implementation to comply with homeassistant coding standards. Once that is done I can have a look at how other modules do gui-based pairing (I’ve seen something like this at least for Trådfri) and maybe work towards preparing a pull request for homeassistant.

It’s still not tested against anything but roller shutters and once or twice running with a switch actor though.

Update: I pushed to pypi, pip install pyduofern is all it needs now.

Cheers,
Paul

This is good news regarding pypi, means theoretically that my changes to your custom component are obsolete. HA should be able to automatically resolve the REQUIREMENTS now. So basically no need to install it manually like mentioned in your Getting Started if I understand the HA documentation.

Will give it a try for hass.io maybe on Sunday but should be independent of the platform HA is running.

I now started thinking about further automation and integration in my infrasructure.
For that it would be nice to be able to check in automations if the roller shutter is opening or closing at the moment.
I use a 2 button remote to control it, but as of now I can’t stop the roller shutter during actuation. I’d need a third button to stop it like in the HA GUI.
The pyhical buttons at the roller shutter provide this functionality.
Is there a possibility to get this information in HA?

I also have a two-button remote: mine sends two messages for each button, “down” when the button is pressed and “up” when it is released. For that one I automated the “up” signal to stop the blinds.

Unfortunately the blinds do not transfer whether they are moving or not, but as they send their position once they stop I could still get the information from duofern. But I’m not sure how reliably the position information arrives once the blind has moved.

If that does not work one could work on the basis of assuming that the blind moves at most for 30 seconds and just guesstimate that it stays moving for that amount of time unless stopped by a command.

Homeassistant supports an “Opening” and “Closing” state. I’ll look into feeding that using the arrival of the position state. [from homeassistant/components/cover/init.py]:

    def state(self):
        """Return the state of the cover."""
        if self.is_opening:
            return STATE_OPENING
        if self.is_closing:
            return STATE_CLOSING

Cheers,
Paul

Hm… didn’t understand your button logic :sweat_smile:, but my buttons only support one message on button press.

I just did some testing on repsonse times and it took 5 to 15 seconds to display the updated position in HA after I pressed the stop button in the GUI. I’d be happy to test the implementation anyway.

Edit: reply removed - as it turns out, I had the wrong stick :confounded:

Hello, thank you it’s works on my home assistant

I am stuck. I added the entries to the config, added the custom components like in https://github.com/dhzl84/Home-Assistant-Configuration but it always complains:

2019-02-14 19:37:00 ERROR (MainThread) [homeassistant.loader] Error loading custom_components.cover.duofern. Make sure all dependencies are installed
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/loader.py", line 117, in _load_file
    module = importlib.import_module(path)
  File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/config/custom_components/cover/duofern.py", line 14, in <module>
    from pyduofern.duofern_stick import DuofernStickThreaded
ModuleNotFoundError: No module named 'pyduofern'

This is hass.io.

Any advice?

It somehow started working after installing the pip module manually in the homeassistant container. But this should not be the normal way, right?

Hi, this should not be necessary. Which custom_component did you use? The original from @gluap or mine.

Uhm. The original? Where is yours? :blush:

I made a fork of gluaps repository to add a hass.io addon for pairing (instead of using CLI) but now that we are talking about, this fork relation somehow got lost on GitHub …

I see that gluaps custom_component installs a specific version (0.23.2) of pyduofern via REQUIREMENTS = ['pyduofern==0.23.2'] in duofern.py.
Meanwhile he release version 0.23.4 of the pyduofern package but I can’t tell if this is causing any issues.

Ok cool. Thanks.

At least we wrote it here for future reference :slight_smile: