I’m working to create a fan based on the CC1101 chip (RF) and I have the signal processing part down, but now need to create my esphome components. Here’s the write action that I currently have for my fan:
write_action:
- lambda: get_cc1101(transciver).beginTransmission();
- remote_transmitter.transmit_raw:
code:
- lambda: |-
if (state < 0.25) {
return "[346,-692,346,-692,346,-692,346,-692,346,-346,692,-692,346,-692,346,-692, 346,-692,346,-692,346,-346,692,-692,346]";
} else {
return "[346,-692,346,-692,346,-692,346,-692,346,-346,692,-692,346,-692,346,-692, 346,-692,346,-692,346,-346,692,-692,346]";
}
repeat:
times: 5
wait_time: 12.12ms
- lambda: get_cc1101(transciver).endTransmission();
In this case, it complains that lambda as being an invalid option for [0].
I’ve also tried to remove code: and return it in my string after my test “code: […]” but then it’s not happy that “repeat” follows that since it expects the return to have the entire sub-block from what I can tell.
So how can I simply return a different code based on the value of state. I ultimately need 4 states, but I first want to make 2 states work.