Portisch / RF-Bridge-EFM8BB1

Alternative Firmware for the Sonoff RF Bridge EFM8BB1 chip
289 stars 122 forks source link

Sniffing Warema Shutter #213

Open tombrain opened 2 years ago

tombrain commented 2 years ago

Latest firmware used?

yes

Information

Warema EWFS based devices, e.g. shutters (encoding type: Manchester)

Always pushed the same button and nearly almost sniffed another code.

Additional info: At the moment i use an c++-programm (https://github.com/rfkd/aircontrol) to send the command successfully. i want to port the code to rf-bridge

with aircontrol:

    airCommand =
        "S01110100110111"   // Command
        "S000011010"                  // Device
        "S011110101"                  // Device
        "S";

Sniffed data

{"RfRaw":{"Data":"AA B1 04 0366 06E0 16E4 1A54 B0808081809190A18080809191AA180809190818091808 55"}} {"RfRaw":{"Data":"AA B1 04 0366 06E0 16EE 1A54 B0808081809190A18080809191AA180809190818091808 55"}} {"RfRaw":{"Data":"AA B1 04 0370 06E0 16EE 1A7C B0808081809190A18080809191AA180809190818091808 55"}} {"RfRaw":{"Data":"AA B1 04 0384 06EA 16DA 1A68 B0808081809190A18080809191AA180809190818091808 55"}} {"RfRaw":{"Data":"AA B1 04 0384 06EA 16E4 1A72 B0808081809190A18080809191AA180809190818091808 55"}} {"RfRaw":{"Data":"AA B1 04 0384 06F4 16DA 1A68 B0808081809190A18080809191AA180809190818091808 55"}} {"RfRaw":{"Data":"AA B1 04 0384 06F4 16DA 1A68 B0808081809190A18080809191AA180809190818091808 55"}} {"RfRaw":{"Data":"AA B1 04 0384 06F4 16DA 1A68 B0808081809190A18080809191AA180809190818091808 55"}} {"RfRaw":{"Data":"AA B1 04 0384 06F4 16DA 1A72 B0808081809190A18080809191AA180809190818091808 55"}} {"RfRaw":{"Data":"AA B1 04 0384 06F4 16DA 1A72 B0808081809190A18080809191AA180809190818091808 55"}} {"RfRaw":{"Data":"AA B1 04 0384 06F4 16E4 1A72 B0808081809190A18080809191AA180809190818091808 55"}} {"RfRaw":{"Data":"AA B1 04 0384 06F4 16E4 1A72 B0808081809190A18080809191AA180809190818091808 55"}}

chiefymuc commented 2 years ago

Let me know if you figured it out. Would also like to use a bridge rather than another Raspberry Pi!

m4rquez commented 2 years ago

Hi @tombrain, did you find any solution yet?

I'm facing the same problem. Using Warema EWFS shutters with aircontrol without any issues, but can't get them working with the rf-bridge/tasmota/portisch.

Like you, i'm getting about 8 different codes, converted them all to B0, but none of them is working.

Another problem, only UP & STOP generating the long codes, DOWN codes are shorter and always the same.

tombrain commented 2 years ago

Let me know if you figured it out. Would also like to use a bridge rather than another Raspberry Pi!

Hi @chiefymuc, exact. I want to port to a NUC. This engine has no Pins. I want to use the RF-Bridge for 433-Communication

tombrain commented 2 years ago

Using Warema EWFS shutters with aircontrol without any issue

Hi @m4rquez, sorry, i found no solution to create Codes for the bridge.

Until now i have to use aircontrol.

tombrain commented 1 year ago

Now i use an esp32 and ESPHome. Communication by MQTT to Home Assistant. That works for me.

chiefymuc commented 1 year ago

Can you give some details? Which receiver / transmitter did you connect to the esp32? How did you get the codes? Thank you!

tombrain commented 1 year ago
tombrain commented 1 year ago

But next time i will do some changes to work by ESPHome. And additioinally some doku :-)

chiefymuc commented 1 year ago

@tombrain I'm trying to recreate that. I have installed aircontrol, but how exactly did you get the codes? I am able to save a file and replay it, but I struggle how to convert them into actual codes.

tombrain commented 1 year ago

@chiefymuc good news. i extend aircontrol to sniff waremacodes direct

https://github.com/tombrain/aircontrol branch: localwaremacodes

run with paramter x and directly get the code

image

chiefymuc commented 1 year ago

Oh wow I did not see that! Amazing work!

I was looking into trying out ESPhome with the Raw Action: https://esphome.io/components/remote_transmitter.html?highlight=rf#remote-transmitter-transmit-raw-action

Like S is +5000 0 is +890, -890 1 is -890,+890 s is -5000 (not used in Warema as it seems).

This might be a nice option as well to work with ESP32. I will see if I can find the time.

I made it work with your Arduino code on ESP32 so far!

Blackspell01 commented 1 year ago

