Announcement

Collapse
No announcement yet.

Decimal values for Non-Plugin HS devices not published

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

    Decimal values for Non-Plugin HS devices not published

    I'm trying to get the value from a Z-Wave plugin device to be published to MQTT, but it seems that decimal values are not expected/permitted?
    I'm seeing this in the debug log:

    Code:
    4/23/2022 10:08:45 PM 126773 | HSEvent VALUE_CHANGE| 1024| C2212F1D-045-Q195| 946.59| 872.052| 477
    4/23/2022 10:08:45 PM 126776 | DoHsEvent MQTT Publish hs4/out/Servers-Watts=946.59|872.052 at Microsoft.VisualBasic.CompilerServices.IntegerType.FromStrin g (System.String Value) [0x00055] in <d1dad1a8bba2460091cc7ed2c3f04e36>:0
    at Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger (System.String Value) [0x00001] in <d1dad1a8bba2460091cc7ed2c3f04e36>:0
    at MCSMQTTHS4_2020.MqttAppModule.DoHsEvent () [0x003af] in <47f2d86f4a5249fe85102b83235e8e96>:0 Line 0 Conversion from string "946.59" to type 'Integer' is not valid.
    And nothing is published to MQTT?

    #2
    The only place I see in the source code where a conversion to integer is being performed is when the Payload Template has $$STATUS:. $$VSP: or $$CONTROL: as these use the mcsMQTT VSP definitions that are integer values.

    For a fractional value I think $$VALUE: is the Payload Template replacement item. What do you have setup for the Subscribe Topic that has a publish Topic of hs4/out/Servers-Watts as the Publish template?

    Regional settings often cause me difficulty because the external entity (i.e. MQTT Message) contains fractional values with period while the local convention is comma. This means sometimes mcsMQTT needs to convert and other times it does not.

    Comment


      #3
      Ah! The "MQTT Publish Payload Template" contained "{"value":$$VALUE:,"status":"$$STATUS:","ref":$$REF:}". Replaced that with just "{"value":$$VALUE:}" and now it's publishing as expected :-) Thanks!

      Comment

      Working...
      X