I am seeking to emulate a Wen 3417 remote control with 3 buttons (OFF, ON, TIME)
I reverse engineered the encoding which consists of the following:
-
Pulse length is ~320ms
-
Sync sequence - 25 alternating high/low pulses of length 320ms per high and per low element
-
Pause of length ~ 9600ms (30 pulse units)
-
Message consisting of 16 bits where:
one
s consist of 3 Hi followed by 1 Low whilezero
s consist of 1 Hi followed by 3 Low (total length = 4 pulse units = 4* 320 = 1280ms) -
Message is repeated 3 times with 9600 ms between them (30 pulse units).
I got it to work by using remote_transmitter.transmit_rc_switch_raw
twice separated by a delay. The first call creates the sync sequence and the second creates the 16-bit messages.
Code is like:
- platform: template
name: "Dust Collector OFF"
on_press:
# Sync Signal
- remote_transmitter.transmit_rc_switch_raw:
code: '1111111111111111111111111' #25 hi/low pulses
protocol:
pulse_length: ${pulse_length_us}
one: [1, 1] # Alternating high/low for sync
sync: [0, 0] # Don't precede with sync
- delay: ${post_sync_pause} # Pause delay after sync
# Message
- remote_transmitter.transmit_rc_switch_raw:
code: '1100001110010001' # OFF signal (16-bytes)
protocol:
pulse_length: ${pulse_length_us}
zero: [1, 3] # 1 high, 3 low for a '0' (default)
one: [3, 1] # 3 high, 1 low for a '1' (default)
sync: [0, 0]
repeat:
times: 3
wait_time: ${pause_length}
where pause_length=9600ms
and pulse_length_us = 320
However, whatever value I use for post_sync_pause
to set the delay between sync and message, the actual silent time varies significantly – ALTHOUGH THE REMOTE PROGRAM STILL WORKS.
I imagine the problem is due to the fact that the code outside each single remote_transmitter.transmit_rc_switch_raw
routine is non-blocking with delay variations caused by things like Wifi interrupts (I am using a D1-Mini version of an esp2866)
- Is there any way to make this code section blocking so that the end-to-end timing is repeatable?
I imagine I could use a lambda expression to combine the sync/delay/message all into one raw code but that would be messy…
- Any other solutions?
Or is the ‘pause’ time between sync and message generally insensitive for these types of coding schemes so I should just leave it as-is and accept the variability.
- Am I diagnosing this and understanding this correctly?