|  Developer
Updated on March 29, 2023

hub.item.value.set (single item)

Connection type:
Permissions:

  • Set single item value.
Edit
Field Type Required Description
_id string + Item object id
value depends on item type + New item value.
scale depends on item type New item value scale. If the scale field is present, the firmware will work with the obtained value in accordance with the specified scale. If the scale field is NOT present, the firmware will work with the obtained value in accordance with the scale from a hub configuration or an item.
source object Optional. Contains information about the operation source. See Item Value Source reference.
Edit
Edit
Broadcast Description
hub.item.updated Informs about item changed
Edit
Edit
request:
				
					{
    "method": "hub.item.value.set",
    "id": "<request_id>",
    "params": {
        "_id" : "5cf0dc8c7f000068d223e88a",
        "value" : true
    }
}				
			
request with scale:
				
					{
    "method": "hub.item.value.set",
    "id": "<request_id>",
    "params": {
        "_id" : "5cf0dc8c7f000068d223e88a",
        "value" : 36.6,
        "scale": "celsius"
    }
}				
			
Edit
				
					{
    "api": "1.0",
    "error": null,
    "id": "_ID_",
    "result": {}
}				
			
Edit
Situation Error code Description Error code
Item scale cannot be converted to target scale -32602 The specified scale cannot be used rpc.params.scale.invalid
Bus send message operation timeout -32602 Bus request timeout
Bus incorrect message size (more then 100K) -32602 Bus message is too long
Bus data transfer another error -32602 Bus internal error

Note: There are problems with the spread bus data transfer if input data amount > 100K. If the data amount for set.item.value operation >= 50К we will have in internal broadcasts hub.item.updated amount ~ 100K (because added valueFormatted parameter). The solution to fix this and similar issues with big data was added input bus data handling. If bus input data more than 100K then instead of bus data transfer will be returned – error. This handling is implemented for web-socket API Lua interface and external controller API.