Announcement

Collapse
No announcement yet.

Extracting device name and status from json udp packet

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

    Extracting device name and status from json udp packet

    I am trying to send JSON data as UDP packets to signal a device event. My json packet is
    {"device":{"name":"Main","status":"Open"}}.

    From this i want to signal a device called Main and set its status to open.
    I set the Device Name Expression to ${ JSON(input, "device.name") }.
    I set the Device Value Expression to ${ JSON(input, "device.status") }.
    When i send the packet i get the following error in the log.


    [UDP] [Big6 Plugin] [#PFL:UDPIn] An error happened on incomming message. ErrorMessage Value cannot be null. Parameter name: name on at HomeSeer.PluginSdk.Devices.FeatureFactory.WithName(String name) at HSPI_Big6.HSPI.UpdateOrAddDeviceFeatureValue(HsDevice hsDevice, Dictionary`2 featureNameValue) at HSPI_Big6.HSPI.HandleIncommingMessage(Big6Connection con, Big6Message msg, Big6Profile profile, Big6Type type)
    [NULL] [Big6 Plugin] HS devices loaded or reloaded.
    A plugin has requested a list of all of the devices in HomeSeer
    [NULL] [Big6 Plugin] Loading HS devices...
    [NULL] [Big6Connection] at Flee.PublicTypes.ExpressionContext.DoParse() at Flee.PublicTypes.ExpressionContext.Parse(String expression, IServiceProvider services) at Flee.InternalTypes.Expression`1.Compile(String expression, ExpressionOptions options) at Flee.InternalTypes.Expression`1..ctor(String expression, ExpressionContext context, Boolean isGeneric) at HSPI_Big6.Features.Big6Connection.EncodeStringForTransmissio n(String message, String input)
    [Big6Connection] SyntaxError: unexpected character '$', on line: 1 column: 1 unexpected character '}', on line: 1 column: 31
    [NULL] [Big6Connection] at Flee.PublicTypes.ExpressionContext.DoParse() at Flee.PublicTypes.ExpressionContext.Parse(String expression, IServiceProvider services) at Flee.InternalTypes.Expression`1.Compile(String expression, ExpressionOptions options) at Flee.InternalTypes.Expression`1..ctor(String expression, ExpressionContext context, Boolean isGeneric) at HSPI_Big6.Features.Big6Connection.EncodeStringForTransmissio n(String message, String input)
    [NULL] [Big6Connection] SyntaxError: unexpected character '$', on line: 1 column: 1 unexpected character '}', on line: 1 column: 32
    [UDP] [Big6 Plugin] [#PFL:UDPIn] [UdpConnection] [Raw message in]: {"device":{"name":"Main","status":"Open"}}

    What am i doing wrong ?
    What does locked do ?
    What is difference between root Device Name Expression and feature Device Name Expression. I assumed that root name will be appended to ​feature name. But it throws errors if i add any "Name" in the root Device Name Expression field.​

    #2
    I did check your expressions. They are correct. Good job !
    Big6 does receive the JSON as reflected in HS4 log, which is also good.

    I think the problem is that you need to remove the ${....} wrap from the expressions when you use them in any Big6 profiles. It is in bold in the documentation see below.

    Wrap expressions in this wrap ${…} to test in the sandbox and everywhere else throughout Big6 excluding the profiles. Do not use ${…} wrap in the profiles please.

    Comment


      #3
      Thanks, that works.
      How do i remove the profile name that's appended to the device name.
      Also it seem i cannot delete the temporary test devices i added.
      When i try to delete the device it gives me an error "Cannot delete last feature"
      Last edited by iQb; October 3, 2022, 10:45 PM. Reason: One more error

      Comment

      Working...
      X