Thanks Michael!
Announcement
Collapse
No announcement yet.
Possible Issue: Not recognizing string
Collapse
X
-
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.
Comment
-
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
-
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-operatorLast edited by mwolter; April 17, 2018, 09:57 AM.
Comment
-
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?
Comment
-
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
Comment