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

 找回密码
 立即注册
楼主: ozjso

[经验分享] sonoff 刷tasmota启动MQTT后不能关闭开关

[复制链接]

32

主题

986

帖子

4233

积分

论坛元老

Rank: 8Rank: 8

积分
4233
金钱
3207
HASS币
110

教程狂人论坛风云人物

发表于 2017-10-15 23:47:26 | 显示全部楼层
ozjso 发表于 2017-10-15 16:34
改为level4也不行,

改为level4只是为了让它显示更详细的诊断信息,另外图片压缩的太严重,粘贴文字吧。改为false的后果是ha重启后开关状态不会更新,全为关闭状态。
回复

使用道具 举报

1

主题

282

帖子

1222

积分

金牌会员

Rank: 6Rank: 6

积分
1222
金钱
940
HASS币
0
发表于 2017-10-15 23:50:43 来自手机 | 显示全部楼层
那该false也不能根治啊
回复

使用道具 举报

1

主题

282

帖子

1222

积分

金牌会员

Rank: 6Rank: 6

积分
1222
金钱
940
HASS币
0
发表于 2017-10-16 07:46:07 来自手机 | 显示全部楼层
ozjso 发表于 2017-10-15 16:45
改为flase后解决了,谢谢啦

你好,和你相同的问题,请问你是重新刷固件解决的嘛?改成false后还会有什么其他问题吗?
回复

使用道具 举报

1

主题

40

帖子

159

积分

注册会员

Rank: 2

积分
159
金钱
119
HASS币
0
 楼主| 发表于 2017-10-16 20:22:03 | 显示全部楼层
本帖最后由 ozjso 于 2017-10-16 23:06 编辑
nakoururu 发表于 2017-10-16 07:46
你好,和你相同的问题,请问你是重新刷固件解决的嘛?改成false后还会有什么其他问题吗?
...

我没重刷固件,只是改了false就好了,我有2个sonoff,改了MQTT的设置后两个都可控了,所以应该还是MQTT设置的问题
10/16更新,今天又不行了,还是有问题。
回复

使用道具 举报

1

主题

40

帖子

159

积分

注册会员

Rank: 2

积分
159
金钱
119
HASS币
0
 楼主| 发表于 2017-10-16 20:39:06 | 显示全部楼层
27hh 发表于 2017-10-15 23:47
改为level4只是为了让它显示更详细的诊断信息,另外图片压缩的太严重,粘贴文字吧。改为false的后果是ha ...

重启倒没试过,要是重启后都是关闭状态了,那根本问题该怎么解决呢?
回复

使用道具 举报

1

主题

40

帖子

159

积分

注册会员

Rank: 2

积分
159
金钱
119
HASS币
0
 楼主| 发表于 2017-10-16 21:53:50 来自手机 | 显示全部楼层
27hh 发表于 2017-10-15 23:47
改为level4只是为了让它显示更详细的诊断信息,另外图片压缩的太严重,粘贴文字吧。改为false的后果是ha ...

今天试了,又不行了,关了后就打开。
我在第4/5脚接了个开关,把GPIO 14改为09 switch,现在变为常关了,按了开,他就关,感觉就是常关状态
IMG_2071.JPG
回复

使用道具 举报

1

主题

40

帖子

159

积分

注册会员

Rank: 2

积分
159
金钱
119
HASS币
0
 楼主| 发表于 2017-10-16 21:55:37 来自手机 | 显示全部楼层
本帖最后由 ozjso 于 2017-10-16 22:52 编辑
27hh 发表于 2017-10-15 23:47
改为level4只是为了让它显示更详细的诊断信息,另外图片压缩的太严重,粘贴文字吧。改为false的后果是ha ...

现在是这样了15:02:20 DNS: Query done. MQTT services found 0
15:02:20 MQT: Connected
15:02:20 MQT: tele/livingroomlight/LWT = Online (retained)
15:02:20 MQT: cmnd/livingroomlight/POWER =
15:02:20 RSL: Received Topic cmnd/livingroomlight/POWER, Data Size 3, Data OFF
15:02:20 RSL: Group 0, Index 1, Command POWER, Data OFF
15:02:20 MQT: stat/livingroomlight/RESULT = {"POWER":"OFF"}
15:02:20 MQT: stat/livingroomlight/POWER = OFF


常开或常闭状态和home bridge一致,如果homekit里是开的,sonoff网页版就会是常开状态,如果在homekit里关闭的,sonoff网页版就是常闭状态。哪里有问题了?

