RFXtrx Cover

Hi

I have found a problem that RFXtrx Cover don’t store latest state, is it possible to add it?

I had a discussion with tomeeka in https://github.com/home-assistant/home-assistant/pull/30309 where he had the same request. I have developed something, which I would like to ask several people to test it. It works on my dummy cover (I don’t have one myself), but I would like to have it tested by others to see if it works for (real) rfxtrx cover devices.

Note that the state is also restored during restarts of home assistant, also for lights and switches.

To test is, please copy the entire rfxtrx folder from my github in .homeassistant/custom_components, in such way that you e.g. get /home/homeassistant/.homeassistant/custom_components/rfxtrx/switch.py, etc and restart home assistant to load the custom_component.

If it all works, I will submit it to the home assistant code. Don’t forget to remove the custom component when it’s released.

Please report back if it works (state should be open/closed instead of unknown) and it the state is kept during restarts of home assistant.

Well I saw this thread and have Somfy RTS cover. I copied the folder into the right place.
I see now that the covers not unknown anymore. But have the state closed.
image
image

Will check tomorrow morning if the state is changing when we open the covers. But this looks good.

Thanks. The first state is indeed closed if you just started the component. After a change (open or stop opening), it should change to open. Let me know tomorrow. Could you also try a restart of home assistant tomorrow to see if it restores the correct state?

@Ernst Okay good to know. I will let you know tomorrow.
Yes sure I will restart HA after changing the covers and check if the state is correct.

Thank you.

Just tested it. Works like a charm! :slight_smile:
Sending stop/open commands changes the state to open, closing changes the state to closed.
States are kept during a HA restart.
Great work!

Thanks, I’ll wait for the response of @silver323 and after that will create a PR. Don’t forget to remove the custom component after the release.

I’ve tested this morning and it works. State changed when opening and stopped.
Also restarted the HA and the latest state shows. So works well.
Only not with the remote but that’s because there not 2 way communication.

Thanks for the great work.

@silver323, thanks. This might be solveable too, I see a similar function in RFlink, that picks up remote signals and updates the state accordingly. But I need your help with testing it, as I don’t have a cover and remote. I’ll update the code, and will ask you again to test later.

@Ernst that will be nice. But i’m using the RFXCOM RFXtrx USB 433.92MHz receiver not an rflink.
But maybe it’s the same that it receives the remote signal as well?

I know, but I’m trying to do the same as they do for the RFlink device. There is some part in the code for RFlink that picks ups signals of remotes and changes the state. Should be possible to do the same for RFXcom, I suppose. But I have to figure out what parts of the code I need to copy.

Okay that sounds nice. Let me know when i need to test something. :+1:

I need some help. Can you turn on debugging for rfxtrx and see what signal is being send if you open/close/stop the cover with a remote. There should be a message in your log that looks like “Device_id: 09979a6_11 device_update. Command: Off”. I need the part after Command, probably something like “On” or “Open”.

To do this, please add the following to your configuration.yaml

# Enables logger
logger:
  default: warning
  logs:
    custom_components.rfxtrx: debug

@Ernst i’ve add the debug mode and restart HA.
Then i tested with the remote. But not receive any message what looks like your example.

2020-01-05 12:50:33 DEBUG (Thread-2) [custom_components.rfxtrx] Receive RFXCOM event from (Device_id: 4c_0e Class: RFXtrxDevice Sub: 7, Pkt_id: 0a5207534c0e00d0310179)
2020-01-05 12:51:07 DEBUG (Thread-2) [custom_components.rfxtrx] Receive RFXCOM event from (Device_id: 20_0e Class: RFXtrxDevice Sub: 7, Pkt_id: 0a520754200e00bd380169)
2020-01-05 12:51:09 DEBUG (Thread-2) [custom_components.rfxtrx] Receive RFXCOM event from (Device_id: 53_0e Class: RFXtrxDevice Sub: 7, Pkt_id: 0a520755530e00bd320169)
2020-01-05 12:51:10 DEBUG (Thread-2) [custom_components.rfxtrx] Receive RFXCOM event from (Device_id: 3e_0e Class: RFXtrxDevice Sub: 7, Pkt_id: 0a5207563e0e00ba3b0169)
2020-01-05 12:51:18 DEBUG (Thread-2) [custom_components.rfxtrx] Receive RFXCOM event from (Device_id: 4c_0e Class: RFXtrxDevice Sub: 7, Pkt_id: 0a5207574c0e00d0310169)
2020-01-05 12:51:50 DEBUG (Thread-2) [custom_components.rfxtrx] Receive RFXCOM event from (Device_id: 20_0e Class: RFXtrxDevice Sub: 7, Pkt_id: 0a520758200e00bd380169)
2020-01-05 12:51:53 DEBUG (Thread-2) [custom_components.rfxtrx] Receive RFXCOM event from (Device_id: 4b4860_32 Class: RFXtrxDevice Sub: 10, Pkt_id: 08200a594b48600669)
2020-01-05 12:51:54 DEBUG (Thread-2) [custom_components.rfxtrx] Receive RFXCOM event from (Device_id: 53_0e Class: RFXtrxDevice Sub: 7, Pkt_id: 0a52075a530e00bd320169)
2020-01-05 12:52:03 DEBUG (Thread-2) [custom_components.rfxtrx] Receive RFXCOM event from (Device_id: 4c_0e Class: RFXtrxDevice Sub: 7, Pkt_id: 0a52075b4c0e00d0310169)
2020-01-05 12:52:33 DEBUG (Thread-2) [custom_components.rfxtrx] Receive RFXCOM event from (Device_id: 20_0e Class: RFXtrxDevice Sub: 7, Pkt_id: 0a52075c200e00bd380169)
2020-01-05 12:52:39 DEBUG (Thread-2) [custom_components.rfxtrx] Receive RFXCOM event from (Device_id: 53_0e Class: RFXtrxDevice Sub: 7, Pkt_id: 0a52075d530e00bd320169)
2020-01-05 12:52:48 DEBUG (Thread-2) [custom_components.rfxtrx] Receive RFXCOM event from (Device_id: 4c_0e Class: RFXtrxDevice Sub: 7, Pkt_id: 0a52075e4c0e00d0310179)

These are the only rules i see in the log.

Strange, for my lights I see your messages are always followed by a different message (the one that I need).

2020-01-05 13:58:14 DEBUG (Thread-3) [custom_components.rfxtrx] Receive RFXCOM event from (Device_id: 0ea1af6_10 Class: LightingDevice Sub: 0, Pkt_id: 0b11000500ea1af60a000070)
2020-01-05 13:58:14 DEBUG (Thread-3) [custom_components.rfxtrx] Device_id: 0ea1af6_10 device_update. Command: Off
2020-01-05 13:58:26 DEBUG (Thread-3) [custom_components.rfxtrx] Receive RFXCOM event from (Device_id: 0ea1af6_10 Class: LightingDevice Sub: 0, Pkt_id: 0b11000600ea1af60a010f70)
2020-01-05 13:58:26 DEBUG (Thread-3) [custom_components.rfxtrx] Device_id: 0ea1af6_10 device_update. Command: On

Looking at the code, it seems that this should be similar for covers (it uses the same part of the code in __init__.py line 307).

I updated the code with two things.

  1. I noticed that cover.py does not have an import logging. Although the code generating above message is in __init__.py, it’s worth to try to add logging in cover.py.
  2. I added the code for updating the state if you send a comment with a remote. It probably will not work yet, only if the command is “Open”, “Stop” and/or “Close”. (Just a guess for now).

Could you update the __init__.py and cover.py files from my github and try again (after a restart).

What I first would like to know is if you can see the debug message after the update (and restart).

@Ernst I’ve updated the files. Restarted the HA. But unfortunately I don’t get the message with the command back in the log.

Indeed what you get for the lights I also get that message:

2020-01-05 15:02:50 DEBUG (Thread-2) [custom_components.rfxtrx] Receive RFXCOM event from (Device_id: 080cb6e_3 Class: LightingDevice Sub: 0, Pkt_id: 0b1100150080cb6e03000060)
2020-01-05 15:02:50 DEBUG (Thread-2) [custom_components.rfxtrx] Device_id: 080cb6e_3 device_update. Command: Off

But for the covers still not at the moment with the remote.

How did you add the cover to your config. By configuring automatic_add: and clicking on the remote such that it is added automatically? Or in a different way? I see that there are different types of covers, not all of them are discovered automatically. May be that is related?

According to the documentation, there are two protocols Siemens/LightwaveRF and RFY. However “it (RFXtrx433e I assume???) does not support receive for the RFY protocol”, so I guess that also explains why it’s not receiving the command from your remote.

Not with the automatic_add. That’s not working for the RFY.
Had to do it with the rfxmngr option to get the ID of the covers.

RFXCom can only transmit RFY commands: (sadly)

You have to program your covers to learn the rfxcom module like a remote.
You can do this with the rfxmngr software on windows. After that you can connect the module to your home automation server.

I installed zigbee xiaomi buttons at the covers and I use the original remote for backup purposes only. (if HA fails)

That explains it. If the RFXCom can only transmit RFY commands, than there is no way Home Assistant can pick up the signal and as a result it can’t updating the state. Unfortunately, this is not solvable by me, perhaps make a request at RFXCom or use an button like @ToMee does.