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

 找回密码
 立即注册
查看: 295|回复: 1

[求助] 惠橘X1S刷esphome ota后插座断电重启

[复制链接]

3

主题

381

帖子

3377

积分

论坛元老

Rank: 8Rank: 8

积分
3377
金钱
2996
HASS币
0
发表于 2024-10-21 10:06:58 | 显示全部楼层 |阅读模式
本帖最后由 godzqh 于 2024-10-21 10:06 编辑

每次ota更新后插座会断开继电器后重新打开,能否让其不断开?
配置如下:

esphome:
  name: "x1s"
  friendly_name: "x1s"
  platformio_options:
    board_build.bkcrypt_coeffs: "00000000000000000000000000000000"
    board_build.bkota.key: "0123456789ABCDEF0123456789ABCDEF"
    board_build.bkota.iv: "0123456789ABCDEF"
    board_flash.download: "0x132000+0xA6000"
    board_flash.kvs: "0x1D8000+0x8000"
    board_flash.calibration: "0x1E0000+0x1000"
    board_flash.tlv: "0x1E1000+0x1000"
    board_flash.net: "0x1E2000+0x1000"
    board_flash.userdata: "0x1E3000+0x1D000"

bk72xx:
  board: generic-bk7231n-qfn32-tuya

logger:

# web_server:

captive_portal:

mdns:

api:

ota:

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  ap:

substitutions:
  voltage_divider: "800.4735172433958"
  current_resistor: "0.0010788674067058845"
  current_multiply: "0.4667266199455673"

preferences:
  flash_write_interval: 10min

status_led:
  pin:
    number: P11
    inverted: True

output:
  - platform: gpio
    id: led1
    pin:
      number: P10
      inverted: True

switch:
  - platform: gpio
    pin: P8
    name: "Relay"
    id: relay
    restore_mode: RESTORE_DEFAULT_OFF
    on_turn_on:
      - output.turn_on: led1
    on_turn_off:
      - output.turn_off: led1

binary_sensor:
- platform: gpio
   pin:
      number: P24
      mode: INPUT_PULLUP
      inverted: true
   name: "Switch"
   filters:
     - delayed_on_off: 100ms
   on_press:
     then:
       - switch.toggle: relay

sensor:
  - platform: hlw8012
    model: BL0937
    current_resistor: ${current_resistor}
    voltage_divider: ${voltage_divider}

    sel_pin:
      number: P26
      inverted: true

    cf_pin:
      number: P6
      inverted: true

    cf1_pin:
      number: P7
      inverted: true

    current:
      name: "Current"
      accuracy_decimals: 3
      filters:
          - multiply: ${current_multiply}
    voltage:
      name: "Voltage"
      accuracy_decimals: 2
    power:
      name: "Power"
      id: my_power
      accuracy_decimals: 2
    energy:
      name: "Energy"
      accuracy_decimals: 2

    update_interval: 5s

  - platform: wifi_signal
    name: "WiFi Signal"
    update_interval: 1min

  - platform: uptime
    name: Uptime
    update_interval: 1min



回复

使用道具 举报

52

主题

1349

帖子

5705

积分

论坛DIY达人

积分
5705
金钱
4356
HASS币
20
发表于 2024-10-21 15:28:25 | 显示全部楼层
要用在服务器、网络设备这些不能随便断电的地方,最好是用硬件来实现,
1、用磁保持继电器(省电)
2、用常闭继电器(省电)
3、以上都做不到的话,继电器驱动电路加1个三极管和1个电阻(费电)
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-12-23 02:01 , Processed in 0.060563 second(s), 24 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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