Team, 

I would like to control a Tasmota Smart plug with MQTT commands from iammeter cloud.

I have seen your DEMO and configured your DEMO plug successfully (have not seen the light ON/OFF which is in your demo, but changed ON/OFF status of your DEMO plug with MQTT command from Iammeter cloud and the consol of your DEMO has shown as well that commands were recieved)

I have copied the setting from DEMO to my Smart plug but - despite similar settings - it can't connect to "mqtt.iammeter.com:1883"

My Tasmota smart plug  - PLS see the link below Nous A1T (Tasmota 12.1.1 by Theo Arends) - is behind a router and it works both from local network and from Internet. (I mean I can switch it ON/OFF  via port 80)

https://nous.technology/product/a1t.html?show=manual

Should I make any setting on my Dlink DIR-655 router to make connection to your server possible PLS? Set up a virtual server or enable more than the 1883 port for example...

Thanks Gabor

This is what I see in consol:

00:00:00.001 HDW: ESP8266EX
00:00:00.050 CFG: Loaded from flash at F9, Count 147
00:00:00.056 QPC: Count 1
00:00:00.065 Project tasmota - Tasmota Version 12.1.1(tasmota)-2_7_4_9(2022-09-01T10:06:57)
00:00:00.556 WIF: Connecting to AP1 DIR655BG Channel 5 BSSId C0:A0:BB:E3:92:83 in mode 11n as device-edc5d5fbfc3744fa--3526...
00:00:01.803 WIF: Connected
00:00:02.005 HTP: Web server active on device-edc5d5fbfc3744fa--3526 with IP address 192.168.1.139
22:40:18.021 MQT: Attempting connection...
22:40:18.256 MQT: Connect failed to mqtt.iammeter.com:1883, rc -2. Retry in 10 sec
22:40:21.413 QPC: Reset
22:40:29.042 MQT: Attempting connection...
22:40:29.282 MQT: Connect failed to mqtt.iammeter.com:1883, rc -2. Retry in 20 sec
22:40:50.003 MQT: Attempting connection...
22:40:50.236 MQT: Connect failed to mqtt.iammeter.com:1883, rc -2. Retry in 30 sec
22:41:21.288 MQT: Attempting connection...
22:41:21.521 MQT: Connect failed to mqtt.iammeter.com:1883, rc -2. Retry in 40 sec
22:42:02.537 MQT: Attempting connection...
22:42:02.772 MQT: Connect failed to mqtt.iammeter.com:1883, rc -2. Retry in 50 sec
22:42:54.539 MQT: Attempting connection...
22:42:54.772 MQT: Connect failed to mqtt.iammeter.com:1883, rc -2. Retry in 60 sec
22:43:56.296 MQT: Attempting connection...
22:43:56.529 MQT: Connect failed to mqtt.iammeter.com:1883, rc -2. Retry in 70 sec
22:45:07.514 MQT: Attempting connection...
22:45:07.754 MQT: Connect failed to mqtt.iammeter.com:1883, rc -2. Retry in 80 sec
22:45:17.420 RSL: STATE = {"Time":"2023-02-03T22:45:17","Uptime":"0T00:05:04","UptimeSec":304,"Heap":26,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"MqttCount":0,"POWER":"OFF","Wifi":{"AP":1,"SSId":"DIR655BG","BSSId":"C0:A0:BB:E3:92:83","Channel":5,"Mode":"11n","RSSI":78,"Signal":-61,"LinkCount":1,"Downtime":"0T00:00:03"}}
22:45:17.446 RSL: SENSOR = {"Time":"2023-02-03T22:45:17","ENERGY":{"TotalStartTime":"2023-02-03T15:56:37","Total":0.010,"Yesterday":0.000,"Today":0.010,"Period": 0,"Power": 0,"ApparentPower": 0,"ReactivePower": 0,"Factor":0.00,"Voltage": 0,"Current":0.000}}
22:46:30.050 MQT: Attempting connection...

