I’m trying to make an automation to change the detection mask at sunrise and sunset.
But I was getting the error:
2023-07-18 07:42:27.043 ERROR (MainThread) [homeassistant.components.shell_command] Error running command: `./reolink/rl-e1 SetAlarmArea $(cat ./reolink/detectionzoneAI_dia)`, return code: 1
NoneType: None
So I raised the debug level:
2023-07-18 09:02:11.873 DEBUG (MainThread) [homeassistant.components.shell_command] Stderr of command: `./reolink/rl-e1 SetAlarmArea $(cat ./reolink/detectionzoneAI_dia)`, return code: 1:
b'SetAlarmArea ERROR: please login first (-6)\nLogout ERROR: please login first (-6)\n'
2023-07-18 09:02:11.874 ERROR (MainThread) [homeassistant.components.shell_command] Error running command: `./reolink/rl-e1 SetAlarmArea $(cat ./reolink/detectionzoneAI_dia)`, return code: 1
NoneType: None
2023-07-18 09:10:11.332 DEBUG (MainThread) [homeassistant.components.shell_command] Stdout of command: `./reolink/rl-e1 SetAlarmArea $(cat ./reolink/detectionzoneAI_dia)`, return code: 0:
b'{\n "rspCode": 200\n}\n'
Any way to change the command to get around this?
One way would be to send the command 2 or 3 times with an interval of about 40 seconds and hide the errors from the log, but if there is a cleaner way it would be better
reolink_save_detectionzoneai_dia: './reolink/rl-e1 GetAiAlarm "{\"channel\":0,\"ai_type\":\"people\"}" | jq "{channel:.[].channel,md:.[].scope,people:.[].scope,vehicle:.[].scope}" -c > ./reolink/detectionzoneAI_dia'
reolink_save_detectionzoneai_noite: './reolink/rl-e1 GetAiAlarm "{\"channel\":0,\"ai_type\":\"people\"}" | jq "{channel:.[].channel,md:.[].scope,people:.[].scope,vehicle:.[].scope}" -c > ./reolink/detectionzoneAI_noite'
reolink_set_mask_dia: './reolink/rl-e1 SetAlarmArea $(cat ./reolink/detectionzoneAI_dia)'
reolink_set_mask_noite: './reolink/rl-e1 SetAlarmArea $(cat ./reolink/detectionzoneAI_noite)'