Legion2 / Somfy_Remote_Lib

Emulate a Somfy remote using a 433.42 MHz transmitter.
Apache License 2.0
122 stars 17 forks source link

unabel to control covers #21

Closed ageurtse closed 1 year ago

ageurtse commented 1 year ago

I have a problem, but don't know where to look. I rebuild the schematic from this site https://www.die-welt.net/2021/06/controlling-somfy-roller-shutters-using-an-esp32-and-esphome/

flashed my ESP32, but the up/down and stop commands won't work. When learning the remote the cover goes shortly up an down. but that is it.

i make use of NVSRollingCodeStorage.

Legion2 commented 1 year ago

What type of covers do you have and what type of remote did you used before? Have a look at https://github.com/Legion2/Somfy_Remote_Lib/issues/17#issuecomment-1054628543, you may also have to adjust the repeat parameter for your type of covers to work.

ageurtse commented 1 year ago

I have blinds witw a somfy rts motor. The origanaly remote is an old telis 4

ageurtse commented 1 year ago

tryed the things from post 17, and changed the repeat time's but that didn't solved it. any more clue's

Legion2 commented 1 year ago

I think your covers and remote use different commands or variations of the commands. Maybe you find some more information about their protocol in the internet (e.g. https://github.com/merbanan/rtl_433), but I can't help you debug your hardware.

adam-thomas-privitar commented 1 year ago

Hi. I have this exact same issue. Prog works, the blinds jump when I run PROG. But after, nothing happens -- no response on the up or down. I have discussed it over email with @evgeni who authored the blog post and he also mentioned that possibly the commands are different.

I am purchasing an RTL-SDR stick to check and compare the signals myself. I will report back if I have luck finding this issue.

Maybe its the blinds we have? I have "Electra" blinds which integrate with somfy remote. Is it the same for you? I can't find the model on the damn things.

ageurtse commented 1 year ago

I abbonded ghis and installed an rflink gateway, which worked great.

adamscybot commented 1 year ago

@ageurtse Interesting. Does that thing support somfy out of the box? If so, perhaps I can work backwards from its software to how it sends the commands? Did you use some additional software?

Or do you think its a hardware issue?

ageurtse commented 1 year ago

Yes it works out of the box but its based on a arduino mega.

All the info is here https://www.rflink.nl/

adamscybot commented 1 year ago

Thanks. Apparently the source is now closed https://www.letscontrolit.com/forum/viewtopic.php?t=8323 so my plan wont work. Though I did find https://github.com/filipmaelbrancke/ha-rflink-rts.

Whatever its doing inside RFLink, this project is not. Hopefully I can shine light on it with the dongle.

EDIT: More details. I suspect this is related to how programming works on my Electra blinds. When I pair a new remote, that channel on the real one stops working. Very odd -- I need to reset the blind completely I think. I have asked the manufacturer for the manual.

adamscybot commented 1 year ago

I've got an RTL SDR and started debugging. With a newly compiled version, I can see the frames picked up from the original remote using RTL_433.

Testing the original remote

Ive masked out my original remote ID below.

Down:

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
time      : 2022-12-05 00:32:16
model     : Somfy-RTS    id        : XXXXXX
Control   : Down (4)     Counter   : 2306          Retransmission: 1         Integrity : CHECKSUM
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
time      : 2022-12-05 00:32:16
model     : Somfy-RTS    id        : XXXXXX
Control   : Down (4)     Counter   : 2306          Retransmission: 1         Integrity : CHECKSUM
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
time      : 2022-12-05 00:32:17
model     : Somfy-RTS    id        : XXXXXX
Control   : Down (4)     Counter   : 2307          Retransmission: 0         Integrity : CHECKSUM
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
time      : 2022-12-05 00:32:17
model     : Somfy-RTS    id        : XXXXXX
Control   : Down (4)     Counter   : 2307          Retransmission: 1         Integrity : CHECKSUM
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
time      : 2022-12-05 00:32:17
model     : Somfy-RTS    id        : XXXXXX
Control   : Down (4)     Counter   : 2307          Retransmission: 1         Integrity : CHECKSUM
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
time      : 2022-12-05 00:32:17
model     : Somfy-RTS    id        : XXXXXX
Control   : Down (4)     Counter   : 2307          Retransmission: 1         Integrity : CHECKSUM
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
time      : 2022-12-05 00:32:17
model     : Somfy-RTS    id        : XXXXXX
Control   : Down (4)     Counter   : 2307          Retransmission: 1         Integrity : CHECKSUM
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
time      : 2022-12-05 00:32:20
model     : Somfy-RTS    id        : XXXXXX
Control   : Down (4)     Counter   : 2309          Retransmission: 1         Integrity : CHECKSUM
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
time      : 2022-12-05 00:32:20
model     : Somfy-RTS    id        : XXXXXX
Control   : Down (4)     Counter   : 2309          Retransmission: 1         Integrity : CHECKSUM
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
time      : 2022-12-05 00:32:21
model     : Somfy-RTS    id        : XXXXXX
Control   : Down (4)     Counter   : 2310          Retransmission: 1         Integrity : CHECKSUM

Up:

time      : 2022-12-05 00:34:18
model     : Somfy-RTS    id        : XXXXXX
Control   : Up (2)       Counter   : 2313          Retransmission: 1         Integrity : CHECKSUM
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
time      : 2022-12-05 00:34:18
model     : Somfy-RTS    id        : XXXXXX
Control   : Up (2)       Counter   : 2313          Retransmission: 1         Integrity : CHECKSUM
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
time      : 2022-12-05 00:34:18
model     : Somfy-RTS    id        : XXXXXX
Control   : Up (2)       Counter   : 2313          Retransmission: 1         Integrity : CHECKSUM
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
time      : 2022-12-05 00:34:18
model     : Somfy-RTS    id        : XXXXXX
Control   : Up (2)       Counter   : 2313          Retransmission: 1         Integrity : CHECKSUM
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
time      : 2022-12-05 00:34:18
model     : Somfy-RTS    id        : XXXXXX
Control   : Up (2)       Counter   : 2313          Retransmission: 1         Integrity : CHECKSUM
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
time      : 2022-12-05 00:34:18
model     : Somfy-RTS    id        : XXXXXX
Control   : Up (2)       Counter   : 2313          Retransmission: 1         Integrity : CHECKSUM
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
time      : 2022-12-05 00:34:18
model     : Somfy-RTS    id        : XXXXXX
Control   : Up (2)       Counter   : 2313          Retransmission: 1         Integrity : CHECKSUM

Thoughts on results

So this confirms my problem is not caused by the blinds working on different commands, and probably that's the same as the OPs and the guy in this thread.

It is of note I have the same CC1101 as this guy. Which raises some suspicions.

Testing my fake remote

Now to check how the signal appears when sent from my fake remote...

RTL_433 detects PROG from my fake remote. As expected, since that seems to work. However, issuing UP or DOWN commands yields no detection in RTL_433. At this point it seems clear the issue is with the fake remote. I'm guessing on people who have this project setup as working, RTL_433 works fine with it -- so this is definitely weird.

When using the -A flag to analyse what the fake remote is sending when I press up and down, I can see for sure there is something sent when I issue the up and down commands. But RTL_433 does not think it's somfy frames.

Maybe my hardware is bad? Maybe the code in this project doesn't create 100% valid somfy frames? Not sure where to go from here.

I have also checked the frequencies of both the real and fake remote. The fake remote is vastly stronger than the real one, but given it receives PROG fine, I'm inclined to think it's not a problem. It's also slightly above what's expected frequency wise but within tolerance IMO (and again, prog works). Red line is 433.42mhz.

Original remote Fake Remote
original remote fake remote

There's something odd a little that the fake on seems to have a small pulse before the main pulses. Whereas the real one does not. Unsure if related.

Fake remote pulse captures

Next steps

I'm a little stuck now. New to radio stuff so took some time to get as far as this.

I think I should add logging to the RTL_422 somfy decoder and see exactly where the fake remote up/down calls fail to be recognised.

Again, new to radio, so I don't know if its nonsense -- but its curious that the other guy has the problem on the same "v2" CC1101 board. Maybe my board is poor quality and the timings are off. Then again, PROG is detected, but perhaps this is a simpler signal with less leading/trailing edges on the manchester encoding.

adamscybot commented 1 year ago

I have discovered the reason RTL_433 does not detect up/down frames from my fake remote is that it fails this check in its decoder:

    if (bitbuffer_search(bitbuffer, decode_row, 0, preamble_pattern, preamble_pattern_bit_length) != 0) {
        printf("Abort early 2\n");
        return DECODE_ABORT_EARLY;
    }

Where with the real remote it passes, and PROG passes on the fake one too.

adamscybot commented 1 year ago

Well, im getting somewhere. I've managed to get RTL_433 to detect my fake remote DOWN command (up seems to work only rarely). I monitored the frequency and offset it slightly so its exactly 443.42mhz. I'm beginning to suspect the additional unexpected burst of signal power before the main bursts on the fake remote is the cause of the flaky detection. I also increase the pulses to 8.

Its at least detected sometimes now...but I think this is a non issue since even with the real remote, rtl_433 does not detect all frames the real blinds do.

However, I can see that:

Lo and behold -- in the serial monitor after compiling with DEBUG as 1 I have:

nvs_set failed!
nvs_commit done
adamscybot commented 1 year ago

Aaaand BINGO!

I have it working. The problems were as follows:

I would hazard a guess people who have this problem have the same issue.

Legion2 commented 1 year ago

We should add this to the documentation, or even implement a runtime check.

adamscybot commented 1 year ago

I've gone ahead and raised a PR to add a bit more info

Legion2 commented 1 year ago

I merged the documentation update and now closing this issue as resolved.