微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

家庭助理,接收MQTT时遇到问题

如何解决家庭助理,接收MQTT时遇到问题

我正试图将MobileAlerts气象站纳入我的家庭助手中。

在Synology NAS上,我正在运行以下脚本:

{
  "localIPv4Address": "192.168.0.xxx","mqtt": "mqtt://192.168.0.xxx","mqtt_home": "MobileAlerts/","mqtt_username": "mqtt_alert","mqtt_password": "MY_PASSWORT","logfile": "./MobileAlerts.log","logGatewayInfo": false,"proxyServerPort": 8080,"mobileAlertsCloudForward": false,"serverPost": null,"serverPostUser": null,"serverPostPassword": null

}

在家庭助理服务器(树莓派)上,我安装了具有以下配置的MQTT代理:

logins:
  - username: mqtt_alert
    password: MY_PASSWORT
anonymous: false
customize:
  active: false
  folder: MobileAlerts
certfile: fullchain.pem
keyfile: privkey.pem
require_certificate: false

现在,在我的NAS上,我看到该服务正在运行:

### Local IP address for proxy: 192.168.0.172
(node:31664) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(),Buffer.allocUnsafe(),or Buffer.from() methods instead.
Mobile-Alert Gateway : 001d8c0dffb7
Name                 : MOBILEALERTS-Gateway
Use DHCP             : true
DHCP IP              : 192.168.0.xxx
Fixed IP             : 192.168.1.xxx
DHCP Netmask         : 255.255.255.0
Fixed DNS IP         : 192.168.1.xxx
Fixed Gateway        : 192.168.1.xxx
Use Proxy            : true
Proxy Server Name    : 192.168.0.xxx
Proxy Port           : 8080
Data Server Name     : www.data199.com
### MQTT server is connected
undefined MobileAlerts/035xxc2xxd54d/json {"temperature":[22.4,22.4],"humidity":[63,63],"id":"0x35c27xxxx3d74d","t":"2020-11-03T18:40:58.000Z","offline":false}
undefined MobileAlerts/031xxxcd672ed2/json {"temperature":[22.1,22.1],"humidity":[62,62],"id":"0331cxxxxed2","t":"2020-11-03T18:41:15.000Z","offline":false}

最后,我尝试了以下配置(configuration.yaml)

mqtt:
  broker: 192.168.0.xxx
  port: 1883
  username: mqtt_alert
  password: MY_PASSWORD
  
  
sensor:
  - platform: mqtt
    name: "aaa"
    state_topic: "MobileAlerts/03xxxxxx6B08A6/json"
    unit_of_measurement: '°C'
    value_template: "{{value_json.temperature[0]}}"

但是,传感器状态始终保持“未知”。

有人看到我做错了吗?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。