How to set s state for a person from nodered

hello,
I’m looking for a way to set a person state from nodered
I try with a call service but no service can update a person state (try homeassistant.turn_off;turn_on;toggle without any success…)

is there a way to do that by an api call ?
many thanks for your helps

If you go ha services, you will not see any available for persons, you have to use the API node to set the state via http POST.

You fill in the path /api/states/person.${name} and set the payload you wish to set, then push it with inject node.

This is a basic example

[{"id":"da33c165.0a6b9","type":"ha-api","z":"201f98bc.c1edd8","name":"","server":"d5ce5cec.92bc8","protocol":"http","method":"post","path":"/api/states/sensor.washing_machine_power","data":"","dataType":"json","location":"payload","locationType":"msg","responseType":"json","x":1590,"y":180,"wires":[[]]},{"id":"ebed1d51.afe99","type":"inject","z":"201f98bc.c1edd8","name":"100","topic":"","payload":"{\"data\":{\"state\":\"100\",\"attributes\":{\"unit_of_measurement\":\"W\",\"friendly_name\":\"Washing Machine Power\",\"icon\":\"mdi:power\"}}}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":1420,"y":180,"wires":[["da33c165.0a6b9"]]},{"id":"d5ce5cec.92bc8","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true}]

Otherwise if the person is composed of device_trackers you can use the device_tracker.see service call

1 Like

Neat !
Many thanks, it works well for me !