Closed chriskmn closed 6 years ago
Just switched to the MQTT_PUBSUBCLIENT library and it works again:
19:43:56 MQT: tele/sonoff-9/SENSOR = {"Time":"2018-07-19T19:43:56","AM2301":{"Temperature":30.1,"Humidity":36.8},"TempUnit":"C"}
so there seems to be a bug in the MQTT_TASMOTAMQTT library
Thnx. I will investigate.
Do you always receive this result with tele
19:10:48 MQT: tele/sonoff-9/SENSOR = OFF,"AM2301":"Temperature":31.2,"Humidity":35.2},"TempUnit":"C"}
or sometimes?
Does it also happen when you execute command status 8
Do you have rules defined and if so pls show them.
Cannot reproduce...
I have no rules and I get it allways with tele. I will try status 8 and report.
I also did a reset 2 and got the same result.
so, flashed back to tasmota mqtt and same result:
15:54:53 MQT: tele/sonoff-9/SENSOR = OFF,"AM2301":{"Temperature":28.5,"Humidity":42.9},"TempUnit":"C"} 15:55:04 CMD: status 8 15:55:04 MQT: stat/sonoff-9/STATUS8 = {"StatusSNS":{"Time":"2018-07-20T15:55:04","AM2301":{"Temperature":28.5,"Humidity":43.0},"TempUnit":"C"}}
And if you change topic from sonoff-9
to sonoff-10
it's ok?
this is my user_config:
/* user_config.h - user specific configuration for Sonoff-Tasmota
Copyright (C) 2018 Theo Arends
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/. */
/*****\
//#define USE_CONFIG_OVERRIDE // Uncomment to use user_config_override.h file. See README.md
/*****\
// -- Master parameter control --------------------
//#define BE_MINIMAL // Minimal version if upgrade memory gets tight (-45k code, -2k mem)
// -- Project -------------------------------------
// -- Wifi ----------------------------------------
// (WIFI_RESTART, WIFI_SMARTCONFIG, WIFI_MANAGER, WIFI_WPSCONFIG, WIFI_RETRY, WIFI_WAIT)
// -- Syslog --------------------------------------
// -- Ota -----------------------------------------
// -- MQTT ----------------------------------------
// -- MQTT topics --------------------------------- // Example "tasmota/bedroom/%topic%/%prefix%/" up to 80 characers
// %prefix% token options
// May be named the same as PUB_PREFIX
// %topic% token options (also ButtonTopic and SwitchTopic)
// -- MQTT - Telemetry ----------------------------
// -- MQTT - Domoticz -----------------------------
// -- MQTT - Home Assistant Discovery -------------
// -- HTTP ----------------------------------------
// -- Time - Up to three NTP servers in your region
// -- Time - Start Daylight Saving Time and timezone offset from UTC in minutes
// -- Time - Start Standard Time and timezone offset from UTC in minutes
// -- Location ------------------------------------
// -- Application ---------------------------------
// (LED_OFF, LED_POWER, LED_MQTTSUB, LED_POWER_MQTTSUB, LED_MQTTPUB, LED_POWER_MQTTPUB, LED_MQTT, LED_POWER_MQTT)
// (POWER_ALL_OFF, POWER_ALL_ON, POWER_ALL_SAVED_TOGGLE, POWER_ALL_SAVED, POWER_ALL_ALWAYS_ON, POWER_ALL_OFF_PULSETIME_ON)
/*****\
//#define USE_ARDUINO_OTA // Add optional support for Arduino OTA (+13k code)
// -- Localization -------------------------------- // If non selected the default en-GB will be used //#define MY_LANGUAGE bg-BG // Bulgarian in Bulgaria //#define MY_LANGUAGE cs-CZ // Czech in Czech //#define MY_LANGUAGE de-DE // German in Germany //#define MY_LANGUAGE el-GR // Greek in Greece //#define MY_LANGUAGE en-GB // English in Great Britain. Enabled by Default //#define MY_LANGUAGE es-AR // Spanish in Argentina //#define MY_LANGUAGE fr-FR // French in France //#define MY_LANGUAGE hu-HU // Hungarian in Hungary //#define MY_LANGUAGE it-IT // Italian in Italy //#define MY_LANGUAGE nl-NL // Dutch in the Netherlands //#define MY_LANGUAGE pl-PL // Polish in Poland //#define MY_LANGUAGE pt-BR // Portuguese in Brazil //#define MY_LANGUAGE pt-PT // Portuguese in Portugal //#define MY_LANGUAGE ru-RU // Russian in Russia //#define MY_LANGUAGE uk-UK // Ukrainian in Ukrain //#define MY_LANGUAGE zh-CN // Chinese (Simplified) in China //#define MY_LANGUAGE zh-TW // Chinese (Traditional) in Taiwan
/-------------------------------------------------------------------------------------------\
// Alternative MQTT driver does not block network when MQTT server is unavailable. No TLS support //#define MQTT_LIBRARY_TYPE MQTT_ESPMQTTARDUINO // Use (patched) esp-mqtt-arduino library (+4k8 code, +4k mem) - non-TLS only
// -- MQTT ----------------------------------------
// -- MQTT - Domoticz ----------------------------- //#define USE_DOMOTICZ // Enable Domoticz (+6k code, +0.3k mem) // #define DOMOTICZ_IN_TOPIC "domoticz/in" // Domoticz Input Topic // #define DOMOTICZ_OUT_TOPIC "domoticz/out" // Domoticz Output Topic
// -- MQTT - Home Assistant Discovery ------------- //#define USE_HOME_ASSISTANT // Enable Home Assistant Discovery Support (+2k code) // #define HOME_ASSISTANT_DISCOVERY_PREFIX "homeassistant" // Home Assistant discovery prefix
// -- MQTT - TLS ---------------------------------- // !!! TLS uses a LOT OF MEMORY so be careful to enable other options at the same time !!! //#define USE_MQTT_TLS // Use TLS for MQTT connection (+53k code, +15k mem)
// -- KNX IP Protocol ----------------------------- //#define USE_KNX // Enable KNX IP Protocol Support (+23k code, +3k3 mem)
// -- HTTP ----------------------------------------
// #define USE_EMULATION // Enable Belkin WeMo and Hue Bridge emulation for Alexa (+16k code, +2k mem)
// -- mDNS ----------------------------------------
//#define USE_DISCOVERY // Enable mDNS for the following services (+8k code, +0.3k mem)
// #define WEBSERVER_ADVERTISE // Provide access to webserver by name
// -- Time ----------------------------------------
#define SUNRISE_DAWN_ANGLE DAWN_NORMAL // Select desired Dawn Angle from (DAWN_NORMAL, DAWN_CIVIL, DAWN_NAUTIC, DAWN_ASTRONOMIC)
// -- Rules ---------------------------------------
// -- Internal Analog input -----------------------
// -- One wire sensors ---------------------------- // WARNING: Select none for default one DS18B20 sensor or enable one of the following two options for multiple sensors //#define USE_DS18x20 // Optional for more than one DS18x20 sensors with id sort, single scan and read retry (+1k3 code) //#define USE_DS18x20_LEGACY // Optional for more than one DS18x20 sensors with dynamic scan using library OneWire (+1k5 code)
// -- I2C sensors --------------------------------- //#define USE_I2C // I2C using library wire (+10k code, 0k2 mem, 124 iram)
// #define USE_BME680 // Add additional support for BME680 sensor using Bosch BME680 library (+4k code)
// #define USE_VEML6070 // Add I2C code for VEML6070 sensor (+0k5 code) // #define USE_TSL2561 // Add I2C code for TSL2561 sensor using library Joba_Tsl2561 (+2k3 code) // #define USE_SI1145 // Add I2C code for SI1145/46/47 sensor (+1k code) // #define USE_ADS1115 // Add I2C code for ADS1115 16 bit A/D converter based on Adafruit ADS1x15 library (no library needed) (+0k7 code) // #define USE_ADS1115_I2CDEV // Add I2C code for ADS1115 16 bit A/D converter using library i2cdevlib-Core and i2cdevlib-ADS1115 (+2k code) // #define USE_INA219 // Add I2C code for INA219 Low voltage and current sensor (+1k code) // #define USE_MGS // Add I2C code for Xadow and Grove Mutichannel Gas sensor using library Multichannel_Gas_Sensor (+10k code)
// -- SPI sensors --------------------------------- //#define USE_SPI // SPI using default library
// -- Serial sensors ------------------------------
//#define USE_SDM120 // Add support for Eastron SDM120-Modbus energy meter (+1k7 code)
//#define USE_SDM630 // Add support for Eastron SDM630-Modbus energy meter (+2k code)
// -- Low level interface devices -----------------
// #define USE_IR_HVAC // Support for HVAC system using IR (+2k code) // #define USE_IR_RECEIVE // Support for IR receiver (+5k5 code, 264 iram)
// #define USE_WS2812_DMA // DMA supports only GPIO03 (= Serial RXD) (+1k mem). When USE_WS2812_DMA is enabled expect Exceptions on Pow
/*****\
//#define USE_CLASSIC // Create sonoff-classic (See sonoff_post.h for selected features)
/*****\
//#define USE_ALL_SENSORS // Create sonoff-allsensors with all sensors enabled (See sonoff_post.h for selected sensors)
/*****\
//#define USE_KNX_NO_EMULATION // Create sonoff-knx with KNX but without Emulation (See sonoff_post.h)
/*****\
/*****\
sonoff-10:
16:03:25 MQT: tele/sonoff-10/STATE = {"Time":"2018-07-20T16:03:25","Uptime":"0T00:00:48","Vcc":3.514,"POWER":"OFF","Wifi":{"AP":1,"SSId":"malibu","RSSI":42,"APMac":"C8:0E:14:AD:EE:2E"}} 16:03:25 MQT: tele/sonoff-10/SENSOR = {"Time":"2018-07-20T16:03:25","AM2301":{"Temperature":28.7,"Humidity":41.9},"TempUnit":"C"} 16:03:48 CMD: status 8 16:03:49 MQT: stat/sonoff-10/STATUS8 = {"StatusSNS":{"Time":"2018-07-20T16:03:48","AM2301":{"Temperature":28.7,"Humidity":41.7},"TempUnit":"C"}}
And what happens with topic sonoff-9
and sleep 0
one sec....
this is the result with sonsoff-09: 16:05:34 MQT: tele/sonoff-09/STATE = {"Time":"2018-07-20T16:05:34","Uptime":"0T00:00:48","Vcc":3.500,"POWER":"OFF","Wifi":{"AP":1,"SSId":"malibu","RSSI":42,"APMac":"C8:0E:14:AD:EE:2E"}} 16:05:34 MQT: tele/sonoff-09/SENSOR = {"Time":"2018-07-20T16:05:34","AM2301":{"Temperature":28.7,"Humidity":41.1},"TempUnit":"C"}
sleep 0:
16:07:08 MQT: tele/sonoff-9/SENSOR = OFF,"AM2301":{"Temperature":28.7,"Humidity":41.2},"TempUnit":"C"}
I do change the value via web interface. do you change it via command ?
Weird! The problem is that where you see OFF it should have the time as in a correct message. This information has nothing to do with the kind of MQTT driver that is used and I see no releation to topic name too.
This will take some time as I also cannot replicate.....
that is really weird...... I'll investigate more.... changing topic with command leads to same result
some variants:
16:12:25 MQT: tele/sonoff-1/SENSOR = OFF,"AM2301":{"Temperature":28.8,"Humidity":43.0},"TempUnit":"C"}
16:12:58 MQT: tele/sonoff9/SENSOR = {"Time":"2018-07-20T16:12:58","AM2301":{"Temperature":28.8,"Humidity":43.0},"TempUnit":"C"}
16:13:47 MQT: tele/9/SENSOR = {"Time":"2018-07-20T16:13:47","AM2301":{"Temperature":28.9,"Humidity":42.8},"TempUnit":"C"}
16:14:25 MQT: tele/test-9/SENSOR = {"Time":"2018-07-20T16:14:25","AM2301":{"Temperature":28.9,"Humidity":43.4},"TempUnit":"C"}
16:15:47 MQT: tele/12345678/SENSOR = {"Time":"2018-07-20T16:15:47","AM2301":{"Temperature":28.9,"Humidity":43.0},"TempUnit":"C"}
16:16:48 MQT: tele/sonoff--/SENSOR = {"Time":"2018-07-20T16:16:48","AM2301":{"Temperature":28.9,"Humidity":43.5},"TempUnit":"C"}
16:30:38 MQT: tele/sonoff09/SENSOR = {"Time":"2018-07-20T16:30:38","AM2301":{"Temperature":29.1,"Humidity":43.8},"TempUnit":"C"}
16:31:23 MQT: tele/sonoff9/SENSOR = {"Time":"2018-07-20T16:31:23","AM2301":{"Temperature":29.1,"Humidity":43.7},"TempUnit":"C"}
16:32:16 MQT: tele/sonoff_9/SENSOR = {"Time":"2018-07-20T16:32:16","AM2301":{"Temperature":29.1,"Humidity":43.0},"TempUnit":"C"}
16:33:34 MQT: tele/sonoff.9/SENSOR = {"Time":"2018-07-20T16:33:34","AM2301":{"Temperature":29.1,"Humidity":43.3},"TempUnit":"C"}
and back to -9: 16:34:49 MQT: tele/sonoff-9/SENSOR = OFF,"AM2301":{"Temperature":29.1,"Humidity":43.3},"TempUnit":"C"}
What happens is that the string
{"Time":"2018-07-20T16:03:25","AM2301":{"Temperature":28.7,"Humidity":41.9},"TempUnit":"C"}
is built by different subroutines filling it with their local information. So first the time is entered, then the string is supposed to be appended by a sensor, in your case the AM2301 and finally the TempUnit is appended by a third subroutine. It seems the time data is overwritten by a power ON/OFF somewhere and then the string is still passed to the sensor subroutines....
I see currently no relation with topic naming but apparently it exists....
yes and it only happens with Tasmota lib, not with ESPArduino and Pubsub mqtt
Did some more tests. Still cannot reproduce...
11:42:55 MQT: tele/sonoff-9/STATE = {"Time":"2018-07-25T11:42:55","Uptime":"0T00:08:15","Vcc":2.964,"POWER":"OFF","Wifi":{"AP":2,"SSId":"indebuurt2","RSSI":94,"APMac":"00:22:6B:FE:8E:20"}}
11:42:55 MQT: tele/sonoff-9/SENSOR = {"Time":"2018-07-25T11:42:55","AM2301":{"Temperature":29.2,"Humidity":49.0},"TempUnit":"C"}
11:43:55 MQT: tele/sonoff-9/STATE = {"Time":"2018-07-25T11:43:55","Uptime":"0T00:09:15","Vcc":2.962,"POWER":"OFF","Wifi":{"AP":2,"SSId":"indebuurt2","RSSI":94,"APMac":"00:22:6B:FE:8E:20"}}
11:43:55 MQT: tele/sonoff-9/SENSOR = {"Time":"2018-07-25T11:43:55","AM2301":{"Temperature":29.2,"Humidity":49.0},"TempUnit":"C"}
Well, may be then it miht be related to my aruino IDE environment
Mine does this with 6.1.1c:
00:00:00 Project sonoff bme680_1_5140 (Topic bme680_1_5140, Fallback DVES_1BAB51, GroupTopic sonoffs) Version 6.1.1c-2_4_1 00:00:00 WIF: Connecting to AP1 WiFi2016AP1 in mode 11N as bme680_1_5140-2897... 00:00:05 WIF: Connected 00:00:05 DNS: Initialized 00:00:05 HTP: Web server active on bme680_1_5140-2897.local with IP address 192.168.1.58 00:00:06 MQT: Attempting connection... 00:00:06 MQT: Connected 00:00:06 MQT: tele/bme680_1_5140/LWT = Online (retained) 00:00:06 MQT: cmnd/bme680_1_5140/POWER = 00:00:06 MQT: tele/bme680_1_5140/INFO1 = {"Module":"Generic","Version":"6.1.1c","FallbackTopic":"DVES_1BAB51","GroupTopic":"sonoffs"} 00:00:06 MQT: tele/bme680_1_5140/INFO2 = {"WebServerMode":"Admin","Hostname":"bme680_1_5140-2897","IPAddress":"192.168.1.58"} 00:00:06 MQT: tele/bme680_1_5140/INFO3 = {"RestartReason":"Software/System restart"} 00:00:06 MQT: homeassistant/light/bme680_1_5140_1/config = (retained) 00:00:06 MQT: homeassistant/switch/bme680_1_5140_1/config = (retained) 00:00:06 MQT: homeassistant/light/bme680_1_5140_2/config = (retained) 00:00:06 MQT: homeassistant/switch/bme680_1_5140_2/config = (retained) 00:00:06 MQT: homeassistant/light/bme680_1_5140_3/config = (retained) 00:00:06 MQT: homeassistant/switch/bme680_1_5140_3/config = (retained) 00:00:06 MQT: homeassistant/light/bme680_1_5140_4/config = (retained) 00:00:06 MQT: homeassistant/switch/bme680_1_5140_4/config = (retained) 00:00:06 MQT: homeassistant/light/bme680_1_5140_5/config = (retained) 00:00:06 MQT: homeassistant/switch/bme680_1_5140_5/config = (retained) 00:00:06 MQT: homeassistant/light/bme680_1_5140_6/config = (retained) 00:00:06 MQT: homeassistant/switch/bme680_1_5140_6/config = (retained) 00:00:06 MQT: homeassistant/light/bme680_1_5140_7/config = (retained) 00:00:06 MQT: homeassistant/switch/bme680_1_5140_7/config = (retained) 00:00:06 MQT: homeassistant/light/bme680_1_5140_8/config = (retained) 00:00:06 MQT: homeassistant/switch/bme680_1_5140_8/config = (retained) 13:47:57 MQT: stat/bme680_1_5140/RESULT = {"Command":"Unknown"} 13:47:59 MQT: tele/bme680_1_5140/STATE = {"Time":"2018-08-12T13:47:59","Uptime":"0T00:00:14","Vcc":2.973,"Wifi":{"AP":1,"SSId":"WiFi2016AP1","RSSI":86,"APMac":"78:8A:20:5A:41:76"}} 13:47:59 MQT: tele/bme680_1_5140/SENSOR = {"Time":"2018-08-12T13:47:59","BME680":{"Temperature":25.8,"Humidity":43.6,"Pressure":1012.3,"Gas":868.30},"TempUnit":"C"}
Will there be support for mqtt sensor discovery by Home Assistant? So far only switch and light work.
So after evaluating a couple of things I finally found out, that there is a strong connection between the homebridge module „homebridge-mqtt-switch-tasmota“ and the „homebridge-fhem“ module of homebridge.
In this special case I declared the temperature and humidity feature of the sonoff-th in homebridge (via config.json) and the switch feature in fhem (via fhem.cfg). So two different instances accessed the sonoff TH device.
After putting all three features (temp., hum. and switch) to homebridge (-> config.json) everything is working fine again. So no homebridgemapping in fhem.
So sharing features between fhem and homebridge seems to lead to issues. This also explains why changing the sonoff topic seems to solve the issue because the homebridge instance then can‘t access the device anymore....
Hi,
So, have you managed to solve your issue?
Hi ascillato
Yes, as described I have moved the three features completely to homebridge - no mix between fhem and homebridge. And now it works fine. But I don‘t know what causes the problem....
To make it complete: the issue occured when I had Temperature and Humidity integrated in homebridge (no homebridgemapping in fhem) and the switch itself integrated in fhem (with homebridgemapping). Maybe both instances active at the same time have corrupted the mqtt broker or the messages.
ok,
Great! Good to know. Thanks for share.
So, if the issue is solved, please close it. Thanks! :+1:
Hello,
after flashing to 6.1.1 I experience the following issue on a sonoff TH:
With the mqtt topic set to "sonoff-x" or "sonoff-18" get a correct SENSOR message:
19:02:14 MQT: tele/sonoff-x/SENSOR = {"Time":"2018-07-19T19:02:14","AM2301":{"Temperature":31.4,"Humidity":35.2},"TempUnit":"C"}
But when I set the mqtt topic to "sonoff-8" or "sonoff-9" I get this buggy SENSOR message:
19:10:48 MQT: tele/sonoff-9/SENSOR = OFF,"AM2301":{"Temperature":31.2,"Humidity":35.2},"TempUnit":"C"}
It seems that a single digit number after the "-" doesn't work.
I tried the cores 2.3.0 and 2.4.1. both with same result.
BUT I am using the Tasmota-MQTT library.
Status 0:
19:30:40 CMD: status 0 19:30:40 MQT: stat/sonoff-17/STATUS = {"Status":{"Module":4,"FriendlyName":["Sonoff-x"],"Topic":"sonoff-17","ButtonTopic":"0","Power":0,"PowerOnState":0,"LedState":0,"SaveData":0,"SaveState":0,"ButtonRetain":0,"PowerRetain":0}} 19:30:40 MQT: stat/sonoff-17/STATUS1 = {"StatusPRM":{"Baudrate":115200,"GroupTopic":"sonoffs","OtaUrl":"http://192.168.0.180:81/sonoff.bin","RestartReason":"Software/System restart","Uptime":"0T00:11:16","StartupUTC":"2018-07-19T18:19:24","Sleep":250,"BootCount":8,"SaveCount":8,"SaveAddress":"F4000"}} 19:30:40 MQT: stat/sonoff-17/STATUS2 = {"StatusFWR":{"Version":"6.1.1","BuildDateTime":"2018-07-18T21:48:36","Boot":31,"Core":"2_4_1","SDK":"2.2.1(cfd48f3)"}} 19:30:40 MQT: stat/sonoff-17/STATUS3 = {"StatusLOG":{"SerialLog":2,"WebLog":2,"SysLog":0,"LogHost":"192.168.0.180","LogPort":514,"SSId":["malibu","malibu"],"TelePeriod":60,"SetOption":["00008008","55818000"]}} 19:30:40 MQT: stat/sonoff-17/STATUS4 = {"StatusMEM":{"ProgramSize":500,"Free":500,"Heap":14,"ProgramFlashSize":1024,"FlashSize":1024,"FlashMode":3,"Features":["00000809","0F82C880","00000000","02B4009E","00000000"]}} 19:30:40 MQT: stat/sonoff-17/STATUS5 = {"StatusNET":{"Hostname":"sonoff-17-4245","IPAddress":"192.168.0.23","Gateway":"192.168.0.1","Subnetmask":"255.255.255.0","DNSServer":"192.168.0.1","Mac":"5C:CF:7F:F9:70:95","Webserver":2,"WifiConfig":2}} 19:30:40 MQT: stat/sonoff-17/STATUS6 = {"StatusMQT":{"MqttHost":"192.168.0.180","MqttPort":1883,"MqttClientMask":"DVES_%06X","MqttClient":"DVES_F97095","MqttUser":"mosquitto","MqttType":2,"MAX_PACKET_SIZE":1000,"KEEPALIVE":15}} 19:30:40 MQT: stat/sonoff-17/STATUS7 = {"StatusTIM":{"UTC":"Thu Jul 19 18:30:40 2018","Local":"Thu Jul 19 19:30:40 2018","StartDST":"Sun Mar 25 02:00:00 2018","EndDST":"Sun Oct 28 03:00:00 2018","Timezone":1,"Sunrise":"04:18","Sunset":"20:29"}} 19:30:40 MQT: stat/sonoff-17/STATUS10 = {"StatusSNS":{"Time":"2018-07-19T19:30:40","AM2301":{"Temperature":30.5,"Humidity":36.0},"TempUnit":"C"}} 19:30:40 MQT: stat/sonoff-17/STATUS11 = {"StatusSTS":{"Time":"2018-07-19T19:30:40","Uptime":"0T00:11:16","Vcc":3.499,"POWER":"OFF","Wifi":{"AP":1,"SSId":"malibu","RSSI":50,"APMac":"C8:0E:14:AD:EE:2E"}}}