Page 1 of 1

restart domoticz possible by esp32?

Posted: Friday 23 August 2024 21:49
by BartSr
Due to current problem that domoticz requires a restart few times each week I wonder if it's possible to sent kind of HTTP command from esp.
Is that doable. I am looking for command something like:
http:// domoticzIP, 'sudo service domoticz.sh restart'
or do I suggest something complete idiot?
Bart

Re: restart domoticz possible by esp32?

Posted: Friday 23 August 2024 22:26
by WouterO
You could easily make a crontab job, e.g., restarting Domoticz every day, including the command sudo systemctl restart domoticz.service

The underlying problem, though, in my opinion is something in your Domoticz setup. As far as I know there is no ‘current problem’ with Domoticz requiring a restart. At least, I am not experiencing anything wrong with the newest Domoticz version, 2024.7.

Re: restart domoticz possible by esp32?

Posted: Friday 23 August 2024 23:44
by BartSr
@Wouter0
A number of members als suffer from same problem. Also a github issue is there. Gizmocus has a look at it too.
I don't want a crontab solution for I want to restart once domoticz don't response.

Re: restart domoticz possible by esp32?

Posted: Saturday 24 August 2024 6:10
by Egregius
Use the developer tools of your browser...

Code: Select all

http://192.168.2.2:8080/json.htm?type=command&param=system_reboot
This is a script I run on the domoticz server itself:

Code: Select all

DOMOTICZ=`curl -s --connect-timeout 2 --max-time 5 "http://127.0.0.1:8080/json.htm?type=command&param=getdevices&rid=1"`
STATUS=`echo $DOMOTICZ | jq -r '.status'`
if [ $STATUS = "OK" ] ; then
	exit
else
	sleep 20
	DOMOTICZ=`curl -s --connect-timeout 2 --max-time 5 "http://127.0.0.1:8080/json.htm?type=command&param=getdevices&rid=1"`
	STATUS2=`echo $DOMOTICZ | jq -r '.status'`
	if [ $STATUS2 = "OK" ] ; then
		exit
	else
		sleep 20
		DOMOTICZ=`curl -s --connect-timeout 2 --max-time 5 "http://127.0.0.1:8080/json.htm?type=command&param=getdevices&rid=1"`
		STATUS3=`echo $DOMOTICZ | jq -r '.status'`
		if [ $STATUS3 = "OK" ] ; then
			exit
		else
			/usr/sbin/service domoticz stop
			/usr/sbin/service domoticz start
		fi
	fi
fi

Re: restart domoticz possible by esp32?

Posted: Saturday 24 August 2024 18:40
by WouterO
BartSr wrote: Friday 23 August 2024 23:44 @Wouter0
A number of members als suffer from same problem. Also a github issue is there. Gizmocus has a look at it too.
I don't want a crontab solution for I want to restart once domoticz don't response.
Yeah, I just saw the other messages. I agree that for your problem a crontab job is no solution. I hope the cause of your problem (some plug-in issue?) is soon found.

Re: restart domoticz possible by esp32?

Posted: Saturday 24 August 2024 21:58
by waltervl
As long as your crashing issue is not fixed use the monit application to monitor Domoticz and have it restarted when Domoticz becomes unresponsive. See wiki for more information https://www.domoticz.com/wiki/Monitoring_domoticz