substitutions:node_name:"rfbridge-livingroom"node_id:rfbridge_livingroomnode_name_friendly:${node_name}packages:common:!includecommon/common.yamlesphome:on_boot:priority:-100then:#初始化晾衣架的灯为关闭状态-rf_bridge.send_raw:raw:"AAB029030800F002801AF428190819081909090819090818181818181908181819081818181908181818181855"#默认重启之后 灯是关闭状态,应该无需重新发布状态# - lambda: |-# id(${node_id}_cover_light).publish_state(false);api:services:-service:send_rf_codevariables:sync:intlow:inthigh:intcode:intthen:-rf_bridge.send_code:sync:!lambda'return sync;'low:!lambda'return low;'high:!lambda'return high;'code:!lambda'return code;'-service:send_rf_rawvariables:raw:stringthen:-rf_bridge.send_raw:raw:!lambda'return raw;'-service:learnthen:-rf_bridge.learn# with Portisch firmware-service:beepthen:-rf_bridge.beep:duration:100-service:send_rf_advanced_codevariables:length:intprotocol:intcode:stringthen:-rf_bridge.send_advanced_code:length:!lambda'return length;'protocol:!lambda'return protocol;'code:!lambda'return code;'-service:learn_rawthen:-rf_bridge.start_bucket_sniffing-service:learn_advanced_code_startthen:-rf_bridge.start_advanced_sniffing-service:learn_advanced_code_stopthen:-rf_bridge.stop_advanced_sniffing#this is important as the RF chip talks to esp on these pins at this baud rateuart:tx_pin:GPIO01rx_pin:GPIO03baud_rate:19200#need to disable uart logging as it will interferelogger:baud_rate:0#this allows ha to when RF signals are received, I'm not using this for anything yet.rf_bridge:on_code_received:if:condition:switch.is_on:${node_id}_pair_switchthen:-homeassistant.event:event:esphome.rf_code_receiveddata:sync:!lambda'char buffer [10];return itoa(data.sync,buffer,16);'low:!lambda'char buffer [10];return itoa(data.low,buffer,16);'high:!lambda'char buffer [10];return itoa(data.high,buffer,16);'code:!lambda'char buffer [10];return itoa(data.code,buffer,16);'#with Portisch firmwareon_advanced_code_received:if:condition:switch.is_on:${node_id}_pair_switchthen:-homeassistant.event:event:esphome.rf_advanced_code_receiveddata:length:!lambda'char buffer [10];return itoa(data.length,buffer,16);'protocol:!lambda'char buffer [10];return itoa(data.protocol,buffer,16);'code:!lambda'return data.code;'binary_sensor:-platform:gpiopin:number:GPIO00inverted:Truename:"${node_name_friendly}-PairButton"id:${node_id}_pair_buttonon_multi_click:#长按(按键时长为x秒到y秒之间,松开按键0.2秒之后发送状态)-timing:-ONforatleast0.7s-OFFforatleast0.2sthen:-rf_bridge.beep:duration:1000-delay:200ms-switch.toggle:${node_id}_restartinvalid_cooldown:0s#短按(x秒内按一下,松开按键0.3秒之后反馈状态)-timing:-ONforatmost0.3s-OFFforatleast0.2sthen:-switch.turn_on:${node_id}_pair_switch-delay:5min-switch.turn_off:${node_id}_pair_switchinvalid_cooldown:0s# the interesting bit, controlling the awning motorswitch:-platform:templatename:"${node_name_friendly}-Cover-Light"id:${node_id}_cover_lightturn_on_action:#发送开灯指令-rf_bridge.send_raw:raw:"AAB029030802A800C81AF428181909081818190819081819090908190908190909081908190819081909081955"-lambda:|-
id(${node_id}_cover_light).publish_state(true);
turn_off_action:-rf_bridge.send_raw:raw:"AAB029030802A800C81AF428181909081818190819081819090908190908190909081908190819081909081955"-lambda:|-
id(${node_id}_cover_light).publish_state(false);
-platform:templatename:"${node_name_friendly}-Pair-Switch"id:${node_id}_pair_switchoptimistic:trueon_turn_on:-rf_bridge.beep:duration:200-delay:200ms-rf_bridge.beep:duration:200light:#状态指示灯-platform:status_ledname:"${node_name_friendly}-LinkLed"id:${node_id}_link_ledpin:number:GPIO13inverted:Truecover:-platform:time_basedname:"${node_name_friendly}-Cover"device_class:garageassumed_state:truehas_built_in_endstop:trueopen_action:-rf_bridge.send_raw:raw:"AAB029030802A800BE1AFE28181909090819090819081818190818190819081818190818190819090908181955"open_duration:1sclose_action:-rf_bridge.send_raw:raw:"AAB029030802B200BE1AF428190818190909081819090909081819081908190908181908181909090818190955"close_duration:1sstop_action:-rf_bridge.send_raw:raw:"AAB029030802A800BE1AF428181909081818190819081819090908190819081818181818190819081909081955"