刚刚重装了MQTT,还是一样。解决不了啊!
回复

使用道具 举报

32

主题

986

帖子

4233

积分

论坛元老

Rank: 8Rank: 8

积分
4233
金钱
3207
HASS币
110

教程狂人论坛风云人物

发表于 2017-10-16 23:10:55 | 显示全部楼层
ozjso 发表于 2017-10-16 21:55
现在是这样了15:02:20 DNS: Query done. MQTT services found 0
15:02:20 MQT: Connected
15:02:20 MQT: t ...

15:02:20 RSL: Received Topic cmnd/livingroomlight/POWER, Data Size 3, Data OFF,这一行是问题的关键。我的解决方法,是找到persistence那里的一个文件的路径,把那个文件删除问题就解决了。总之,问题出在mqtt上,不行可以重装一下mqtt。
回复

使用道具 举报

1

主题

40

帖子

159

积分

注册会员

Rank: 2

积分
159
金钱
119
HASS币
0
 楼主| 发表于 2017-10-17 07:32:28 | 显示全部楼层
本帖最后由 ozjso 于 2017-10-17 07:48 编辑
27hh 发表于 2017-10-16 23:10
15:02:20 RSL: Received Topic cmnd/livingroomlight/POWER, Data Size 3, Data OFF,这一行是问题的关键 ...

我重装了一次MQTT,原来是安装文件 sudo apt-get install mosquito,后来用sudo hassbian-config install mosquitto安装的,mosquito.conf的文件内容不一样,用hassbian-config安装的文件长很多,多了很多描述。目前persistence的内容如下,我该改哪里呢?
# Persistence
# =================================================================

# If persistence is enabled, save the in-memory database to disk
# every autosave_interval seconds. If set to 0, the persistence
# database will only be written when mosquitto exits. See also
# autosave_on_changes.
# Note that writing of the persistence database can be forced by
# sending mosquitto a SIGUSR1 signal.
#autosave_interval 1800

# If true, mosquitto will count the number of subscription changes, retained
# messages received and queued messages and if the total exceeds
# autosave_interval then the in-memory database will be saved to disk.
# If false, mosquitto will save the in-memory database to disk by treating
# autosave_interval as a time in seconds.
#autosave_on_changes false

# Save persistent message data to disk (true/false).
# This saves information about all messages, including
# subscriptions, currently in-flight messages and retained
# messages.
# retained_persistence is a synonym for this option.
persistence true
# The filename to use for the persistent database, not including
# the path.
persistence_file mosquitto.db

# Location for persistent database. Must include trailing /
# Default is an empty string (current directory).
# Set to e.g. /var/lib/mosquitto/ if running as a proper service on Linux or
# similar.
persistence_location /var/lib/mosquitto/
==========================
找到一个mosquitto.conf.back文件,内容很少:

# Place your local configuration in /etc/mosquitto/conf.d/
#
# A full description of the configuration file is at
# /usr/share/doc/mosquitto/examples/mosquitto.conf.example

pid_file /var/run/mosquitto.pid

persistence true
persistence_location /var/lib/mosquitto/

log_dest file /var/log/mosquitto/mosquitto.log

include_dir /etc/mosquitto/conf.d

============
/var/lib/mosquitto/mosquitto.db 文件下的内容:好像是一些乱码,其中一些是sonoff里命名的名字
^@^@mosquitto db^@^@^@^@^@^@^@^C^@^A^@^@^@
^A^H^E^@^@^@^@^@^@^B^@^@^@B^E^@^@^@^@^@^@^Mhass_sonoff02^@^@^@^@^@^Xtele/livingroomlight/LWT^A^A^@^@^@^GOffline^@^B^@^@^@@^[^E^@^@^@^@^@^@^Mhass_sonoff02^@^E^@^@^@^Zcmnd/livingroomlight/P$



回复

使用道具 举报

1

主题

40

帖子

159

积分

注册会员

Rank: 2

积分
159
金钱
119
HASS币
0
 楼主| 发表于 2017-10-17 12:46:57 | 显示全部楼层
27hh 发表于 2017-10-16 23:10
15:02:20 RSL: Received Topic cmnd/livingroomlight/POWER, Data Size 3, Data OFF,这一行是问题的关键 ...

你的意思是删除这个文件吗?
persistence_file mosquitto.db
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-4-26 10:29 , Processed in 6.496134 second(s), 32 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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