I had to use a non-zero value to force a precision to be configured, because HA is converting the value to an integer. (Note I don’t have this device, sending the message is possible to any device that supports the Command Class, it just won’t respond to it.)
The service call with value 20.00
:
service: zwave_js.invoke_cc_api
data:
command_class: "49"
method_name: sendReport
parameters:
- 1
- 0
- 20.00
endpoint: "0"
target:
entity_id: sensor.4_in_1_sensor_air_temperature
In debug logs, we can see HA has already converted the value before it gets to the driver:
2022-09-11 10:19:59.345 DEBUG (MainThread) [zwave_js_server] Publishing message:
{'args': [1, 0, 20],
'command': 'endpoint.invoke_cc_api',
'commandClass': 49,
'endpoint': 0,
'messageId': 'b4d7b3b15637462ab366feb207847a90',
'methodName': 'sendReport',
'nodeId': 3}
In the driver, that results in:
2022-09-11T17:16:36.588Z SERIAL » 0x011100a901030531050101142500000000094c (19 bytes)
2022-09-11T17:16:36.589Z DRIVER » [Node 003] [REQ] [SendDataBridge]
│ source node id: 1
│ transmit options: 0x25 │ callback id: 9
└─[MultilevelSensorCCReport]
type: Air temperature
scale: Celsius
value: 20
You can see the integer value, 20
. You can also see the payload bytes:
3105010114
31 -> Command Class 49 (hex 31)
05 -> Command SENSOR_MULTILEVEL_REPORT
01 -> Sensor Type == 1 == Air Temperature
01 -> Precision = 0, Scale = 0, Size = 1 byte
14 -> Temp value 20 (hex 14)
So if the device requires precision 2, then this won’t work.
HA won’t covert 20.01
to a integer.
service: zwave_js.invoke_cc_api
data:
command_class: "49"
method_name: sendReport
parameters:
- 1
- 0
- 20.01
endpoint: "0"
target:
entity_id: sensor.4_in_1_sensor_air_temperature
2022-09-11 10:17:01.376 DEBUG (MainThread) [zwave_js_server] Publishing message:
{'args': [1, 0, 20.01],
'command': 'endpoint.invoke_cc_api', 'commandClass': 49,
'endpoint': 0, 'messageId': '37d3838495da4c17a130fe6df5fc782c',
'methodName': 'sendReport',
'nodeId': 3}
The decimal 20.01
is preserved.
Driver:
2022-09-11T17:17:07.826Z SERIAL » 0x011200a90103063105014207d125000000000ace (20 bytes)
2022-09-11T17:17:07.827Z DRIVER » [Node 003] [REQ] [SendDataBridge]
│ source node id: 1
│ transmit options: 0x25
│ callback id: 10
└─[MultilevelSensorCCReport]
type: Air temperature
scale: Celsius
value: 20.01
The payload is:
3105014207d1
31 -> Command Class 49 (hex 31)
05 -> Command SENSOR_MULTILEVEL_REPORT
01 -> Sensor Type == 1 == Air Temperature
42 -> 0b1000010 -> Precision = 2, Scale = 0, Size = 2 bytes
07d1 -> Temp value 20 (hex 14) 2001, which is 20.01 with precision 2
Looks like the driver also removes precision if it can. Driver code (using zwavejs2mqtt):
const node = driver.controller.nodes.get(3);
await node.commandClasses["Multilevel Sensor"].sendReport(1, 0, 20.00);
Results in the same payload as the HA service call, 3105010114
.