找回密碼
 立即註冊
惟家LINE群QRCODE
    查看: 1593|回覆: 0

    兩切智能開關DIY,材料成本只要一百塊台幣,使用220V電器...

    [複製鏈接]

    !lvup!   100%

    13

    主題

    17

    回帖

    232

    積分

    版主

    積分
    232
    發表於 2021-10-9 13:53:53 | 顯示全部樓層 |閱讀模式
    本帖最後由 diba 於 2021-11-22 16:00 編輯

    寫在前面: 本文試圖提醒您用電安全很重要,並非告訴您DIY這個東西很簡單,請有興趣的玩家謹慎評估自身對強電的了解程度,再決定要不要製作。

    本文所謂兩切開關,跟一般大家認知的雙切開關不同,個人覺得水電爸爸的影片跟這篇文章都很棒,建議大家都看看(省下我至少半個小時的打字,哈哈)


    那市面上有沒有兩切開關可以買的呢? 有的,不過有點小醜、有點小貴,且非智能開關。
    https://www.pcstore.com.tw/053701111/M01063205.htm
    (網上隨便搜的,如有冒犯敬請通知移除)

    接下來進入正題,我故意只列材料清單及完整esphome的yaml,懂點電的人看了就會,不知從何下手的人建議就算了,我不想有人因為本文發生意外。

    材料: nodemcu、ac-dc電源模塊、兩路繼電器、適合的外殼、微動開關、電線杜邦線若干

    yaml: (初學者寫的不好,更好寫法或者建議敬請不吝指教)
    1. substitutions:
    2.   device_name: pump #KQ400SIC變頻加壓馬達 #220V雙切智能開關

    3. esphome:
    4.   name: ${device_name}
    5.   platform: ESP8266
    6.   board: nodemcuv2

    7. logger:

    8. api:

    9. ota:
    10.   password: !secret wifi_pw

    11. web_server:
    12.   port: 80

    13. wifi:
    14.   ssid: !secret wifi_ssid
    15.   password: !secret wifi_pw
    16.   ap:
    17.     ssid: "${device_name}_Fallback"
    18.     password: !secret wifi_pw

    19. captive_portal:

    20. switch:
    21.   - platform: gpio
    22.     pin:
    23.       number: D6
    24.       inverted: true
    25.     id: relay1
    26.     restore_mode: always_off
    27.   - platform: gpio
    28.     pin:
    29.       number: D7
    30.       inverted: true
    31.     id: relay2
    32.     restore_mode: always_off
    33.   - platform: template
    34.     name: ${device_name}
    35.     id: temp_switch
    36.     turn_on_action:
    37.       - then:
    38.         - switch.turn_on: relay1
    39.         - switch.turn_on: relay2
    40.         - switch.template.publish:
    41.             id: temp_switch
    42.             state: on
    43.     turn_off_action:
    44.       - then:
    45.         - switch.turn_off: relay1
    46.         - switch.turn_off: relay2
    47.         - switch.template.publish:
    48.             id: temp_switch
    49.             state: off

    50. binary_sensor:
    51.   - platform: gpio
    52.     id: button
    53.     pin:
    54.       number: D4
    55.       mode: INPUT_PULLUP
    56.       inverted: True
    57.     filters:
    58.       - delayed_on: 30ms
    59.       - delayed_off: 30ms
    60.     on_click:
    61.       - switch.toggle: relay1
    62.       - switch.toggle: relay2
    63.       - switch.template.publish:
    64.           id: temp_switch
    65.           state: !lambda 'return id(relay1).state;'
    66.   - platform: status
    67.     name: "${device_name}_status"
    68.    
    69. sensor:
    70.   - platform: wifi_signal
    71.     name: "${device_name}_WiFi_signal"
    72.     update_interval: 60s

    73.   - platform: uptime
    74.     name: "${device_name}_uptime"

    75. text_sensor:
    76.   - platform: version
    77.     name: "${device_name}_ESPHome_version"   
    複製代碼


    改裝前,傳統兩切開關:




    改裝後,智能兩切開關:




    裝置網頁介面、及HA裡的開關,按鈕同時toggle兩個繼電器,也就是本文所說的兩切。


    以上,祝所有玩家的HA都能智能又安全。

    本帖子中包含更多資源

    您需要 登入 纔可以下載或查看,沒有賬號?立即註冊

    ×
    您需要登入後纔可以回帖 登入 | 立即註冊

    本版積分規則

    Archiver|手機版|惟家的智能論壇

    GMT+8, 2026-9-24 11:28 , Processed in 0.089525 second(s), 31 queries .

    快速回覆 返回頂部 返回列表