请选择 进入手机版 | 继续访问电脑版

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

 找回密码
 立即注册
12
返回列表 发新帖
楼主: hunterfox

esp8266+继电器 接入 hass

[复制链接]

0

主题

6

帖子

50

积分

注册会员

Rank: 2

积分
50
金钱
44
HASS币
0
发表于 2020-7-3 21:54:23 | 显示全部楼层
switch:
  - platform: mqtt
    name: "esp"
    state_topic: "esp/ontest/state"
    command_topic: "esp/GPIO/0"
    payload_on: "1"
    payload_off: "0"
    qos: 0
    retain: true

我最近也在学习hass,这个是今天刚调通的,和你一样esp8266+继电器+MQTT 接入 hass
回复

使用道具 举报

19

主题

103

帖子

845

积分

高级会员

Rank: 4

积分
845
金钱
742
HASS币
0
发表于 2020-7-5 21:09:52 | 显示全部楼层
hejie127 发表于 2020-7-2 22:03
ESPhome  请问该怎么写 开关状态?  实在看不懂这个语言。。
esphome:
  name: switch
  platform: ESP8266
  board: esp01_1m
  esp8266_restore_from_flash: yes
wifi:
  ssid: “你的ssid”
  password: “你的密码”

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "switch"
    password: "00000000"

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:
  password: "2020"

ota:
  password: "2020"
  
web_server:
  port: 80


binary_sensor:
  - platform: gpio
    pin:
      number: GPIO2
      mode: INPUT_PULLUP
      inverted: True
    name: "Button"
    on_press:
      - switch.toggle: relay

switch:
  - platform: gpio
    name: "switch"
    pin: GPIO0
    id: relay
    inverted: yes
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-3-28 17:11 , Processed in 1.908575 second(s), 21 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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