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

 找回密码
 立即注册
查看: 11605|回复: 21

[技术探讨] 小白求助,sonoff为什么联不上HASS?

[复制链接]

1

主题

73

帖子

523

积分

高级会员

Rank: 4

积分
523
金钱
450
HASS币
0
发表于 2019-1-13 22:41:42 | 显示全部楼层 |阅读模式
按论坛上教程应该都安装好了,感觉开关联接不上MQTT,求大神帮我看看。
1.png
2.png
3.png
4.png
5.png
回复

使用道具 举报

0

主题

168

帖子

983

积分

高级会员

Rank: 4

积分
983
金钱
815
HASS币
0
发表于 2019-1-13 23:01:13 | 显示全部楼层
注意大小写区分
回复

使用道具 举报

13

主题

554

帖子

4310

积分

论坛元老

Jeff

Rank: 8Rank: 8

积分
4310
金钱
3756
HASS币
10

活跃会员

发表于 2019-1-14 07:51:41 | 显示全部楼层
信息太少。密码不对吧?都是4位mqtt?
Jeff
回复

使用道具 举报

8

主题

2073

帖子

6053

积分

论坛元老

流水无味

Rank: 8Rank: 8

积分
6053
金钱
3980
HASS币
145

灌水之王

发表于 2019-1-14 08:41:45 | 显示全部楼层
一个确实注意下大小写
二你把开关切换下状态看sonoff里面日记是什么
你目前日记里面全是温湿度的,HA里面是开关的写法
还有看下HA和MQTT里面有没弱密码报错
回复

使用道具 举报

2

主题

64

帖子

2295

积分

金牌会员

Rank: 6Rank: 6

积分
2295
金钱
2226
HASS币
30
发表于 2019-1-14 09:21:21 | 显示全部楼层
我是这样设置的,默认用户名homeassistant

mqtt:
  password: xxxxxx
  discovery: true

light:
  - platform: mqtt
    name: "客厅灯01"
    state_topic: "stat/sonoff/POWER"
    command_topic: "cmnd/sonoff/POWER"
    qos: 1
    payload_on: "ON"
    payload_off: "OFF"
    retain: true
sensor:
  - platform: mqtt
    name: "Temperature"
    state_topic: "tele/sonoff/SENSOR"
    value_template: "{{ value_json['AM2301'].Temperature }}"
    unit_of_measurement: "°C"
  - platform: mqtt
    name: "Humidity"
    state_topic: "tele/sonoff/SENSOR"
    value_template: "{{ value_json['AM2301'].Humidity }}"
    unit_of_measurement: "%"
回复

使用道具 举报

1

主题

73

帖子

523

积分

高级会员

Rank: 4

积分
523
金钱
450
HASS币
0
 楼主| 发表于 2019-1-14 09:49:48 | 显示全部楼层
swau221 发表于 2019-1-13 23:01
注意大小写区分

我检查过了,应该都是小写的,sonoff开关就是不能控制,MQTT服务器应该是联上了,如果联不上会报错误的,就是HASS没法接收开关发传感器数据及开关控制。
回复

使用道具 举报

1

主题

73

帖子

523

积分

高级会员

Rank: 4

积分
523
金钱
450
HASS币
0
 楼主| 发表于 2019-1-14 09:54:11 | 显示全部楼层
创意无限 发表于 2019-1-14 09:21
我是这样设置的,默认用户名homeassistant

mqtt:

应该也是这样写的。
回复

使用道具 举报

1

主题

73

帖子

523

积分

高级会员

Rank: 4

积分
523
金钱
450
HASS币
0
 楼主| 发表于 2019-1-14 18:44:41 | 显示全部楼层
