Announcement

Collapse
No announcement yet.

Tasmota and Setoption19

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Tasmota and Setoption19

    I just had an interesting experience trying to get a newly flashed Tasmota plug working with MQTT.

    For the life of me, I couldnt get mcsMQTT to automatically create a new HS device. After a lot of head scratching, I finally thought to look at the status of the Setoption19 option and saw it was switched off even though I knew I had turned it on. So I turned it on again, rebooted the module, and again saw Setoption19 turned off.

    Still scratching my head, I went to the web page describing the setoptions commands and found this
    https://tasmota.github.io/docs/Commands/#setoptions
    SetOption19 Tasmota discovery protocol used in Home Assistant Tasmota integration
    0 = enable Tasmota discovery (default)
    1 = use deprecated MQTT discovery (only with #define USE_HOME_ASSISTANT, does not exist in release binaries)
    If I'm understanding this correctly, Setoption19 has been deprecated and is no longer included in the binaries. This will sure make it harder to use tasmota with Homeseer.

    Sure enough, I reverted to firmware release 10.1.0 from 12.1.0 and device discovery worked as I'm used to seeing it. I think the change happened in 12.1.0 so 11.1.0 should be OK too but I didnt ry it.


    So am i interpreting this correctly? If so, everyone needs to be aware of this.

    #2
    While I did not confirm I believe you are correct. I knew Tasmota was going its own way with discovery. The whole idea of discovery is that a standard exists so clients can use the info to map the device into their system. While HomeAssistant discovery was based around the HA view of the world, it did exists as the defacto.

    Homie came along and defined a discovery that was not tailored to a specific platform. It would have made sense the Tasmota go this route.

    Tasmota was more concerned with managing precious memory space so defined a discovery that was based on Tasmota's constraints and organization. What is unfortunate is the memory constraint is becoming a non-issue as ESP8266 is being phased out in favor of ESP32 and Tasmota does support the ESP32.

    I am going to look into the Tasmota discovery with intention of including it in mcsMQTT. I already have hooks for Homie, but no devices yet to evaluate it.

    Comment


      #3
      Thanks for the info.

      Well, until then, I'm rolling back to 11.1.0

      Comment


        #4
        Just confirming that the tasmota discovery is not yet implemented, correct? I'm on the current build for both and want to make sure I'm not missing something.
        mcsMQTT v5.26.5.4
        tasmota v12.2.0
        Karl S
        HS4Pro on Windows 10
        1070 Devices
        56 Z-Wave Nodes
        104 Events
        HSTouch Clients: 3 Android, 1 iOS
        Google Home: 3 Mini units, 1 Pair Audios, 2 Displays

        Comment


          #5
          I have not done it yet, but next up. Recent focus has been on version 6 with new MQTT library.

          Comment


            #6
            No worries, Michael McSharry, I was just confirming to make sure I didn't have a bad seeing someplace. All the work you've put into the plugins is greatly appreciated!
            Karl S
            HS4Pro on Windows 10
            1070 Devices
            56 Z-Wave Nodes
            104 Events
            HSTouch Clients: 3 Android, 1 iOS
            Google Home: 3 Mini units, 1 Pair Audios, 2 Displays

            Comment


              #7
              I looked into Tasmota/Discovery and have not been able to find any documentation other than how to configure HomeAssistant Integration. I loaded a ESP32 and configured a number of GPIO for different functions just to see what would be produced. I also looked at the Tasmota source and picked out some information. There are two discovery messages one is for sensor and the other is for basic setup and use or relay/switch/button/light/shutter.

              Do you have any reference material for Tasmota Discovery? In general Tasmota is well documents on their web sites, but this is one area that is not well supported.

              What functionality do you have with your Tasmota device that was configured with the Homeassistant Discovery?

              Code:
              10:28:14 AM Topic tasmota/discovery/94B97EE9A03C/sensors Payload {
              "sn":{"Time":"2022-11-11T18:14:48",
                    "COUNTER":{"C1":0}},
              TEMPERATURE
              PRESSURE
              DISTANCE
              POWERUSAGE
              APPARENT_POWERUSAGE
              :
              etc
                    "ver":1
                   }
              
              10:28:14 AM Topic tasmota/discovery/94B97EE9A03C/config Payload {
              "ip":"192.168.0.189",
              "dn":"Tasmota",
              "fn":["Tasmota","Tasmota2",null,null,null,null,null,null],
              "hn":"tasmota-E9A03C-0060",
              "mac":"94B97EE9A03C",
              "md":"ESP32-DevKit",
              "ty":0,
              "if":0,
              "ofln":"Offline", (LWT offline)
              "onln":"Online", (LWT online)
              "state":["OFF","ON","TOGGLE","HOLD"],
              "sw":"12.2.0",
              "t":"tasmota_E9A03C", (topic)
              "ft":"%prefix%/%topic%/", (full topic)
              "tp":["cmnd","stat","tele"], (topic prefix options)
              "rl":[1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],   (3=Shutter, 2=Light, 1=Simple Relay)
              "swc":[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1], (switch modes)
              "swn":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null], (switch name)
              "btn":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], (button GPIO pin)
              "so":{"4":0,"11":0,"13":0,"17":0,"20":0,"30":0,"68":0,"73":0,"82":0,"114":0,"117":0},"lk":1,"lt_st":1, (SetOption)
              "sho":[0,0,0,0], (shutter options)
              "sht":[[0,0,0],[0,0,0],[0,0,0],[0,0,0]], (shutter type)
              "ver":1}​

              Comment


                #8
                I posted this in the Tasmota Discord:
                The output from setoption 19 1 has apparently changed from the HAss autodiscovery to a new format. I cannot find any documentation on the new format. Is it available and I am just missing such?​
                and received this response:
                It is not the output from SetOption19 1 which is deprecated (that setting has no effect for standard precompiled binaries), but from SetOption19 0 as the HA style MQTT discovery has been deprecated in favor of Tasmota discovery, with corresponding payloads from Tasmota. While there is no formal description of the format, this thread has most of the info: https://github.com/arendst/Tasmota/issues/9267​
                Karl S
                HS4Pro on Windows 10
                1070 Devices
                56 Z-Wave Nodes
                104 Events
                HSTouch Clients: 3 Android, 1 iOS
                Google Home: 3 Mini units, 1 Pair Audios, 2 Displays

                Comment


                  #9
                  I'm not seeing any discovery topics being broadcast at all regardless of the setoption19 setting. At least I dont see them in MQTT Explorer. Also, setoption19 keeps getting reset to 0 after every reboot so setoption19=1 is not persistent. This is with Tasmota v12.2.0 firmware..

                  I'm using a simple one relay smart module, Gosund WP3, with a relay, 2 LEDs, and a switch.

                  Reverting to Tasmota v10.1.0 gets everything working as it always did.

                  Edit: I spoke too soon. resetting setoption19 to off turns on the new discovery topic. Setoption19=on doesnt seem to do anything and is reset to 0 at the next reboot.

                  Comment


                    #10
                    As I understand it, the command is
                    Code:
                    Setoption19 0
                    without the =. It takes values of 0, 1, Off, On and can also be abbreviated to
                    Code:
                    SO19 1
                    .

                    With setoption19 set to 0, I see 2 discovery Tasmota topics posted. The topics from a test device (D1 Mini) I have with an LED (D3) and PWM (4) configured are included:
                    • tasmota/discovery/BCFF4DF7D75D/config
                      • {"ip":"192.168.1.8","dn":"Tasmota Tester 1","fn":["Tasmota Tester 01",null,null,null,null,null,null,null],"hn":"tester01-5981","mac":"BCFF4DF7D75D","md":"Generic","ty":0,"if":0,"ofl n":"Offline","onln":"Online","state":["OFF","ON","TOGGLE","HOLD"],"sw":"12.2.0","t":"tester01","ft":"%prefix%/%topic%/","tp":["cmnd","stat","tele"],"rl":[2,0,0,0,0,0,0,0],"swc":[-1,-1,-1,-1,-1,-1,-1,-1],"swn":[null,null,null,null,null,null,null,null],"btn":[0,0,0,0,0,0,0,0],"so":{"4":0,"11":0,"13":0,"17":0,"20":0,"30":0,"68":0,"7 3": 0,"82":0,"114":0,"117":0},"lk":1,"lt_st":1,"sho":[0,0,0,0],"sht":[[0,0,0],[0,0,0],[0,0,0],[0,0,0]],"ver":1}
                    • tasmota/discovery/BCFF4DF7D75D/sensors
                      • {"sn":{"Time":"2022-11-13T19:53:23"},"ver":1}

                    Adding a DHT11 Sensor to D2 produced these:
                    • tasmota/discovery/BCFF4DF7D75D/config
                      • {"ip":"192.168.1.8","dn":"Tasmota Tester 1","fn":["Tasmota Tester 01",null,null,null,null,null,null,null],"hn":"tester01-5981","mac":"BCFF4DF7D75D","md":"Generic","ty":0,"if":0,"ofl n":"Offline","onln":"Online","state":["OFF","ON","TOGGLE","HOLD"],"sw":"12.2.0","t":"tester01","ft":"%prefix%/%topic%/","tp":["cmnd","stat","tele"],"rl":[2,0,0,0,0,0,0,0],"swc":[-1,-1,-1,-1,-1,-1,-1,-1],"swn":[null,null,null,null,null,null,null,null],"btn":[0,0,0,0,0,0,0,0],"so":{"4":0,"11":0,"13":0,"17":0,"20":0,"30":0,"68":0,"73": 0,"82":0,"114":0,"117":0},"lk":1,"lt_st":1,"sho":[0,0,0,0],"sht":[[0,0,0],[0,0,0],[0,0,0],[0,0,0]],"ver":1}
                    • tasmota/discovery/BCFF4DF7D75D/sensors
                      • {"sn":{"Time":"2022-11-13T19:58:06","DHT11":{"Temperature":null,"Humidity":null,"De wPoint":null},"TempUnit":"C"},"ver":1}
                    ​So the second message appears to be for sensors while the first is apparently
                    Karl S
                    HS4Pro on Windows 10
                    1070 Devices
                    56 Z-Wave Nodes
                    104 Events
                    HSTouch Clients: 3 Android, 1 iOS
                    Google Home: 3 Mini units, 1 Pair Audios, 2 Displays

                    Comment


                      #11
                      The /sensors is the same information that is received in a stat/ message. The value-added from a tasmota discovery message does not include formatting information. This could be hard-coded in the plugin based upon the JSON key name (e.g. DewPoint). The discovery rule for /sensors would be to auto associate the sensor if observed and it previously had a tasmota/discovery/+/sensors definition.

                      One of the most valuable pieces of information about discovery, in general, is how a device should be controlled. Tasmota/discovery does not have any of it. It appears that the assumption is the client recognizes this is a tasmota device therefore it needs to have knowledge contained within itself of rules for controlling a tasmota device. What commands (e.g. power, color, fanspeed) should be used in given situation. How does mcsMQTT know it is a fan or a light that needs to be configured. It may be able to be deduced based upon combinations of values for the tasmota/.../config message, but this is not really discovery disclosure, but a reverse-engineer of tasmota firmware. There may be some basic combinations recognized, but one should not need to reverse engineer the source to find them.​

                      Comment


                        #12
                        I pretty much have the Tasmota Discovery for the sensors working. I have not yet tried to do anything with the /config Discovery other than what is needed to support the sensors. I will probably do an implementation of something simple for lights/relay and then let it evolve as a need exists and information becomes available.

                        Comment


                          #13
                          Version 6.0.2.0 contains the Tasmota Discovery implementation. mcsMQTT Change Log (HS4 & HS3) - HomeSeer Message Board​.

                          The /config topic will provide info about Last Will and Testament, relay usage, lights and shutters. The /sensors topic will provide info about sensors.

                          When the Automatic Device Creation has been enabled on the MQTT Page, General Tab the disclosed devices will be created when the /STATE, /SENSOR, /RESULT topics provide the current status about the described devices.

                          I did testing with Tasmota 12.2.0 on an ESP32 that had been configured as a shutter, color light, simple relay, and switch input. I also used the info in post 10 for testing. In these cases, the following was visible in HS.

                          I looked through the Tasmota source to try to capture the most likely set of sensors for proper graphics and range setups.

                          Let me know if this helps or something should be altered.

                          Click image for larger version

