Correct Syntax For Calling setCoolingSetpoint in Rules API

What is the right syntax for the argument parameter when using the capability “thermostatCoolingSetpoint” ?

I have tried the following:

{
      "name": "Set at 7:30PM",
      "actions" : [
         {
            "every" : {
               "specific": {
                  "reference": "Noon",
                  "offset": {
                     "value": { "integer": 450 },
                     "unit": "Minute"
                  }
               },
               "actions": [
                  {
                     "command": {
                        "devices": [ "device id" ],
                        "commands": [
                           {
                              "component":  "main",
                              "capability": "thermostatCoolingSetpoint",
                              "command":    "setCoolingSetpoint",
                              "arguments":  [ 70 ]
                           }
                        ]
                     }
                  }
               ]
            }
         }
      ]
   }

I get the following error:

{"requestId":"8E6B090A-AF9E-4693-8488-3BD135F68EE2","error":{"code":"ConstraintViolationError","message":"The request is malformed.","details":[{"code":"BodyMalformedError","target":"Unknown target","message":"Malformed body on line 23","details":[]}]}}

I also tried with

"arguments": [{"number": 70} ] 

and

"arguments": [{"setpoint": 70} ]

and

"arguments": [{"setpoint": {"number": 70}} ]

With similar errors.

Thank you for any help,
Jose

I would have plumped for that one, with my next move being trying double quotes around the 70.

Please, try “decimal” instead of “number”, @josep1972. I already reported we need the info of the allowed arguments in Rules where we need to specify the type.

It would be helpful if the documentation used example code with arguments in it. There must have been plenty to choose from.

2 Likes

@nayelyz
Please, try “decimal” instead of “number”, @josep1972. I already reported we need the info of the allowed arguments in Rules where we need to specify the type.

Yup, the that’s the winner:

"arguments":  [ {"decimal": 70} ]

I would have thought “decimal” would be covered with “number” but who knows… I didn’t even know “decimal” was an option.

I’m 100% percent convinced I would not have figured it out from any documentation. I am glad I searched and asked the Community.

Thank you,
Jose

3 Likes