Thingspeak ESPHome configuration error

6 ビュー (過去 30 日間)
Matthias Borremans
Matthias Borremans 2022 年 5 月 2 日
Hi all,
my esphome which is correctly reading pH values, should send it's info to thingspeak using mqtt protocol. In the logs, it's shortly connecting and immediately disconnecint: TCP disconnected My current config is as follows
mqtt:
broker: mqtt3.thingspeak.com
username: usernamefromMQTT
password: passwordfromMQTT
client_id: ClienIDFromMQTT
discovery: 'false'
discovery_retain: 'false'
interval:
- interval: 3sec
then:
- mqtt.publish:
topic: channels/channelID/publish/WriteAPIKey
payload: field1=pH
sensor:
- platform: ads1115
multiplexer: 'A0_GND'
gain: 6.144
id: pH
name: "pH measurement"
unit_of_measurement: "pH"
accuracy_decimals: 1
state_class: "measurement"
update_interval: 1s
retain: false
filters:
- calibrate_linear:
- 0.00 -> 0.0
- 2.363 -> 7.0
- 5.00 -> 14.0

回答 (1 件)

Christopher Stapels
Christopher Stapels 2022 年 5 月 2 日
編集済み: Christopher Stapels 2022 年 5 月 2 日
Your topic syntax is incorrect. The syntax has changed from the previous MQTT broker. Have a look at the MQTT publish to a feed documentation for the correct syntax. Make sure you enable the device to publish to the channel you intend in the MQTT devices section.
  2 件のコメント
Matthias Borremans
Matthias Borremans 2022 年 5 月 2 日
編集済み: Matthias Borremans 2022 年 5 月 2 日
then this should be correct?
mqtt:
broker: 'mqtt3.thingspeak.com'
port: '1883'
username: 'username'
password: 'pass'
client_id: 'clientid'
discovery: 'false'
discovery_retain: 'false'
topic_prefix: 'channels'
interval:
- interval: 3sec
then:
- mqtt.publish:
topic: channels/1462749/publish
payload: field1=5&status=MQTTPUBLISH
qos: 0
retain: false
Christopher Stapels
Christopher Stapels 2022 年 5 月 2 日
looks better! Did you add the channel to your MQTT device permissions? If so, I think it should work.
Do you have a paid license? If not, the interval (3 seconds) is too small, you can only publish every 15 seconds for a free license, and you would be wasting seerver time with the extra requests.

サインインしてコメントする。

コミュニティ

その他の回答  ThingSpeak コミュニティ

カテゴリ

Help Center および File ExchangeWrite Data to Channel についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by