00:00:00 Project sonoff Sonoff Version 6.4.1(sensors)-2_4_2
00:00:00 WIF: Connecting to AP1 SJBAP-2.4G in mode 11N as sonoff-3903...
00:00:07 WIF: Connected
00:00:07 DNS: Initialized
00:00:07 HTP: Web server active on sonoff-3903.local with IP address 192.168.6.24
00:00:09 MQT: Attempting connection...
00:00:14 MQT: Connect failed to 192.168.6.95:1883, rc -2. Retry in 10 sec
00:00:24 MQT: Attempting connection...
00:00:29 MQT: Connect failed to 192.168.6.95:1883, rc -2. Retry in 10 sec
00:00:40 MQT: Attempting connection...
00:00:40 MQT: Connected
00:00:40 MQT: tele/sonoff/LWT = Online (retained)
00:00:40 MQT: cmnd/sonoff/POWER =
00:00:40 MQT: tele/sonoff/INFO1 = {"Module":"Sonoff Basic","Version":"6.4.1(sensors)","FallbackTopic":"cmnd/DVES_518F3F_fb/","GroupTopic":"sonoffs"}
00:00:40 MQT: tele/sonoff/INFO2 = {"WebServerMode":"Admin","Hostname":"sonoff-3903","IPAddress":"192.168.6.24"}
00:00:40 MQT: tele/sonoff/INFO3 = {"RestartReason":"Power on"}
00:00:40 MQT: stat/sonoff/RESULT = {"POWER":"OFF"}
00:00:40 MQT: stat/sonoff/POWER = OFF
00:00:48 MQT: tele/sonoff/STATE = {"Time":"1970-01-01T00:00:48","Uptime":"0T00:00:39","SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER":"OFF","Wifi":{"AP":1,"SSId":"SJBAP-2.4G","BSSId":"76:7D:24:61:62:A4","Channel":1,"RSSI":100}}
00:00:48 MQT: tele/sonoff/SENSOR = {"Time":"1970-01-01T00:00:48","AM2301":{"Temperature":9.5,"Humidity":72.0},"TempUnit":"C"}
00:02:00 MQT: tele/sonoff/UPTIME = {"Time":"1970-01-01T00:02:00","Uptime":"0T00:01:51"}
00:05:48 MQT: tele/sonoff/STATE = {"Time":"1970-01-01T00:05:48","Uptime":"0T00:05:39","SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER":"OFF","Wifi":{"AP":1,"SSId":"SJBAP-2.4G","BSSId":"76:7D:24:61:62:A4","Channel":1,"RSSI":100}}
00:05:48 MQT: tele/sonoff/SENSOR = {"Time":"1970-01-01T00:05:48","AM2301":{"Temperature":9.6,"Humidity":71.6},"TempUnit":"C"}
00:10:09 APP: Serial logging disabled
00:10:48 MQT: tele/sonoff/STATE = {"Time":"1970-01-01T00:10:48","Uptime":"0T00:10:39","SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER":"OFF","Wifi":{"AP":1,"SSId":"SJBAP-2.4G","BSSId":"76:7D:24:61:62:A4","Channel":1,"RSSI":100}}
00:10:48 MQT: tele/sonoff/SENSOR = {"Time":"1970-01-01T00:10:48","AM2301":{"Temperature":9.6,"Humidity":71.9},"TempUnit":"C"}
00:15:48 MQT: tele/sonoff/STATE = {"Time":"1970-01-01T00:15:48","Uptime":"0T00:15:39","SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER":"OFF","Wifi":{"AP":1,"SSId":"SJBAP-2.4G","BSSId":"76:7D:24:61:62:A4","Channel":1,"RSSI":100}}
00:15:48 MQT: tele/sonoff/SENSOR = {"Time":"1970-01-01T00:15:48","AM2301":{"Temperature":9.6,"Humidity":71.5},"TempUnit":"C"}
00:20:48 MQT: tele/sonoff/STATE = {"Time":"1970-01-01T00:20:48","Uptime":"0T00:20:39","SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER":"OFF","Wifi":{"AP":1,"SSId":"SJBAP-2.4G","BSSId":"76:7D:24:61:62:A4","Channel":1,"RSSI":100}}
00:20:48 MQT: tele/sonoff/SENSOR = {"Time":"1970-01-01T00:20:48","AM2301":{"Temperature":9.7,"Humidity":71.5},"TempUnit":"C"}
00:25:48 MQT: tele/sonoff/STATE = {"Time":"1970-01-01T00:25:48","Uptime":"0T00:25:39","SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER":"OFF","Wifi":{"AP":1,"SSId":"SJBAP-2.4G","BSSId":"76:7D:24:61:62:A4","Channel":1,"RSSI":100}}
00:25:48 MQT: tele/sonoff/SENSOR = {"Time":"1970-01-01T00:25:48","AM2301":
{"Temperature":9.7,"Humidity":71.4},"TempUnit":"C"}
00:30:48 MQT: tele/sonoff/STATE = {"Time":"1970-01-01T00:30:48","Uptime":"0T00:30:39","SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER":"OFF","Wifi":{"AP":1,"SSId":"SJBAP-2.4G","BSSId":"76:7D:24:61:62:A4","Channel":1,"RSSI":100}}
00:30:48 MQT: tele/sonoff/SENSOR = {"Time":"1970-01-01T00:30:48","AM2301":{"Temperature":9.7,"Humidity":71.4},"TempUnit":"C"}
以上Sonoff开关的日志。
回复

使用道具 举报

2

主题

64

帖子

2295

积分

金牌会员

Rank: 6Rank: 6

积分
2295
金钱
2226
HASS币
30
发表于 2019-1-14 19:18:11 | 显示全部楼层
在sonoff web页面 状态切换 能不能开关?
回复

使用道具 举报

1

主题

73

帖子

523

积分

高级会员

Rank: 4

积分
523
金钱
450
HASS币
0
 楼主| 发表于 2019-1-14 19:41:26 | 显示全部楼层
创意无限 发表于 2019-1-14 19:18
在sonoff web页面 状态切换 能不能开关?

可以的,这是刚切换的信息。

00:26:22 MQT: stat/sonoff/RESULT = {"POWER":"ON"}
00:26:22 MQT: stat/sonoff/POWER = ON
00:26:24 MQT: stat/sonoff/RESULT = {"POWER":"OFF"}
00:26:24 MQT: stat/sonoff/POWER = OFF
00:30:19 MQT: tele/sonoff/STATE = {"Time":"1970-01-01T00:30:19","Uptime":"0T00:30:14","SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER":"OFF","Wifi":{"AP":1,"SSId":"SJBAP-2.4G","BSSId":"76:7D:24:61:62:A4","Channel":1,"RSSI":100}}
00:30:19 MQT: tele/sonoff/SENSOR = {"Time":"1970-01-01T00:30:19","AM2301":{"Temperature":10.0,"Humidity":70.8},"TempUnit":"C"}
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-24 15:29 , Processed in 0.294989 second(s), 35 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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