Announcement

Collapse
No announcement yet.

Howto get HSdevice value to mscMQTT

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

    Howto get HSdevice value to mscMQTT

    Michael, I am stuck with this problem, I hope you can help.

    The situation is that I have a number of ESP8266 nodeMCU's with different sensors connected to them. These are all communicating with the mcsMQTT plug-in so I can use the readings of the sensors within HS4.
    A small display is connected to another ESP8266 and some sensor readings (from the ESP8266 nodes) are displayed on it. This all works perfect.

    Now the problem:
    I also have some Z-Wave sensors in HS4 and I want some of them displayed as well on the ESP8266 display. The problem is now that I can't figure out how to set up the non-plugin-HS device that works. In the manual I find some hints but with no success. In the figure below you can see what I entered in the different fields.

    The RaspberryPi that runs HS4 is 'RPi4-HS3' (sic). The topic reads as Outside/Backyard/Outside temperature (Buiten/achtertuin/Buitentemperatuur).

    On the ESP8266 (with the display) I see no callback messages from this device in the Arduino serial monitor.

    Click image for larger version

Name:	2020-06-07_161927.png
Views:	591
Size:	22.1 KB
ID:	1391949

    I am also not sure if it is necessary to make a event in HS4 to publish the topic. If so, I am not sure how to add the value to the topic

    In the figure below you can see what I entered in the different fields.

    Click image for larger version

Name:	2020-06-07_170059.png
Views:	466
Size:	33.2 KB
ID:	1391950
    In this case I get a callback message: Message arrived [Buiten/achtertuin/Buitentemperatuur] $DV:170:
    But not the value of the sensor.

    Any help appreciated,
    ---
    Cor

    #2
    With the purple color of the Association table row it means that it is a non-plugin device that you want to be able to control from a MQTT message. The topic of this message is Buiten/achertuin/Buuitentemperatur. I doubt if this is what you want to do since controlling a temperature sensor does not make sense. You probably should remove the subscribe topic since you are not going to remotely control the temperature device.

    When the Zwave plugin stores a new temperature in device 170 DeviceValue it will generate a callback to mcsMQTT and mcsMQTT will publish the RPI4-HS3/... topic. The assumption is that the ESP8266 is subscribed to this topic. In your description I did not recognize the ESP8266 as expecting a topic RPi4-HS3/mcsMQTT/Buiten/achtertuin/Buitentemperatuur

    The default callback is DeviceValue change. If the Zwave plugin does something different then it could be that a Log or DeviceString callback needs to be used. This is setup from the Edit tab as shown below. Click on your 170 button from the Association tab to get to the Edit page for the topic.

    Click image for larger version  Name:	Capture.PNG Views:	0 Size:	32.4 KB ID:	1391986

    The payload template should be blank. As setup now the payload will contain the explicit text you have entered. It will not include the DeviceValue from device 170. To be explicit that your are interested in the DeviceValue then the substitution of $$VALUE: could be in the payload template, but I think the default (blank text box) is the DeviceValue.

    You should not need to go the Event route. It is possible, but for such a standard case it is easier to do it with Device.

    If you do want to use the event then the substitution variable is $$DVR170): rather than $DV:170

    I suggest looking at the properties of the Zwave device from DeviceManagement and see what is actually stored in DeviceValue. It could be that the Zwave plugin does not store something useful there and perhaps uses Status instead.

    Comment


      #3
      I just want to read the value of the temperature sensor and use it via MQTT. In the properties of the Zwave device the value has the right number of the temperature.
      If I go your way then there comes no callback to the ESP8266 from the temperature. The non-plugin-device is as shown below. The date is also peculiar.

      Click image for larger version

Name:	2020-06-07_215236.png
Views:	476
Size:	19.3 KB
ID:	1392017

      If I use the event method, I do not get a value. This is the callback that I get:

      Message arrived [RPi4-HS3/mcsMQTT/Buiten/achtertuin/Buitentemperatuur] $$DVR:170

      If I leave the colon out there is no change. Should it be something else?

      Comment


        #4
        This is the screen when clicking on 170:
        Click image for larger version