Thread Status
8
542
2
2
0

Sort replies by:

Please try to use a mqtt client software to do the authentication with the same username and pwd and check whether it can pass or not

I have installed MQTTX on a desktop on the same local network where the SMART plug is located, it can connect to iammeter cloud






The only one issue I see with that one is, if I Subscribed to iammeter topic "device/edc5d5fbfc3744fa/"

and send a cmd/power command with payload 1, I don't get any message there. (even if a command is wrong, the client should get the message I think..)



from Tasmota Nous A1T smart plug point of view however I am not on that level yet as it can't connect to your site. Last time I forgot to send you the Tasmota config of the plug, PLS see below

Messages on Smart plug's console are the same still

09:15:38.044 MQT: Attempting connection...
09:15:38.286 MQT: Connect failed to mqtt.iammeter.com:1883, rc -2. Retry in 30 sec
09:16:09.029 MQT: Attempting connection...
09:16:09.270 MQT: Connect failed to mqtt.iammeter.com:1883, rc -2. Retry in 40 sec
09:16:50.291 MQT: Attempting connection...
09:16:50.535 MQT: Connect failed to mqtt.iammeter.com:1883, rc -2. Retry in 50 sec
09:17:41.553 MQT: Attempting connection...
09:17:41.791 MQT: Connect failed to mqtt.iammeter.com:1883, rc -2. Retry in 60 sec
09:18:42.800 MQT: Attempting connection...
09:18:43.047 MQT: Connect failed to mqtt.iammeter.com:1883, rc -2. Retry in 70 sec

Hi Team,

to may answer above PLS see the followings. Science morning I have played a little bit - I can connect with MQTT-x client to mqtt.iammeter.com, can send and receive messages, PLS see the the screenshot below.

On other hand when I connect to "test.mosquitto.org" broker with the Tasmota smart plug, the connection process pass the RC-2 level (RC -2 MQTT_CONNECT_FAILED the network connection failed), and stops at RC 5 level only (5 MQTT_CONNECT_UNAUTHORIZED the client was not authorized to connect) which is right I think as I am not allowed to "abuse" their broker with my smart plug... 

This shows for me(I think so), that the issue is not with my Network connection either with the Tasmota Plug, but more with the authentication of my smart plug at IAMMETER... (??)

PLS see some screen shoots which underpins what I wrote above

This shows that MQTT-x is connected to iammeter MQTT and exchange messages (read the message as well PLS it explains what I did)



The Misquitto configration of Tasmota smart plug




PLS see below the consol messages at Smart Plug (with Mosquitto settings)

00:00:00.002 HDW: ESP8266EX
00:00:00.050 CFG: Loaded from flash at F9, Count 286
00:00:00.056 QPC: Count 1
00:00:00.063 NRG: Init driver 1
00:00:00.066 Project tasmota - Tasmota Version 12.3.1(tasmota)-2_7_4_9(2022-12-16T10:28:17)
00:00:00.556 WIF: Connecting to AP1 DIR655BG Channel 5 BSSId C0:A0:BB:E3:92:83 in mode 11n as testtopic-Data-3526...
00:00:01.754 WIF: Connected
00:00:02.006 HTP: Web server active on testtopic-Data-3526 with IP address 192.168.1.139
22:01:28.025 MQT: Attempting connection...
22:01:28.236 MQT: Connect failed to test.mosquitto.org:1883, rc 5. Retry in 10 sec
22:01:31.397 QPC: Reset
22:01:39.042 MQT: Attempting connection...
22:01:39.293 MQT: Connect failed to test.mosquitto.org:1883, rc 5. Retry in 20 sec
22:02:00.019 MQT: Attempting connection...
22:02:00.284 MQT: Connect failed to test.mosquitto.org:1883, rc 5. Retry in 30 sec


Any advise is appreciated.. 

Thanks 

Gabor

Team, 

