Danielhiversen/pyRFXtrx

Modes reset on connect?

Closed this issue · 5 comments

I'm trying to get a Revolt compatible power meter (as described in #47) to work with pyRFXtrx (and Homeassistant) but even though I get values in the Windows tool, no events are received in Homeassistant.

To debug what's going on I checked out the current master of this library and used the example/receive.py script.

This is what I get:

Send: 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
{}
Send: 0x0d 0x00 0x00 0x01 0x02 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
Recv: 0x14 0x01 0x00 0x01 0x02 0x53 0x14 0x10 0x00 0x27 0x00 0x01 0x03 0x1c 0x04 0x80 0x00 0x00 0x00 0x00 0x00
{}
{}
{}
{}

To figure out what is going on I added some more print statements. The Recv line gets parsed into a StatusEvent:

<class 'RFXtrx.StatusEvent'> device=[Status [subtype=433.92MHz, firmware=20, devices=['ac', 'arc', 'oregon', 'undecoded', 'x10']]]

If I understand this output correctly, the rfxCom returns that only the modes 'ac', 'arc', 'oregon', 'undecoded', 'x10' are enabled. What is obviously missing is the RSL2 mode.

When I plugin the device back into my windows machine, the RSL2 mode is enabled again.

It seems to me that the initial Send string to reset the device is also resetting the configured modes.

Is that correct? If yes, can that be avoided? Or, even better, would there be a way to set the wanted modes via pyRFXtrx?

The reset of the device is not resetting the configured modes.
There is currently not possible to set the modes from pyRFXtrx, but you are welcome to open a pull request with the feature.

Hmm you're right. The undecoded flag is probably the RSL2 mode. However that brings me back to square one. I don't understand why RFXmngr receives events, but pyRFXtrx does not.

Hi,
PR #62 does what you want (using "rsl" mode)
Once merged we can add support for setting modes in Home Assistant.

As for why "rsl" is missing from your log messages: the current version of pyRFXTRX master does not print all the known receiving modes when parsing a Status packet because only a few modes are recognized in the parsing function. I've fixed that in my PR.

Hi @splitbrain, just to keep you informed that the mode-setting PR in Home Assistant is waiting for acceptance. Keep an eye on the next releases!