Name:	2020-06-07_215921.png
Views:	453
Size:	34.6 KB
ID:	1392020

        Comment


          #5
          The syntax for the action substitutions is in section 5.3 of the manual. It contains parenthesis around 170 and colons around the parenthesis.

          The debug file (enabled from the General tab) contains the event callbacks being provided by HS. The file created in in \data\mcsMQTT\mcsMQTT Debug.txt. A typical line in the file is below. In your case it will be device 170 rather than device 6285. Are you getting these as the DeviceValue changes? In the past I had more verbose debug as the plugin was processing the event but there may still be something following about what the plugin is doing with the callback data.
          Code:
          4/18/2020 3:22:07 PM    844811    | HSEvent VALUE_CHANGE| 1024| SENSOR| 79.7| 81.3| 6285

          Comment


            #6
            Solved the event option, the substitution variable should be $$DVR170):
            This works, the callback message is now:
            Message arrived [RPi4-HS3/mcsMQTT/Buiten/achtertuin/Buitentemperatuur] 16,9

            But I would like to go for the easier route....
            ---
            Cor

            Comment


              #7
              I just did a test using HS4 and it looks as if the callback is no longer working with it. I know it was in an earlier HS4 version. I will submit a bug report. This means your only option with HS3 plugin is the Event until HS4 gets fixed. I also did confirm that with the HS4 mcsMQTT plugin the event callback is working and the expected MQTT topic and payload are delivered. You are welcome to use the HS4 plugin. Let me know.

              Comment


                #8
                If I run the event then I get in de debug file:

                Code:
                7-6-2020 22:52:58       30627519        | HSEvent LOG| 2| 7-6-2020 22:52:58| mcsMQTT| Event Action Publishing RPi4-HS3/mcsMQTT/Buiten/achtertuin/Buitentemperatuur with Payload of 16,6 | | 0| Legacy-Plugin| 0| 7-6-2020 22:52:58

                Comment


                  #9
                  I cannot find a line you described with device 170

                  Comment


                    #10
                    I just did a test using HS4 and it looks as if the callback is no longer working with it. I know it was in an earlier HS4 version. I will submit a bug report. This means your only option with HS3 plugin is the Event until HS4 gets fixed. I also did confirm that with the HS4 mcsMQTT plugin the event callback is working and the expected MQTT topic and payload are delivered. You are welcome to use the HS4 plugin. Let me know.
                    I am using now version 5.2.4.14. Let me know where to find the HS4 version and I will try.

                    Comment


                      #11
                      Inability to find the debug info is expected with the HS4 bug.

                      The event output debug looks to be correct with a payload of 16,6. Is this what you want? It may be the case that your ESP8266 is expecting 16.6. You can do numeric expressions in the payload template. Look at Table 2 in the manual if you are interested in this option. I would need to add a string replace function if you are interested. You could also just round to integer with same functions. Inline functions are encased in << and >>.
                      Code:
                      <<Round($$VALUE:,0)>>
                      The HS4 plugin for mcsMQTT is at http://mcsSprinklers.com/HSPI_mcsMQTT_5_2_9_3.zip
                      There is a file called updater_override.json in the zip. Extract it to the HS4 folder. Also put the zip in this same folder. Go to Plugins menu item, Add and the only plugin you will see is mcsMQTT. Click on it. Remove updater_override.json from HS4 folder so normal updater operations will be restored.

                      Before doing the update, do a backup of the HS4 folder/subfolders so you can get back if something does not go right. The HS4 version of the plugin has been in development since the February timeframe. Only my eyes have seen it so some of my testing may have overlooked something. Feedback is appreciated.

                      Comment


                        #12
                        After reporting the issue, HST asked some additional information. I rebooted my computer to perform the test and the HS3 plugin what then receiving the device value change callbacks. Since I do not know what caused the lack of callbacks on my system I cannot advise. Use of HS4 plugin is still welcome.

                        Comment


                          #13
                          I could not install the plugin the way you described, there were error messages about failing to copy. So I did it the 'old' way and copied the files as stated in the install.txt file. Now the plugin is running, I can see the callbacks from the ESP8266 modules.

                          What I cannot see is the web page of DOC. In this case I get the error: "404 The page you are looking for does not exist!
                          I guess the DOC.html is missing.

                          Here are some warning messages from the log:

                          Code:
                          jun.-08 13:20:17         Warning    File does not exist: /usr/local/HS4/HomeSeer/html/mcsShelly/mcs.css
                          Code:
                          jun.-08 13:18:19         Warning    File does not exist: /usr/local/HS4/HomeSeer/html/MQTT
                          I also get a massive amount of error messages as given below. I am not sure where they come from (Device History PI?). This is new.

                          Code:
                          jun.-08 13:20:32 Error Error while getting feature 209 : A status graphic with that value set already exists
                          jun.-08 13:20:32 Error Error while getting feature 203 : A status graphic with that value set already exists
                          jun.-08 13:20:31 Error Error while getting feature 125 : A status graphic with that value set already exists
                          jun.-08 13:20:31 Error Error while getting feature 105 : A status graphic with that value set already exists
                          jun.-08 13:20:30 Error Error while getting feature 76 : A status graphic with that value set already exists
                          jun.-08 13:20:30 Error Error while getting feature 31 : A status graphic with that value set already exists
                          jun.-08 13:20:30 Error Error while getting feature 12 : An item with the same key has already been added. Key: [18,34, HomeSeer.PluginSdk.Devices.StatusGraphic]
                          In the associations tab I can see that the values of the measurements are updated. But in the HS devices these are not updated. Do I have to make new HS devices? That would make me unhappy for the consequences is would have on the build interface in HSTouch. A lot of device numbers would change!

                          So I went back to the HS3 plugin for now.
                          ---
                          Cor

                          Comment


                            #14
                            So now I am working - for the time - with the event option.
                            In the log there is everytime that a callback occurs a message:

                            Code:
                            jun.-08 16:29:36 mcsMQTT Event Action Publishing Buiten/afdak/RelatieveVochtigheid with Payload of 73
                            jun.-08 16:29:36 mcsMQTT Event Action Publishing Buiten/afdak/Temp_buiten with Payload of 17,2
                            Is there a possibility to suppress these messages?

                            The event output debug looks to be correct with a payload of 16,6. Is this what you want? It may be the case that your ESP8266 is expecting 16.6. You can do numeric expressions in the payload template. Look at Table 2 in the manual if you are interested in this option. I would need to add a string replace function if you are interested. You could also just round to integer with same functions. Inline functions are encased in << and >>.
                            Yes, I do need 16.6 in my ESP8266, now I only get the number without decimal. But with the event option there is no possibility to replace a string right?

                            Comment


                              #15
                              Click image for larger version  Name:	Capture.PNG Views:	0 Size:	77.6 KB ID:	1392137 You can use inline replacement. Below is a test with device 4156 where the zeros were replaced by twos. In your case it would be 170, comma and period.

                              Attached has the log message removed. Extract and replace file in the \bin\mcsMQTT folder.

                              Thank You for the HS4 feedback.

                              p.s. after I did a computer reboot the HS3 plugin was generative HSEvent callbacks on HS4. I had HST close the bug report. You may want to try that again if desired.

                              Comment

                              Working...
                              X