I am trying to use curl to read a zigbee attribute from a device.
From within Home Assistant it works. I.e., this service request:
service: zha_toolkit.attr_read
data:
ieee: switch.tz3210_j4pdtz9v_ts0001_switch
endpoint: 1
cluster: 0
attribute: 3
Returns this response:
zha_toolkit_version: v1.1.8
zigpy_version: 0.60.4
zigpy_rf_version: 0.37.6
ieee_org: switch.tz3210_j4pdtz9v_ts0001_switch
ieee: a4:c1:38:09:a5:0d:19:c9
command: attr_read
command_data: null
start_time: "2024-02-17T01:39:31.705066+00:00"
errors: []
params:
endpoint_id: 1
cluster_id: 0
attr_id: 3
dir: 0
tries: 1
expect_reply: true
args: []
read_before_write: true
read_after_write: true
attr_type: "0x20"
write_is_equal: false
result_read:
- "3": 1
- {}
success: true
However when I try to do the same thing via the HA API, as follows:
curl -X POST -H "$BEARERAUTH" -H "Content-Type: application/json" --data '{"ieee": "switch.tz3210_j4pdtz9v_ts0001_switch", "endpoint": 1, "cluster": 0, "attribute": 3}' http://homeassistant:8123/api/services/zha_toolkit/attr_read
It prints only:
[]
I want to get a json response with the same data as the HA interactive service request.
What am I doing wrong?
Any advice is appreciated!