core: EnOcean : switch doesn't control the device but changes when you manually change th state

The problem

I have a nodon switch,behind a double light switch, with 2 inputs/outputs to control my lights.

  • When i use the light switch. In home assistant, the state changes good.
  • When i want to modify the state with home Assistant. The light doesn’t switch on (but the switch button changes on lovelace without any changes for the light)

Environment

Home Assistant 0.107.1

arch armv7l
dev false
docker true
hassio true
os_name Linux
os_version 4.19.106-v7
python_version 3.7.6
timezone Europe/Paris
version 0.107.1
virtualenv false

Raspberry 2

  • Home Assistant release with the issue:
  • Last working Home Assistant release (if known):
  • Operating environment (Hass.io/Docker/Windows/etc.):
  • Integration causing this issue:
  • Link to integration documentation on our website:

First time, i try to use it

Hostname | homeassistant System | HassOS 3.12 Deployment | production

https://www.home-assistant.io/integrations/enocean/

Problem-relevant configuration.yaml



> configuration.yaml
> enocean:
>   device: /dev/serial/by-id/usb-EnOcean_GmbH_EnOcean_USB_300_DB_FT1SEG8Y-if00-port0
> 
> 
> switch nodon_escalier01:
>   - platform: enocean
>     id: [0x00,0x00,0x00,0x00]
>     name: Lumiere_couloir
>     channel: 0
> 
> switch nodon_escalier02:
>   - platform: enocean
>     id: [0x00,0x00,0x00,0x00]
>     name: Lumiere_entree
>     channel: 1  
> 

_lovelace
 - entities:
          - entity: switch.lumiere_couloir
          - entity: switch.lumiere_entree_

Traceback/Error logs


Additional information

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 39 (6 by maintainers)

Most upvoted comments

Hi @Afterster , I am currently working on building a UI-ready version of the ENOcean integration (one that can be configured from the UI and detect devices automatically). I am making progresses on that project, it is now able to control a nodOn switch from hass, after the switch has been discovered automatically using the association procedure of the device, but there is still quite some work to be done. I still need to find how to restore created entities when hass is restarting notably. I am working on it, but sadely, I cannot give a date for a release. It is my first contribution to the project, I have tons to learn on the way, that takes time 😃.

Hello,

I’ve got some issues with Enocean Integration.

I start with HA which is my first home integration. All equipments in my house are in Enocean standard (Nodon, Eltako, Peha) and I hoped Home Assistant could work with. It does’t seems so easy…

Just to say, for a newbee, begin with HA and Enocean at the same time is very hard… Most part of tutoriels are helpfull when you have standard systems (like Hue). But there is no tutorial for Enocean devices. This message is just to encourage you to continue Enocean development. I nice tutorial (for me) will be to know how integrate Nodon relay ON/OFF (SIN-2-x-x - EEP : D2-01-0F) with a wall switch with momentary impulses (CWS-2-1-01 - EEP : F6-02-01 (same as Eltako FT55). So simple ! But so difficult (for me) with HA.

That was my first message on Github …

Franck

@olivvv59 I had the exact same problem as the one you currently experience, and I have just solved it!

Your code seems right (you just need to put the correct switch IDs on the configuration.yaml file), the main problem here is that your modules do not allow instructions from your usb device. I guess that a kind of integration/learning/teaching/pairing is required (or whatever the name of the process is). I may be mistaken, but I do not think that one can deal with this via HA.

As a result, I used the DolphinView Advanced software that is used to send telegrams between devices. You need to create an account by the way. You need as well to send the right data for the pairing. I found configuration files at the following address: https://assistance.domadoo.com/category/documentations-et-manuels-produit/nodon/229/

Once you have the software installed, and the right .do files (or at least the exact codes to send for the pairing), you may follow the following steps:

  • Connect your dongle to your computer
  • Launch the DolphinView Advanced software, select the appropriate dongle, whose ID (written at the very end of the device name) will be needed later, and connect to it.
  • Select the “Telegram Transmit” tab (may be hidden because it is the last one) At this time, you may monitor the different telegrams transmitted around. Try different switches. After being used, they will appear on the left side of the window.
  • Load the required .do file to get the appropriate telegram that allows pairing. For example, on the .od files I used, the first one labeled “Send UTE telegram” is the one to use for pairing. For each switch:
  • Fill the “ID” box (which is the SenderID of the telegram), with the dongle ID. I guess a BaseID may be used as well, but it was not necessary in my case.
  • Fill the “DestinationID” with the switch ID (listed on the left), same as those written in your HA configuration.yaml file
  • Put your switch in pairing mode
  • Execute! Once done, you can try to send other kind of telegram, like turn ON, turn OFF, in order to check that your switches are correctly paired with your dongle.

If it is the case, restart HA with your dongle, and voilà!

The problem is that the HA team does not accept changes to the enocean component unless it is refactored to comply with the latest code style. But nobody want’s to do the upgrade (myself included), so things won’t change…

I did a few changes a while back and to be honest, the manufacturers are to blame too, (IMO) needlessly adding multiple device types to the protocol instead of using the existing ones. It’s almost impossible to deal with all “switches” in an uniform way (e.g. my standard-type switches work just fine but nodon thought it would be cool to use a different device type message)

* `docker exec -it homeassistant /bin/bash` -> sneak into the container

* `pip install --upgrade enocean` -> install latest python enocean lib
  
  * this gets resetted after each restart, but you only need it ones for the teach-in

* `apk add nano` -> could also be skipped if you use `vi`

* `nano -c /usr/src/homeassistant/homeassistant/components/enocean/dongle.py` -> add the following changes
  
  * **set the base_id manually** after creating the SerialCommunicator (this should work out of the box, but it doesn't) (line number 30)
    `self._communicator.base_id = [0xFF, 0x99, 0x87, 0x0] # this is the id of my dongle, don't know if any other id is working here too`
  * **add the base_id to each message**, by changing the `_send_message_callback` (this is not a "release ready" implementation, don't know if this breaks something else) (line number 49)
    I had also a version where I added the ID directly in the _switch.py_, but we do not have the communicator object there. 🤔
    ```
    def _send_message_callback(self, command):
            """Send a command through the EnOcean dongle."""
            base_id_location = 4
            for i in range(len(self._communicator.base_id)):
                command.data[base_id_location + i] = self._communicator.base_id[i]
            self._communicator.send(command)
    ```

* `exit` -> leave docker bash

* `docker restart homeassistant` -> restart core

* Go to your device and trigger a "teach-in", on my NodOn its a triple button press

So nice ! Thanks @KarlKl ! I hope this trick stay stable in time. For those who wants to try, take extra care to avoid the “TabError: inconsistent use of tabs and spaces in indentation” modifyng dongle.py file. FYI, I didn’t need to configure and connect via SSH on port 2222. I have HA-core in a docker, so I just connect via SSH (port 22) onto my machine, and then directly connect into the docker container as discribed.

@matthieuvw I have a NodOn SIN-2-2-00 and can’t reproduce your behavior. I always get the status back.

I now have everything set up and working inside HA. I resetted everything and started all over with these steps:

  • I used latest homeassistant core-2021.2.3
  • login to HA with SSH(22222) as described here
  • docker exec -it homeassistant /bin/bash -> sneak into the container
  • pip install --upgrade enocean -> install latest python enocean lib
    • this gets resetted after each restart, but you only need it ones for the teach-in
  • apk add nano -> could also be skipped if you use vi
  • nano -c /usr/src/homeassistant/homeassistant/components/enocean/dongle.py -> add the following changes
    • set the base_id manually after creating the SerialCommunicator (this should work out of the box, but it doesn’t) (line number 30) self._communicator.base_id = [0xFF, 0x99, 0x87, 0x0] # this is the id of my dongle, don't know if any other id is working here too
    • add the base_id to each message, by changing the _send_message_callback (this is not a “release ready” implementation, don’t know if this breaks something else) (line number 49) I had also a version where I added the ID directly in the switch.py, but we do not have the communicator object there. 🤔
      def _send_message_callback(self, command):
              """Send a command through the EnOcean dongle."""
              base_id_location = 4
              for i in range(len(self._communicator.base_id)):
                  command.data[base_id_location + i] = self._communicator.base_id[i]
              self._communicator.send(command)
      
  • exit -> leave docker bash
  • docker restart homeassistant -> restart core
  • Go to your device and trigger a “teach-in”, on my NodOn its a triple button press

Hi there, Just to add myself to the list for more enocean support. I allready posted a message on the forums about my roller shutters for which there is apparently no support… https://community.home-assistant.io/t/enocean-need-help-to-install-eltako-nsb61np-230v-roller-shutters/255731

Feel free if I can help with something or test something !

I guess this means that at least your NodOn modules are paired with your dongle. Can you still monitor with HA when you toggle a switch ?

It could be a probleme with your HA configuration.

Just to crosscheck your code, please find below an extract of my configuration.yaml, the indication to consider on the NodOn module being “ID : 0528415D” (and not the SN). FYI I only have 1 channel modules.

enocean:
  device: /dev/ttyUSB0

switch nodon_ch2_0:
  - platform: enocean
    id: [0x05,0x28,0x41,0x5D]
    name: Chambre_2
    channel: 0

As this worked for me (HA 107.7), I do not have any other suggestion…

If I understood correctly, you attempt to trigger the enocean switch from HA? Is it really a switching device (relay) or just a stateless button (nodon wall switch)?

Do you have any specification document for the switch? Maybe these switches expect a different message or format, I can take a look at that next week.