Name:	0x.png
Views:	907
Size:	188.3 KB
ID:	1577578

                          Click image for larger version

Name:	1.png
Views:	866
Size:	70.9 KB
ID:	1577579

                          Comment


                            #14
                            Great! Thank you, Michael McSharry I may have a device to test in a week or so.
                            Karl S
                            HS4Pro on Windows 10
                            1070 Devices
                            56 Z-Wave Nodes
                            104 Events
                            HSTouch Clients: 3 Android, 1 iOS
                            Google Home: 3 Mini units, 1 Pair Audios, 2 Displays

                            Comment


                              #15
                              The current version of mcsMQTT which is pending release to Updater is at link referenced at https://forums.homeseer.com/forum/hs...ge-log-hs4-hs3 (Version 6.0.5.0). It has the Tasmota Discovery, additional work on Trane/Nexia thermostats and some pickups along the way. Any feedback on the Tasmota discovery would be appreciated. It is intended to handle sensors, relays and lights. If your environment includes these then some feedback would be appreciated before submitting to Updater.

                              The design concept is that Tasmota will deliver a discovery message that describes configuration information for integration. Tasmota SetOption19 should be 0 for this to happen. mcsMQTT retains this information and if the conditions described in discovery are recognized in a subsequent MQTT message then mcsMQTT will create a HS Device/Feature automatically if auto device creation is enabled on the MQTT Page, General Tab.

                              Comment

                              Working...
                              X