『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
楼主: bugensui

[技术探讨] 哪些三开开关可以直接接入HA并且性价比高安全行好

[复制链接]

54

主题

617

帖子

3766

积分

论坛元老

Rank: 8Rank: 8

积分
3766
金钱
3144
HASS币
20
发表于 2023-3-1 17:56:52 | 显示全部楼层
sorrypqa 发表于 2023-2-28 14:28
有Sonoff LAN插件可以直接接入,因为这货用的是ESP32主控,我更喜欢直刷ESPHome,一劳永逸,还多了个蓝牙 ...

你知道这货控制3个继电器的gpio口是那些么  他有控制3个led的gpio吗  还是和按键串在一起的
回复

使用道具 举报

50

主题

1298

帖子

4854

积分

论坛DIY达人

积分
4854
金钱
3556
HASS币
20
发表于 2023-3-1 22:43:33 | 显示全部楼层
gmshiwoge 发表于 2023-3-1 17:56
你知道这货控制3个继电器的gpio口是那些么  他有控制3个led的gpio吗  还是和按键串在一起的 ...

substitutions:
  device_name: sonoff-m53c-01  #设备名称
  friendly_name: Sonoff_M53C_01
  button1_pin: GPIO4 #按键1用引脚
  button2_pin: GPIO0 #按键2用引脚
  button3_pin: GPIO15 #按键3用引脚
  relay1_pin: GPIO23 #驱动继电器1用引脚
  relay2_pin: GPIO19 #驱动继电器2用引脚
  relay3_pin: GPIO22 #驱动继电器3用引脚
  led_state_pin: GPIO5 #蓝色指示灯引脚
  pwm1_pin: GPIO18 #PWM输出
回复

使用道具 举报

54

主题

617

帖子

3766

积分

论坛元老

Rank: 8Rank: 8

积分
3766
金钱
3144
HASS币
20
发表于 2023-3-3 14:39:10 | 显示全部楼层
sorrypqa 发表于 2023-3-1 22:43
substitutions:
  device_name: sonoff-m53c-01  #设备名称
  friendly_name: Sonoff_M53C_01

谢谢你 我大概弄一个场景和开关二选一的功能,打开opem mqtt按钮后 按键将不可以控制继电器 中间蓝色指示灯会亮 可以发送mqtt 单击 双击 长按 设置场景
1+2按键按住10秒切换模式 ,3+2按键按住重启面板
esphome:
  name: sonoff_3
  platform: ESP32
  board: esp32dev



substitutions:
  switch_name:  sonoff_3

logger:


esp32_ble_tracker:
bluetooth_proxy:

api:

ota:
sensor:
# Wifi signal
  - platform: wifi_signal
    name: "${switch_name}_wifi"
    update_interval: 60s
    id: wifi1

wifi:
  ssid: XXXXXXXXX
  #password: !secret wifi_password
  ap:
    ssid: "${switch_name}"
    password: "12345678"
captive_portal:

web_server:
  port: 80

mqtt:
  broker: 192.168.1.122
  port: 1883
  username: mqtt
  password: mqtt
  discovery: true





button: #重启
  - platform: restart
    name: "${switch_name}_restart"
    # inverted: true
    id: Restart









######## 这里是配置判断要不要单击开继电器 #################################
switch:
  - platform: gpio
    restore_mode: RESTORE_DEFAULT_ON
    pin: GPIO26
    name: "open_01"
    id: open_01
    on_turn_on:
      then:
        - switch.turn_off: switch_01
        - switch.turn_off: switch_02
        - switch.turn_off: switch_03
        - switch.turn_on: led
    on_turn_off:
      then:
        - switch.turn_off: led






  - platform: gpio
    restore_mode: RESTORE_DEFAULT_ON
    pin: GPIO26
    name: "last_hold1"
    id: last_hold1
  - platform: gpio
    restore_mode: RESTORE_DEFAULT_ON
    pin: GPIO26
    name: "last_hold2"
    id: last_hold2
  - platform: gpio
    restore_mode: RESTORE_DEFAULT_ON
    pin: GPIO26
    name: "last_hold3"
    id: last_hold3

######## 这里是继电器配置 #################################
  - platform: gpio
    
    pin: GPIO23
    name: "switch_01"
    id: switch_01
    on_turn_on:
      then:
        - switch.turn_off: open_01
        #- switch.turn_on: LED_01
    on_turn_off:
      then:
        #- switch.turn_off: LED_01



  - platform: gpio
    
    pin: GPIO19
    name: "switch_02"
    id: switch_02
    on_turn_on:
      then:
        #- switch.turn_on: LED_02
        - switch.turn_off: open_01
    on_turn_off:
      then:
        #- switch.turn_off: LED_02

  - platform: gpio
    
    pin: GPIO22
    name: "switch_03"
    id: switch_03
    on_turn_on:
      then:
        #- switch.turn_on: LED_03
        - switch.turn_off: open_01
    on_turn_off:
      then:
        #- switch.turn_off: LED_03
########这里是LED配置 ##################################
  - platform: gpio
    pin: GPIO05
    inverted: true
    name: "led"
    id: led
    on_turn_on:
      then:
       # - switch.turn_on: LED_04
        #- switch.turn_off: open_01
    on_turn_off:
      then:
        #- switch.turn_off: LED_04



output:
  - platform: ledc
    pin: GPIO18
    id: gpio_18

# Example usage in a light
light:
  - platform: monochromatic
    output: gpio_18
    name: "ledc Light"



######## 这里是按键配置 ##################################
##########按键1#####################   
binary_sensor:
- platform: gpio
  pin:
    number: GPIO04
    mode: INPUT_PULLUP
    inverted: true
  id: switch1
  internal: true
  on_multi_click:
  - timing:
      - ON for at most 0.5s
      - OFF for at most 0.5s
      - ON for at most 0.5s
      - OFF for at least 0.2s
    then:
      - if:
          condition:
            switch.is_on: open_01
          then:
            - mqtt.publish:
                topic: "/esp/${switch_name}/h1"
                payload: "double"
  - timing:
      - ON for at most 0.3s
      - OFF for at least 0.2s
    then:
      - if:
          condition:
            switch.is_on: open_01
          then:
            - mqtt.publish:
                topic: "/esp/${switch_name}/h1"
                payload: "single"
          else:
            - switch.toggle: switch_01
  - timing:
      - ON for at least 0.7s
    then:
      - if:
          condition:
            switch.is_on: open_01
          then:
            - mqtt.publish:
                topic: "/esp/${switch_name}/h1"
                payload: "hold"
            - if:
                condition:
                  switch.is_on: last_hold1
                then:
                  - delay: 1s
                  - while:
                      condition:
                        binary_sensor.is_on: switch1
                      then:
                        - mqtt.publish:
                            topic: "/esp/${switch_name}/h1"
                            payload: "hold"
                        - delay: 1s
  - timing:
      - ON for at least 0.7s
      - OFF for at least 0.2s
    then:
      - if:
          condition:
            switch.is_off: last_hold1
          then:
            - mqtt.publish:
                topic:  "/esp/${switch_name}/h1"
                payload: "Not_hold"
  - timing:
      - ON for at least 10s
    then:
      - if:
          condition:
            binary_sensor.is_on: switch2
          then:
            - switch.toggle: open_01
  on_press:
    then:
      - if:
          condition:
            switch.is_on: open_01
          then:
            #- switch.turn_on: LED_01
  on_release:
    then:
      - if:
          condition:
            switch.is_on: open_01
          then:
            #- switch.turn_off: LED_01
##########按键2#####################    
- platform: gpio
  pin:
    number: GPIO0
    mode: INPUT_PULLUP
    inverted: true
  id: switch2
  internal: true
  on_multi_click:
  - timing:
      - ON for at most 0.5s
      - OFF for at most 0.5s
      - ON for at most 0.5s
      - OFF for at least 0.2s
    then:
      - if:
          condition:
            switch.is_on: open_01
          then:
            - mqtt.publish:
                topic: "/esp/${switch_name}/h2"
                payload: "double"
  - timing:
      - ON for at most 0.3s
      - OFF for at least 0.2s
    then:
      - if:
          condition:
            switch.is_on: open_01
          then:
            - mqtt.publish:
                topic: "/esp/${switch_name}/h2"
                payload: "single"
          else:
            - switch.toggle: switch_02
  - timing:
      - ON for at least 0.7s
    then:
      - if:
          condition:
            switch.is_on: open_01
          then:
            - mqtt.publish:
                topic: "/esp/${switch_name}/h2"
                payload: "hold"
            - if:
                condition:
                  switch.is_on: last_hold2
                then:
                  - delay: 1s
                  - while:
                      condition:
                        binary_sensor.is_on: switch2
                      then:
                        - mqtt.publish:
                            topic: "/esp/${switch_name}/h2"
                            payload: "hold"
                        - delay: 1s
  - timing:
      - ON for at least 0.7s
      - OFF for at least 0.2s
    then:
      - if:
          condition:
            switch.is_off: last_hold2
          then:
            - mqtt.publish:
                topic:  "/esp/${switch_name}/h2"
                payload: "Not_hold"

  on_press:
    then:
      - if:
          condition:
            switch.is_on: open_01
          then:
            #- switch.turn_on: LED_02
  on_release:
    then:
      - if:
          condition:
            switch.is_on: open_01
          then:
            #- switch.turn_off: LED_02
