Hi,
Thank you again for your feedback.
home-assistant.log first lines are:
2023-07-17 09:28:38.999 ERROR (SyncWorker_0) [homeassistant.components.command_line.utils] Command failed (with return code 1): sudo ssh [email protected] 'bash -s' < /home/ramin/temp_nextcloud.sh
2023-07-17 09:28:39.006 ERROR (SyncWorker_1) [homeassistant.components.command_line.utils] Command failed (with return code 1): sudo ssh [email protected] 'bash -s' < /home/ramin/temp_nextcloud.sh
2023-07-17 09:28:49.369 ERROR (SyncWorker_0) [homeassistant.components.command_line.utils] Command failed (with return code 1): sudo ssh [email protected] 'bash -s' < /home/ramin/temp_nextcloud.sh
Further more:
2023-07-17 09:28:59.369 ERROR (SyncWorker_6) [homeassistant.components.command_line.utils] Command failed (with return code 1): sudo ssh [email protected] 'bash -s' < /home/ramin/temp_nextcloud.sh
The ERROR doesn’t say me anything, but DuckDuckGo gave me among others this page:
It mentioned the right users rights and permissions for the executing script, as the script is executed as user and not as root.
I changed it to (chown) ramin:ramin and (chmod) 755.
ramin # ls -laF
total 16
drwxr-sr-x 2 ramin ramin 4096 Jul 16 23:42 ./
drwxr-xr-x 1 root root 4096 Jul 15 13:17 ../
-rw-r--r-- 1 root ramin 13 Jul 15 13:17 .profile
-rwxr-xr-x 1 ramin ramin 28 Jul 16 23:42 temp_nextcloud.sh*
ramin #
I am connected to CLI via Putty, I used the Terminal in HA (browser) itself and tested if I could run the command. I received the result, so the rights are probably set right.
It feels I am sooooo close thanks to your help, but
[Edit]
I changed the script to:
command_line:
- sensor:
name: nc_temp
command: "./home/ramin/temp_nextcloud.sh"
scan_interval: 5
This error was produced:
2023-07-17 11:56:31.373 ERROR (SyncWorker_7) [homeassistant.components.command_line.utils] Command failed (with return code 127): ./home/ramin/temp_nextcloud.sh
I also tried it without the dot (.) before /home/...
Seemingly, the script cannot be executed.
Changing the command to command: "echo 'Test'"
worked.