hey there, apparently im too stupid to get it working.... whenever im trying to perform a scan with aircontrol -d scan -s 5000 im only getting a 40kb file which I can't open ... can someone please explain what I have to do?

chiefymuc commented 1 year ago
Blackspell01 commented 1 year ago
  • It's a hex file. You can upload it into hex converters online and then you should be able to see a bunch of 0 and 1. I then plotted the result as a graph and started to look where a code similar to the above started... It's tricky

I figured out how to convert the file (at least I think so). Now I have tons of 0 and 1s. How do I plot this as a graph?

@tombrain unfortunately the x parameter doesn’t show anything.. what do I have to type into the ssh terminal specifically? Is ./bin/aircontrol -d scan.hex -x 1000 correct? For me it doesn’t create a file nor does it show anything

tombrain commented 1 year ago

@Blackspell01 did you downlad the code from https://github.com/tombrain/aircontrol branch: localwaremacodes

Blackspell01 commented 1 year ago

@Blackspell01 did you downlad the code from https://github.com/tombrain/aircontrol branch: localwaremacodes

Actually had to press the button a few times for the software to recognise the codes. Now it worked, thank you a 1000 times for this great software!!

But one more question, what is the perfect solution to send the codes over home assistant? Over an esp? Or is it possible with the sonoff rf bridge ?

tombrain commented 1 year ago

@Blackspell01 I use esphome. It works perfectly. It even works with percentages of the rollo.

chiefymuc commented 1 year ago

@Blackspell01 I use esphome. It works perfectly. It even works with percentages of the rollo.

How did you make it work with esphome and warema?

tombrain commented 1 year ago

@chiefymuc i upload my esphome.yaml

https://github.com/tombrain/esphome_waremacontrol

there are two parts:

Blackspell01 commented 1 year ago

im sorry it may be a stupid question but what am I supposed to do with the .h file? :)

tombrain commented 1 year ago

Parallel in Filesystem to yaml of esphome

Blackspell01 commented 1 year ago

Thank you. I think im very close now. Do you know by any chance how to deal with this mqtt error? My settings are: mqtt: broker: @192.168.188.74 username: MQTT password: mqtt

Screenshot 2023-06-22 185334 Screenshot 2023-06-22 185541

Blackspell01 commented 1 year ago

Damn, I finally got it working! Thank you so much!!

tombrain commented 1 year ago

did you get working with sonoff by esp?

Blackspell01 commented 1 year ago

Unfortunately not. Im using a wemos d1 mini currently. The sonoff rf link was a very stupid purchase, I cant manage to get this thing working with any of my rf devices... But may I ask you another question? As with your code it is possible to send manchester code, would it also be possible to send specifically timed codes over ESP Home like in the attached image? (Maybe with another .h file) Screenshot 2023-06-25 181320

tombrain commented 1 year ago

i think so. you have to port this code: https://github.com/jacobmellin/unitec-rfsend/blob/master/unitec-rfsend.c

tombrain commented 1 year ago

Perhaps you can try by native ESPHome first:

https://esphome.io/components/remote_transmitter.html#setting-up-rf-devices

switch:
  - platform: template
    name: RF Power Button
    turn_on_action:
      - remote_transmitter.transmit_rc_switch_raw:
          code: '100010000000000010111110'
          protocol: 2
          repeat:
            times: 10
            wait_time: 0s
tombrain commented 1 year ago

second you can try my raw433-method

  - mqtt.publish:
      topic: waremacontrol/command/raw433
      payload: "0101010101110110110101"
Blackspell01 commented 1 year ago

