|  Developer
Updated on November 20, 2021

hub.item.value.percent.apply

Connection type:
Permissions:

  • This command sets current value between minimum and maximum in position specified by current level plus . Positive percent increases value level and negative decreases. Simplified formula: = +

Implementation: = round( + ( – ) * / 100 ) always will be in range: [, ].

				
					if( newValue > maxValue )
    newValue = maxValue;
else if( newValue < minValue )
    newValue = minValue;				
			
Edit
Field Type Required Description
_id string + Item object id
percent int + Value must belong to range from to
Edit
Field Type Required Description
newValue float + New value of an item.
scale string – Scale for temperature items, one of (celsius, fahrenheit)
valueType string – temperature for temperature items
Edit
Broadcast Description
hub.item.updated Informs about item changed
Edit
Code Message Data Reason
-32600 Bad request, id is empty
-32602 Value has invalid type
-32602 Currently only items with type are supported
-32602 Value is not in valid range
-32500 Unknown error Item associated with this id () has no minimal and maximal value fields
-32500 Unknown error Item not found by id:
-32500 Unknown error Value ‘‘ has invalid type. Type ‘‘ is not supported. Item id:
-32500 Unknown error Value ‘‘ is not in valid range. Valid range is: [, ]. Item id:
Edit
Edit
				
					{
    "method": "hub.item.value.percent.apply",
    "id": "<request_id>",
    "params": {
        "_id" : "5cf0dc8c7f000068d223e88a",
        "percent" : 40
    }
}				
			
Edit

Let’s assume we have dimmer with minimal value and maximal .
Current value is The is and new value will be .

				
					{
    "error": null,
    "id": "_ID_",
    "result": {
        "newValue" : 70
    }
}				
			

In case of we have a thermostat with minimal value and maximal .
Current value is The is and new value will be .

				
					{
    "error": null,
    "id": "_ID_",
    "result": {
        "newValue" : 34,
        "scale": "celsius",
        "valueType": "temperature"
    }
}