to my two answers above(sorry if I provide to much data, but I hope it helps you to help me..) - I have found a site where I can connect my Smart plug and it works - so not my network or Smart plug seems to be the reason of the connection problem with iammeter mqtt.  

PLS see the screenshot of the established connection with EMQX Cloud, the configuration of Smart plug and the consol message of Smart plug about the working connection.. 

This is what I would like to reach with mqtt iammeter to control my plug and power consumption..

00:00:00.001 HDW: ESP8266EX
00:00:00.050 CFG: Loaded from flash at F9, Count 294
00:00:00.055 QPC: Count 1
00:00:00.062 NRG: Init driver 1
00:00:00.066 Project tasmota - Tasmota Version 12.3.1(tasmota)-2_7_4_9(2022-12-16T10:28:17)
00:00:00.558 WIF: Connecting to AP1 DIR655BG Channel 5 BSSId C0:A0:BB:E3:92:83 in mode 11n as testtopic-Data-3526...
00:00:01.753 WIF: Connected
00:00:02.004 HTP: Web server active on testtopic-Data-3526 with IP address 192.168.1.139
22:32:42.005 MQT: Attempting connection...
22:32:42.508 MQT: Connected
22:32:42.512 MQT: testtopic/Data/tele/LWT = Online (retained)
22:32:42.514 MQT: testtopic/Data/cmnd/POWER =
22:32:42.519 MQT: testtopic/Data/tele/INFO1 = {"Info1":{"Module":"NOUS A1T","Version":"12.3.1(tasmota)","FallbackTopic":"cmnd/DVES_C32DC6_fb/","GroupTopic":"tasmotas/cmnd/"}}
22:32:42.528 MQT: testtopic/Data/tele/INFO2 = {"Info2":{"WebServerMode":"Admin","Hostname":"testtopic-Data-3526","IPAddress":"192.168.1.139"}}
22:32:42.541 MQT: testtopic/Data/tele/INFO3 = {"Info3":{"RestartReason":"Software/System restart","BootCount":39}}
22:32:42.551 MQT: testtopic/Data/stat/RESULT = {"POWER":"OFF"}
22:32:42.556 MQT: testtopic/Data/stat/POWER = OFF

Hi:

Yes, I agree with you, the problem occurs in the auth process between the MQTT broker and tasmota

I found this topic that once discusses nearly the same issue.

Downward the version of tasmota will solve this problem(please see below), but we also do not know the difference between these two versions in tasmota.

https://imeter.club/topic/66

If you know the reason later, please inform us ,thanks

Thanks for your answer, to downgrade to 8.5.1 seems to be feasible solution and I will let you know once I succeed with that, before I do it however, I would like to start with the other suggestion at the very and of the thread you mentioned.

"dolphinBoiler

Try to increase the MQTT_CLIENT_WIFI_TIMEOUT either by compiling customer firmware or by using MqttWifiTimeout command. 

Version 9.1.0.2 changed MQTT Wifi connection timeout from 5000ms to 200ms"


II don't know this command - to be honest my MQTT knwoledge is limted - and not found on the internet the "MqttWifiTimeout command" syntax  either. Do you know by chance what should I enter in Tasmota consol exactly to modify this value PLS? 

Thanks 

Gabor

Team,

thank you for you hint, it was easier than expected and it works. I have not updated the firmware - I use 12.3.1 Tasmota  firmware on Nous A1T smart plug - , but changed the MqttWifiTimeout value as suggested by dolphinBioler.

You can change the value if you enter to Tasmota console the comand "MqttWifiTimeout 2000"  (it changed from default 200ms value to 2000ms what worked for me. (if I set too high value - possible up to 20000 - than smart plug becomes slow, if value is too low that can't connect to iammeter MQTT) 

It seems to me if WiFi setup is complex(I have 3 routers) this value needs to be increased from default.

Thank you very much for help!

Gabor


I set 1000ms, it can connect still and response time is OK as well... "MqttWifiTimeout 1000"

Looks like you are new here. Register for free, learn and contribute.