Have you enabled ssh on the destination Pi?
-
Check if pimatic is running with shell
-
Why not using the pimatic api?
-
Hi,
yes, ssh is enabeld. Over my PC i connect via SSH (Putty) to both pi´s.
I also have install sshpass on both pi´s.
i corrected the skript because the error was the other port that i use.
after the hostname it must be a -p (port).Now I have no error but the ShellSensor in Pimatic has only a empty entry all the time…
and i don´t know why!?!
-
@Heizelmann said in Check if pimatic is running with shell:
Why not using the pimatic api?
because i don´t know how!
I use the get command on my pis to push temperature values from one to the other pi.
I have try to get it to work with the REST API but with no success. Because in this case i have to call up if the programm is running or am i wrong? -
ok, i have work a little bit with the API and i think i have a half success.
whenn i execute the command:curl -X GET --user “user:password” http://xxx.xxx.xxx.xx:xx/api/variables/status-pimatic
i get the output:
{“variable”:{“name”:“status-pimatic”,“readonly”:false,“type”:“value”,“value”:“Online”,“unit”:""},“success”:true}
I created a variable in my pimatic with the value: Online and so far it works when i execute this at SSH (Putty).
But in what way can i bring it into my second pimatic in a variable or a VariableDevice???
Thank You
P.S. and sorry for my bad english
-
so here you also could use a shell sensor and cut the output of the json to true or success…
so your command for the pi1 has to look like this:
curl --silent http://user:password@host:port/api/variables/status-pimatic | cut -d":" -f8 | sed 's/.$//'
the result is when pi2 is online
true
when pi2 is offline
unknown
i think…not sure because i don’t have another pi to test -
Shortly I can not give any code, but I thought off periodically sending an API PATCH request from one PI to the other by rule ‘when every 5 seconds then …’ and check the change on the other pi also by rule ‘when variable-x was not updated for 10 seconds then …’ or so.
-
Thank you @Heizelmann but it works like chris said:
@chris said in Check if pimatic is running with shell:
so here you also could use a shell sensor and cut the output of the json to true or success…
so your command for the pi1 has to look like this:
curl --silent http://user:password@host:port/api/variables/status-pimatic | cut -d":" -f8 | sed 's/.$//'
the result is when pi2 is online
true
when pi2 is offline
unknown
i think…not sure because i don’t have another pi to testSummary:
I make a variable on each pi and create a shell-sensor with the command chris has written.
For the GUI I make a second variable like $pimatic-status-heizung and two rules like:
when Status of Pimatic-Heizung-Online? = “true” then set $status-pimatic-heizung = "Online"
and at least i create a VariablesDevice to read the variable.And now it works!
Thank You -
Nice @Masterplayer .
Yes sorry i was a littel busy last days…
Because of my semester examinations…But nice that it’s working now…
-
@Masterplayer @chris Shell scripts are uncomfortable for native users and mostly not understandable if you are not an UNIX developer. In my opinion there should be a built-in easy to use solution otherwise Pimatic is only from interest for developers.