##########按键3#####################   
- platform: gpio
  pin:
    number: GPIO15
    mode: INPUT_PULLUP
    inverted: true
  id: switch3
  internal: true
  on_multi_click:
  - timing:
      - ON for at most 0.5s
      - OFF for at most 0.5s
      - ON for at most 0.5s
      - OFF for at least 0.2s
    then:
      - if:
          condition:
            switch.is_on: open_01
          then:
            - mqtt.publish:
                topic: "/esp/${switch_name}/h3"
                payload: "double"

  - timing:
      - ON for at most 0.3s
      - OFF for at least 0.2s
    then:
      - if:
          condition:
            switch.is_on: open_01
          then:
            - mqtt.publish:
                topic: "/esp/${switch_name}/h3"
                payload: "single"
          else:
            - switch.toggle: switch_03
  - timing:
      - ON for at least 0.7s
    then:
      - if:
          condition:
            switch.is_on: open_01
          then:
            - mqtt.publish:
                topic: "/esp/${switch_name}/h3"
                payload: "hold"
            - if:
                condition:
                  switch.is_on: last_hold3
                then:
                  - delay: 1s
                  - while:
                      condition:
                        binary_sensor.is_on: switch3
                      then:
                        - mqtt.publish:
                            topic: "/esp/${switch_name}/h3"
                            payload: "hold"
                        - delay: 1s
  - timing:
      - ON for at least 0.7s
      - OFF for at least 0.2s
    then:
      - if:
          condition:
            switch.is_off: last_hold3
          then:
            - mqtt.publish:
                topic:  "/esp/${switch_name}/h3"
                payload: "Not_hold"
  - timing:
      - ON for at least 10s
    then:
      - if:
          condition:
            binary_sensor.is_on: switch2
          then:
            - button.press: Restart
  on_press:
    then:
      - if:
          condition:
            switch.is_on: open_01
          then:
           # - switch.turn_on: LED_03
  on_release:
    then:
      - if:
          condition:
            switch.is_on: open_01
          then:
           # - switch.turn_off: LED_03


微信截图_20230303142915.png

评分

参与人数 1金钱 +10 收起 理由
sorrypqa + 10 大神666!

查看全部评分

回复

使用道具 举报

50

主题

1298

帖子

4854

积分

论坛DIY达人

积分
4854
金钱
3556
HASS币
20
发表于 2023-3-3 15:50:53 | 显示全部楼层
本帖最后由 sorrypqa 于 2023-3-3 15:53 编辑
gmshiwoge 发表于 2023-3-3 14:39
谢谢你 我大概弄一个场景和开关二选一的功能,打开opem mqtt按钮后 按键将不可以控制继电器 中间蓝色指示 ...

我的天呀,好复杂,看得头晕脑胀......谢谢您的消息,我赶紧多买几个平仓,之前在TB买贵很多,肠子都悔青了。也买了20多个T3UK3C,如果T3也是用ESP32芯片的话,我更喜欢T3系列的触摸按钮
回复

使用道具 举报

24

主题

623

帖子

2756

积分

金牌会员

Rank: 6Rank: 6

积分
2756
金钱
2123
HASS币
40
发表于 2023-3-4 23:49:05 | 显示全部楼层
不要aqara
其余品牌随便,易微联,涂鸦都有
单火的话, WiFi版的,灯具上要加电容 70左右. Zigbee版的有不要加电容的,120左右, 需要额外zigbee网关.
有零火线的话,价格便宜点.
安全问题基本不用考虑. 除非你家没有漏保
回复

使用道具 举报

109

主题

1563

帖子

4942

积分

元老级技术达人

积分
4942
金钱
3374
HASS币
30
 楼主| 发表于 2023-3-5 00:01:20 | 显示全部楼层
sasukebinbin 发表于 2023-3-4 23:49
不要aqara
其余品牌随便,易微联,涂鸦都有
单火的话, WiFi版的,灯具上要加电容 70左右. Zigbee版的有不要加 ...

为什么不要aqara
回复

使用道具 举报

50

主题

1298

帖子

4854

积分

论坛DIY达人

积分
4854
金钱
3556
HASS币
20
发表于 2023-3-5 09:20:01 | 显示全部楼层

性价比低,在我眼里是高价低质,还不好看。
回复

使用道具 举报

35

主题

978

帖子

4499

积分

论坛元老

Rank: 8Rank: 8

积分
4499
金钱
3521
HASS币
20
发表于 2023-3-5 09:33:19 | 显示全部楼层
tuya有一款挺好的,很小巧,40*40的尺寸,最高到4路,有zigbee和wifi的,建议wifi的,zigbee信号感觉有点问题
回复

使用道具 举报

109

主题

1563

帖子

4942

积分

元老级技术达人

积分
4942
金钱
3374
HASS币
30
 楼主| 发表于 2023-3-5 12:12:02 | 显示全部楼层
sctale 发表于 2023-3-5 09:33
tuya有一款挺好的,很小巧,40*40的尺寸,最高到4路,有zigbee和wifi的,建议wifi的,zigbee信号感觉有点问 ...

wifi协议的,接入ha也麻烦,zigbee是本地的,可以直接zha接入吧
回复

使用道具 举报

109

主题

1563

帖子

4942

积分

元老级技术达人

积分
4942
金钱
3374
HASS币
30
 楼主| 发表于 2023-3-5 12:13:28 | 显示全部楼层
sorrypqa 发表于 2023-3-5 09:20
性价比低,在我眼里是高价低质,还不好看。

aqara接入ha方便,其他的,还要折腾的
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-4-19 22:17 , Processed in 0.058658 second(s), 33 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表