dzVents Reboot Raspberry Pi

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
Piacco
Posts: 69
Joined: Friday 14 November 2014 9:33
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

dzVents Reboot Raspberry Pi

Post by Piacco »

Hi,

My raspberry has memory leakage, so I want to reboot my raspberry pi if the memory exceeds the 80%, is this possible with dzVents?

I tried this, but this is not working.

Code: Select all

 if memory.percentage > 80 then
    
     dz.openURL(
            {
                url = "http://192.168.1.15:8181/json.htm?type=command&param=system_reboot",
                method = 'POST',
               
            })
     
     end

Code: Select all

2023-06-11 14:30:00.241 Error: Error opening url: http://192.168.1.15:8181/json.htm?type=command&param=system_reboot
I know that i have to solve the memory leakage ;)
Number8
Posts: 374
Joined: Friday 23 May 2014 7:55
Target OS: Linux
Domoticz version: 2022.1
Location: Saint Pierre de Jards
Contact:

Re: dzVents Reboot Raspberry Pi

Post by Number8 »

Either you are not using the async http method and the code should be

Code: Select all

dz.openURL("http://192.168.1.15:8181/json.htm?type=command&param=system_reboot")
or is you want to use the async way then you should set a callback
See doc https://www.domoticz.com/wiki/DzVents:_ ... _scripting
If you go the async way, use GET in that case (no POST data is needed)
Are you sure you web server port is set on 8181?
Debian buster on NUC and three RPi with buster.
Piacco
Posts: 69
Joined: Friday 14 November 2014 9:33
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: dzVents Reboot Raspberry Pi

Post by Piacco »

Yes Domoticz Port is on 8181 :D
I get the same error with the dz.openURL command.

Code: Select all

 dz.openURL("http://192.168.1.15:8181/json.htm?type=command&param=system_reboot")
2023-06-11 20:37:00.447 Error: Error opening url: http://192.168.1.15:8181/json.htm?type= ... tem_reboot
willemd
Posts: 621
Joined: Saturday 21 September 2019 17:55
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.1
Location: The Netherlands
Contact:

Re: dzVents Reboot Raspberry Pi

Post by willemd »

A guess: Maybe user domoticz is not allowed to do the reboot? You need to be superuser?
User avatar
heggink
Posts: 972
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

Re: dzVents Reboot Raspberry Pi

Post by heggink »

Use monit. It's really good at monitoring domoticz in all aspects. There should be a wiki
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
Kedi
Posts: 536
Joined: Monday 20 March 2023 14:41
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Somewhere in NL
Contact:

Re: dzVents Reboot Raspberry Pi

Post by Kedi »

Perhaps use:

Code: Select all

 dz.openURL("http://127.0.0.1:8181/json.htm?type=command&param=system_reboot")
and make sure that 127.0.0.1 is set in "Thrusted Network" in Setup -> Settings -> Security
Logic will get you from A to B. Imagination will take you everywhere.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest