ablyes
(Lyes)
December 5, 2024, 9:39am
1
Hi all,
i want to call a backend with a curl command (for my amcrest ad410 doorbell).
The following curl command works:
curl -u admin:XXXXXXX -X GET --digest 'http://192.168.1.XX/cgi-bin/configManager.cgi?action=setConfig&VSP_PaaS.Online=true'
in configuration.yaml
shell_command:
doorbell_online_light: >
curl -u !secret doorbell_username:!secret doorbell_password -X GET --digest 'http://!secret doorbell_ip/cgi-bin/configManager.cgi?action=setConfig&VSP_PaaS.Online=true'
Of course the secrets are correctly set.
How can I fix this ? Or help myself to fix this.
I think i’m missing somewhere quotes or double quotes or whatever.
I don’t blind right now
Thank you.
tom_l
December 5, 2024, 9:48am
2
You have to put the entire command in the secret.
ablyes
(Lyes)
December 5, 2024, 9:50am
3
Why ? It’s not clever to do such thing.
tom_l
December 5, 2024, 10:11am
4
Because that’s how secrets work. They substitute for the entire value. Take this generic key value pair:
key: value
You can only do this:
key: !secret my_secret_key
You can not do this:
key: something !secret my_secret_key something
ablyes
(Lyes)
December 5, 2024, 10:41am
5
You’re right !
I can do this i think
shell_command:
doorbell_online_light: >
curl -u {{ secrets['doorbell_username'] }}:{{ secrets['doorbell_password'] }} -X GET --digest 'http://{{ secrets['doorbell_ip'] }}/cgi-bin/configManager.cgi?action=setConfig&VSP_PaaS.Online=true'
tom_l
December 5, 2024, 10:44am
6
Nope. You can’t look up secrets that way.
ablyes
(Lyes)
December 5, 2024, 12:58pm
7
What about this ?
shell_command:
doorbell_online_command: !secret doorbell_online_light_command
and in secret file:
doorbell_online_light_command: >
curl -u admin:XXXX -X GET --digest 'http://192.168.1.XX//cgi-bin/configManager.cgi?action=setConfig&VSP_PaaS.Online=true'
1 Like
Sir_Goodenough
((SG) WhatAreWeFixing.Today)
December 6, 2024, 1:06am
8
What happened when you tested that?
ablyes
(Lyes)
December 9, 2024, 10:23am
9
I don’t know how to test this.
I need to wait like one month, until my doorbell is again in failure mode (blinking green), … and if it’s not bliking, that means my code is working.
Or may be i can add something into the automation to know right now, any suggestion ?
ablyes
(Lyes)
December 10, 2024, 8:59pm
11
Like I said, i don’t have any feedback on the doorbell because it’s already fixed.
And there is not return state from the script.
I hope it’s clearer now.