I tried the native method already with no luck :(. How did you convert the initial code: '100010000000000010111110' to the payload: "0101010101110110110101"? And also why do you suggest to use protocol 2 in this case?

tombrain commented 1 year ago

both code ars only examples..

protocol 2 is from copy&paste of official doku

Blackspell01 commented 1 year ago

Hmm ok i already tried that. I somehow have to set the timings to 975us and 475us but I don't understand how to specify those values..

chiefymuc commented 7 months ago

I was able to make this work with the pure esphome!

I had to convert the up and downs into the timing and then it will send the right command.

This is the crucial part:

      - remote_transmitter.transmit_raw:
          code: [5890,-1780,890,-890,890,-890,1780,-1780,1780,-890,890,-1780,890,
                -890,1780,-1780,890,-890,890,-890,6780,-890,890,-890,890,-1780,890,
                -890,890,-890,1780,-1780,890,-890,6780,-890,890,-890,890,-1780,1780,
                -890,890,-1780,1780,-1780,5890]

Here ist my full esphome .yaml:

esphome:
  name: esphome-warema

esp32:
  board: esp32doit-devkit-v1
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  password: ""

ota:
  password: ""

wifi:
  ssid: "XXXX"
  password: "#YYYY"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esphome-Warema Fallback Hotspot"
    password: "ZZZZ"

captive_portal:

remote_transmitter:
  pin: GPIO25
  # RF uses a 100% carrier signal
  carrier_duty_percent: 100%

cover:
  - platform: time_based
    device_class: blind
    name: Garden Window Cover
    icon: "mdi:window-shutter"
    open_duration: 26s
    open_action:
      - switch.turn_on: garden_window_up
    close_duration: 23s
    close_action:
      - switch.turn_on: garden_window_down
    stop_action:
      - switch.turn_on: garden_window_stop
  - platform: time_based
    device_class: blind
    name: Side Window Cover
    icon: "mdi:window-shutter"
    open_duration: 27s
    open_action:
      - switch.turn_on: side_window_up
    close_duration: 23s
    close_action:
      - switch.turn_on: side_window_down
    stop_action:
      - switch.turn_on: side_window_stop

switch:
  - platform: template
    name: Garden Window Up
    id: garden_window_up
    icon: "mdi:window-shutter-open"
    entity_category: config
    turn_on_action:
      - remote_transmitter.transmit_raw:
          code: [5890,-1780,890,-890,890,-890,1780,-1780,1780,-890,890,-1780,890,
                -890,1780,-1780,890,-890,890,-890,6780,-890,890,-890,890,-1780,890,
                -890,890,-890,1780,-1780,890,-890,6780,-890,890,-890,890,-1780,1780,
                -890,890,-1780,1780,-1780,5890]
  - platform: template
    name: Garden Window Down
    id: garden_window_down
    icon: "mdi:window-shutter"
    entity_category: config
    turn_on_action:
      - remote_transmitter.transmit_raw:
          code: [5890,-1780,890,-890,890,-890,1780,-1780,1780,-890,890,-1780,890,
                -890,1780,-1780,890,-890,1780,-890,5890,-890,890,-890,890,-1780,
                890,-890,890,-890,1780,-1780,890,-890,6780,-890,890,-890,890,
                -1780,1780,-890,890,-1780,1780,-1780,5890]
  - platform: template
    name: Garden Window Stop
    id: garden_window_stop
    icon: "mdi:window-shutter-cog"
    entity_category: config
    turn_on_action:
      - remote_transmitter.transmit_raw:
          code: [5890,-890,890,-1780,890,-890,1780,-1780,1780,-890,890,-1780,890,
                -890,1780,-890,890,-890,890,-1780,6780,-890,890,-890,890,-1780,890,-890,
                890,-890,1780,-1780,890,-890,6780,-890,890,-890,890,-1780,1780,-890,890,
                -1780,1780,-1780,5890]
  - platform: template
    name: Side Window Up
    id: side_window_up
    icon: "mdi:window-shutter-open"
    entity_category: config
    turn_on_action:
      - remote_transmitter.transmit_raw:
          code: [5890,-1780,890,-890,890,-890,1780,-1780,1780,-890,890,-1780,
                890,-890,890,-890,890,-890,890,-890,890,-890,6780,-890,890,
                -890,890,-1780,890,-890,890,-890,1780,-1780,890,-890,6780,-890,
                890,-890,890,-1780,1780,-890,890,-1780,1780,-1780,5890]
  - platform: template
    name: Side Window Down
    id: side_window_down
    icon: "mdi:window-shutter"
    entity_category: config
    turn_on_action:
      - remote_transmitter.transmit_raw:
          code: [5890,-1780,890,-890,890,-890,1780,-1780,1780,-890,890,-1780,
                890,-890,890,-890,890,-890,890,-890,1780,-890,5890,-890,890,
                -890,890,-1780,890,-890,890,-890,1780,-1780,890,-890,6780,
                -890,890,-890,890,-1780,1780,-890,890,-1780,1780,-1780,5890]
  - platform: template
    name: Side Window Stop
    id: side_window_stop
    icon: "mdi:window-shutter-cog"
    entity_category: config
    turn_on_action:
      - remote_transmitter.transmit_raw:
          code: [5890,-890,890,-1780,890,-890,1780,-1780,1780,-890,890,-1780,
                890,-890,890,-890,1780,-890,890,-1780,6780,-890,890,-890,890,
                -1780,890,-890,890,-890,1780,-1780,890,-890,6780,-890,890,-890,
                890,-1780,1780,-890,890,-1780,1780,-1780,5890]
Blackspell01 commented 7 months ago

Damn that's impressive. Thank you so much for sharing.

iflowmac commented 1 month ago

I was able to make this work with the pure esphome!

I had to convert the up and downs into the timing and then it will send the right command.

Hello chiefymuc, how did you convert the "S01110100111111S011101001S000011111S" to the timings? by hand or had you a software? where did you get the exact µs-values from?

Blackspell01 commented 1 month ago

I did it by hand with a YouTube tutorial. Timing is always 890µs

iflowmac commented 1 month ago

thank you!

chiefymuc commented 1 month ago

I built an Excel-Table to convert the codes to the timestampts. It is not fully automatic... Maybe it helps:

code.xlsx

iflowmac commented 1 month ago

thank you!!!