Announcement

Collapse
No announcement yet.

Possible Issue: Not recognizing string

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

  • #16
    Thanks Michael!

    Comment


    • #17
      Michael,
      Getting a little further into configuring devices to send MQTT and not sure what happened but the uptime string values are not showing HS device list. It appears the correct HS Device Control/Status UI is selected in the PI but the device is not displaying the string value.

      I also tried changing the uptime to be the number of seconds instead of a formatted string and it still not showing anything on the HS device list.
      Attached Files

      Comment


      • #18
        The debug may have something if you have it enabled. Also make certain you are using the version in the Updater so the source matches for investigation.

        Comment


        • #19
          Was running 3.2.19.0, upgraded to 3.2.19.1. Both were updater versions.

          Deleted the device (1093) and recreated it (1094). Attached the debugs.
          Attached Files

          Comment


          • #20
            The code sequence is below for the debug "Update Accepted 1094 to 13069". Seems pretty straightforward to me that either Value or String will be updated based upon the Status/Control UI setting of the plugin. Conditions are that 1094 exists and it belongs to mcsMQTT. If the Status/Control UI setting is at Button or List then the VSP will result in a 0 being stored because 13069 will be the first payload observed. In 3.2.19.4 I put more debug in the code below to better isolate the path it is taking.

            Code:
                        If gDebugLog Then
                            hsWritelog(PLUGIN_DEBUG, "Update Accepted " & iRef.ToString & " to " & sValue)
                        End If
                        If iRef > -1 Then
                            'if payload is numeric then set DeviceValue
                            'if not numeric then lookup status/graphic pairs and if found then set DeviceValue to the corresponding value (now just look for 0/1 OFF/ON)
                            'if not numeric and SET_DOES_NOT_CHANGE_LAST_CHANGE is not set then update DeviceValue and DeviceString, otherwise set only DeviceString
                            dv = hs.GetDeviceByRef(iRef)
                            If dv IsNot Nothing Then
                                bUpdateLastChange = Not dv.MISC_Check(hs, Enums.dvMISC.SET_DOES_NOT_CHANGE_LAST_CHANGE)
                                nHSValue = dv.devValue(hs)
                                If dv.Interface(hs) = PLUGIN_NAME Then
                                    If dv.AssociatedDevices_Count(hs) = 1 AndAlso dv.Relationship(hs) = Enums.eRelationship.Child Then
                                        Dim iList() As Integer = dv.AssociatedDevices(hs)
                                        iParentRef = iList(0)
                                    End If
                                    If iParentRef = 0 Then
                                        iParentRef = -1
                                    End If
                                    Dim iVGP As StatusTypes = oMQTT.StatusType
                                    If iVGP = StatusTypes.Number Then
                                        'If IsNumeric(sValue) Then
                                        bValueChange = nValue <> nHSValue
                                        hs.SetDeviceString(iRef, "", False)
                                        hs.SetDeviceValueByRef(iRef, nValue, True) 'bValueChange) ' trigger event if there was a change in value changed to true 4/2/2018
                                    ElseIf iVGP = StatusTypes.Text Then
                                        Dim sString As String = hs.DeviceString(iRef)
                                        bValueChange = sString <> sValueIn
                                        If bValueChange Then
                                            hs.SetDeviceString(iRef, sValueIn, False)
                                        End If
                                        If IsNumeric(sValueIn) Then
                                            hs.SetDeviceValueByRef(iRef, CType(sValueIn, Double), True) 'so devicevalue trigger can be used 
                                        Else
                                            hs.SetDeviceValueByRef(iRef, nHSValue, True) 'so devicevalue trigger can be used 
                                        End If
            
                                    Else 'button/list
                                        nValue = CType(oMQTT.VGPValue(sValueIn), Double)
                                        bValueChange = nValue <> nHSValue
                                        hs.SetDeviceString(iRef, "", False)
                                        hs.SetDeviceValueByRef(iRef, nValue, True)
                                    End If

            Comment


            • #21
              Possible Issue: Not recognizing string

              I didn’t run the code through Visual Studio, but I have a feeling the issue is related to the StatusTypes area. Have you tried using TypeOf instead to determine if the payload is a string or double?

              https://docs.microsoft.com/en-us/dot...ypeof-operator
              Last edited by mwolter; April 17th, 2018, 09:57 AM.

              Comment


              • #22
                I just noticed that the MISC Settings for a device that is showing properly and one that is not are different. 1084 is displaying properly and 1094 is not.

                FYI: No Graphics Display, NO_STATUS_DISPLAY appear to have been set by the PI as these are not checkboxes on the configuration tab of the HS device.

                Could this be the issue?
                Attached Files

                Comment


                • #23
                  Today was travel day for me. After playing with the various settings I determined that the one that is giving the most problem is NO_STATUS_DISPLAY. It looks like it needs to be cleared for most situations.

                  I was able to get the behavior as I believe it should be for all cases except the control of list via text box UI. I can either get the control to display or the status to display based upon NO_STATUS_DISPLAY setting, but cannot get both.

                  While I think everything else is fine, I did add all the MISC settings touched by the plugin as a user checkbox option on the Manual tab. This will make it easy for users to play around with situations that I have not encountered.

                  3.2.20.0 in updater.

                  Comment


                  • #24
                    Thanks, removing No Status Display solves the problem.

                    Comment


                    • #25
                      This should be happening automatically now when accepted on Association or when a specific UI radio used on Manual. You should not need to do this manually. Can you confirm for your situation? I want to make certain the defaults hit the mainstream.

                      Comment


                      • #26
                        I removed the accepted check and added it again to that particular device. No Status Display was not applied to the device and the value was visible on the main HS Device List page.

                        The changed appear to be working for a new device.

                        Comment

                        Working...
                        X