找回密码
 立即注册

微信扫码登录

搜索
查看: 4970|回复: 15

Esp8266电脑开机卡pcb 【已验证】

[复制链接]

27

主题

2129

回帖

9221

积分

论坛元老

积分
9221
金钱
7060
HASS币
30

论坛元老

发表于 2021-11-29 15:11:32 | 显示全部楼层 |阅读模式
本帖最后由 情非殇 于 2021-11-30 09:30 编辑

如题,电脑开机卡,没啥屌用,并不会比某宝节省成本,只是满足了自编译固件接入ha的需求,局域网协议比较稳定。
【开/关机/重启动作,开/关机状态检测】

Snipaste_2021-11-29_15-07-31.png


Gerber_WIFI远程电脑开机卡 by alex.zip (92 KB, 下载次数: 44)

评分

参与人数 3金钱 +28 收起 理由
sorrypqa + 8 大神666!
dscao + 10 厉害了word楼主!
zxyny1989 + 10 厉害了word楼主!

查看全部评分

回复

使用道具 举报

27

主题

2129

回帖

9221

积分

论坛元老

积分
9221
金钱
7060
HASS币
30

论坛元老

 楼主| 发表于 2022-7-1 11:40:24 | 显示全部楼层
五千万啊 发表于 2022-6-30 17:19
能分享下  esphome代码吗?
substitutions:
  ds18b20_1: GPIO12
  ds18b20_2: '0x5600000DB4C24E28'
  computer_power: GPIO4
  computer_restart: GPIO5
  status: GPIO13

# # Example configuration entry
# globals:
#   - id: elevator_relay
#     type: int
#     restore_value: yes
#     initial_value: '0'

# Example configuration entry
dallas:
  - pin: $ds18b20_1

# Individual sensors
sensor:
  - platform: dallas
    address: $ds18b20_2
    name: "Chassis_Temperature"
    unit_of_measurement: °C

switch:
  ## 电源
  - platform: gpio
    name: "Computer_Power"
    pin: $computer_power
    id: relay1
    internal: true
    on_turn_on:
      - delay: 0.2s
      - switch.turn_off: relay1
  ## 重启
  - platform: gpio
    name: "Computer_Restart"
    pin: $computer_restart
    id: relay2
    internal: true
    on_turn_on:
      - delay: 0.2s
      - switch.turn_off: relay2
  ## 电脑
  - platform: template
    name: "7700K"
    lambda: |-
      if (id(relay3).state) {
        return true;
      } else {
        return false;
      }
    turn_on_action:
      - if:
          condition:
            binary_sensor.is_off: relay3
          then:
            - switch.turn_on: relay1
      # - delay: 1s
      # - lambda: |-
      #     id(elevator_relay) += 1;
    turn_off_action:
      # - switch.turn_on: relay1
      - mqtt.publish:
          topic: computer/shell_command/shutdown
          payload: action
  ## 重启8266
  # switch:
  - platform: restart
    name: "esp_restart"
    internal: true

binary_sensor:
  ## 电脑开机状态
  - platform: gpio
    pin:
      number: $status
      mode: INPUT_PULLUP
      inverted: True
    name: "Status"
    id: relay3
    internal: true
回复

使用道具 举报

27

主题

2129

回帖

9221

积分

论坛元老

积分
9221
金钱
7060
HASS币
30

论坛元老

 楼主| 发表于 2022-7-2 08:47:36 | 显示全部楼层
sorrypqa 发表于 2022-7-1 21:56
学习一下,谢谢分享,请教一下,这里有个出错提示是什么原因?

因为这条action是mqtt的代码,,我自己是用mqtt不用api的,注释掉就好了
回复

使用道具 举报

27

主题

2129

回帖

9221

积分

论坛元老

积分
9221
金钱
7060
HASS币
30

论坛元老

 楼主| 发表于 2022-7-2 20:28:04 | 显示全部楼层
本帖最后由 情非殇 于 2022-7-2 20:29 编辑
sorrypqa 发表于 2022-7-2 09:04
谢谢大佬指点,好像是关机用的,比较常用,如果电脑里安装了Airytec Switch Off,用这命令关机
http://19 ...

老实说,我也不知道esphome怎么写这个,所以我用mqtt转发给中枢,做一个联动

你可以从esphome创建个template switch或者别的什么传值的东西就好了,或者用直接用mqtt我这种
其实开机状态下,触发一下电源的那个switch就可以关闭,相信手控的逻辑就好了
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian ( 晋ICP备17001384号-1 )

GMT+8, 2025-8-2 14:46 , Processed in 0.050706 second(s), 10 queries , MemCached On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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