Question about BodyMalformedError on number type for temperatureMeasurement

I am trying to create a rule to check the temperature then send a http request.
Referring to the link @ Production Capabilities | SmartThings Developers

I was doing something like

{
	"name": "Example",
	"actions": [{
		"if": {
			"lessThanOrEquals": {
				"left": {
					"device": {
						"devices": [
							"device_id"
						],
						"component": "main",
						"capability": "temperatureMeasurement",
						"attribute": "temperature"
					}
				},
				"right": {
					"number": 62
				}
			},
			"then": [{
				"command": {
					"devices": [
						"device_id"
					],
					"commands": [{
						"component": "main",
						"capability": "partyvoice23922.webrequest",
						"command": "GET",
						"arguments": [{
							"string": "URL_endpoint"
						}]
					}]
				}
			}]
		}
	}]
}

However, I received error

"error": {
        "code": "ConstraintViolationError",
        "message": "The request is malformed.",
        "details": [
            {
                "code": "BodyMalformedError",
                "target": "number",
                "message": "Unknown field on line 18",
                "details": []
            }
        ]
    }

Isn’t number the type? I am confused.

The example JSON shows the attribute as “TemperatureValue” not just Temperature. In looking at my Ecobee thermostat, the attribute is “temperature.value”. Perhaps “number” is correct just not for the attribute you requested?

You’d think so, wouldn’t you? However your options are integer or decimal, presumably because of a need to tie in with JSON types.

1 Like

Change “number”: 62 to “decimal”: 62.0

1 Like

Thank you all!

I am not sure about it. I referred to this page Production Capabilities | SmartThings Developers

Hi, @msazone
Yes, the type in the attribute “temperature” of the capability temperatureMeasurement is “number”, however, you need to take reference from the Rules API documentation for the argument data type:

1 Like

Thank you so much! This is really helpful.

1 Like