Skip to content

Commit 2fb1f51

Browse files
committed
add lambda code in example to show rolling code logic
1 parent 59bb74f commit 2fb1f51

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

components/remote_transmitter.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,12 +390,15 @@ This :ref:`action <config-action>` sends a Dyson cool AM07 infrared protocol cod
390390
on_...:
391391
- remote_transmitter.transmit_dyson:
392392
code: '0x1200'
393-
index: '0'
393+
index: !lambda |-
394+
uint8_t rolling_idx = id(idx);
395+
id(idx) = (id(idx) < 3) ? id(idx) + 1 : 0;
396+
return rolling_idx;
394397
395398
Configuration variables:
396399

397400
- **code** (**Required**, int): The 16-bit code to trigger on, e.g. 0x1200=power, 0x1215=fan++,0x122a=swing..., see dumper output for more info.
398-
- **index** (**Required**, int): The 8-bit rolling index [0..3], to be increased with every transmit, see dumper output for more info.
401+
- **index** (**Required**, int): The 8-bit rolling index (range=0..3), must change on each transmit, e.g. with global variable `idx` and lambda code
399402
- All other options from :ref:`remote_transmitter-transmit_action`.
400403

401404
.. _remote_transmitter-transmit_gobox:

0 commit comments

Comments
 (0)