32
319
2969
论坛技术达人
#反 1 gnd 2 tx #正 7 vcc 6 RX 5 gpiox 4 gpio0 3 gpio27 2 gpiox 1 #led绿 gpio26 <<: !include config.yaml substitutions: device_name: pc_esp32 #设备名称(多个改成不一样的) button_pin: GPIO27 relay_pin: GPIO5 led_state_pin: GPIO26 led_relay_pin: GPIO25 esphome: name: $device_name platform: ESP32 board: esp32dev build_path: build/$device_name name_add_mac_suffix: true platformio_options: platform: - [email protected] platform_packages: - framework-arduinoespressif32 @ https://github.com/agners/arduino-esp32.git#1.0.6-solo # - tasmota/framework-arduinoespressif32 @ 3.10006.210420 status_led: pin: number: $led_state_pin inverted: true logger: baud_rate: 0 globals: - id: auto_gl type: int restore_value: yes initial_value: "1" binary_sensor: - platform: gpio pin: number: $button_pin inverted: true mode: input: true pullup: true name: "${device_name}_B1" id: "${device_name}_B1" on_click: - min_length: 50ms max_length: 1000ms then: - if: condition: lambda: 'return id(${device_name}_auto).state ;' then: - switch.toggle: "${device_name}_relay" - min_length: 5000ms max_length: 10000ms then: - switch.toggle: '${device_name}_auto' light: - platform: binary output: light_output name: "${device_name}_relay_led" id: "${device_name}_relay_led" output: - id: light_output platform: gpio pin: number: $led_relay_pin inverted: true sensor: - platform: wifi_signal name: "${device_name}_RSSI" update_interval: 60s text_sensor: - platform: wifi_info ip_address: name: '${device_name}_IP' mac_address: name: '${device_name}_MAC' switch: - platform: restart name: "${device_name}_Restart" - platform: safe_mode name: "${device_name}_SafeMode" - platform: gpio #继电器 pin: $relay_pin name: "${device_name}_relay" id: "${device_name}_relay" on_turn_on: then: - light.turn_on: "${device_name}_relay_led" on_turn_off: then: - light.turn_off: "${device_name}_relay_led" - platform: template name: "${device_name}_auto" id: "${device_name}_auto" turn_on_action: then: - lambda: |- id(auto_gl)=1; turn_off_action: then: - lambda: |- id(auto_gl)=0; lambda: |- return id(auto_gl);
查看全部评分
使用道具 举报
2
23
537
高级会员
888
3729
论坛元老
1
10
72
注册会员
54
317
1371
金牌会员
8
529
4063
14
520
1834
sorrypqa 发表于 2022-6-19 20:13 小白一个,请教大神,
sangood 发表于 2022-6-19 20:02 买了几个,这个几个针脚能标下吗?谢谢 #反 1 gnd 2 tx
本版积分规则 发表回复 回帖后跳转到最后一页
Archiver|手机版|小黑屋|Hassbian
GMT+8, 2023-6-6 00:42 , Processed in 0.060464 second(s), 36 queries .
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.