what is the output in this case?
No output
I thought it was normal…
This:
curl -X GET -H “Authorization: Bearer token” -H ‘Content-Type: application/json’ “http://192.168.2.101:8123/api/states” | jq --raw-output ‘.[] as $e | “($e.entity_id) ($e.attributes.friendly_name)”’ | while read -r entity_id friendly_name; do echo “${entity_id} ${friendly_name}” ; done
should output something like this:
entity-id Friendly name
I’m total noob you know but I cannot use this script. There’s some error maybe.
Here’s the output
sh: 9: Syntax error: word unexpected (expecting ")")
# sh: 9: Syntax error: ")" unexpected
It should all be on one line, do you have that?
Is it kinda hard te debug like this
I understand it’s hard. …so thanks again for your support
Here it is full:
# curl -X GET -H “Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.xxxxxxxxxxxxxxx” -H ‘Content-Type: application/json’ “http://192.168.2.101:8123/api/states” | jq --raw-output ‘.[] as $e | “($e.entity_id) ($e.attributes.friendly_name)”’ | while read -r entity_id friendly_name; do echo “${entity_id} ${friendly_name}” ; done
sh: 14: Syntax error: word unexpected (expecting ")")
# sh: 14: Syntax error: ")" unexpected
curl -X GET -H "Authorization: Bearer token" -H 'Content-Type: application/json' "http://192.168.2.101:8123/api/states" | jq --raw-output '.[] as $e | "\($e.entity_id) \($e.attributes.friendly_name)"' | while read -r entity_id friendly_name; do echo "${entity_id} ${friendly_name}" ; done
I formatted incorrectly, losing the \ - es before the (
Try the command above
This worked but gave me a lot of entities like also automation script device_tracker and so on
Yes, that is correct as well. Very strange that the script gave no output because that long list is exactly what you should get
Then I do not really know where to go next :\
Me neither. Maybe it’s something regarding my config. dunno.
I will stay “manual” and add things on the fly right now. I’m starting to add covers as well.
This is working ( I put here for all italians that maybe will have same need)
[ChangeCoverState]
cover_cmd = (alza | abbassa | imposta){covercommand}
<cover_cmd> [la] (tapparella| serranda) [in] [($custom/rooms){room}] [al] [a] [(0..100){percentage}] [percento]