how run some commands in domoticz startup?
Moderators: leecollings, remb0
-
- Posts: 112
- Joined: Tuesday 13 September 2016 9:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Contact:
how run some commands in domoticz startup?
hi guys
i use raspberrypi with v3.57
i want in startup (after power off/on or reset) some command run. for example after power off , when power is on , a light go to on(automatic) . every time is repeat. is this option in domoticz ? if yes how i do it? thank you
i use raspberrypi with v3.57
i want in startup (after power off/on or reset) some command run. for example after power off , when power is on , a light go to on(automatic) . every time is repeat. is this option in domoticz ? if yes how i do it? thank you
- sisaenkov
- Posts: 50
- Joined: Friday 27 May 2016 7:21
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.8
- Location: Moscow, Russia
- Contact:
Re: how run some commands in domoticz startup?
You can add next command in init script /etc/init.d/domoticz.sh to turn On the light:
Change IP address and idx parameter (idx=177 in my example) to yours one.
Insert here:
And also you need to add Raspberry Pi's IP address in Domoticz Settings -> Local networks field to call JSON without auth:

Code: Select all
/usr/bin/curl -s "http://172.16.1.31:8080/json.htm?type=command¶m=switchlight&idx=177&switchcmd=On"
Insert here:
Code: Select all
do_start()
{
# Turn the lights On
/usr/bin/curl -s "http://172.16.1.31:8080/json.htm?type=command¶m=switchlight&idx=177&switchcmd=On"
...

-
- Posts: 112
- Joined: Tuesday 13 September 2016 9:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Contact:
Re: how run some commands in domoticz startup?
hi thank you my friend but i am beginner . so can you explain more ? where is "/etc/init.d/domoticz.sh" ? how go to this ?sisaenkov wrote:You can add next command in init script /etc/init.d/domoticz.sh to turn On the light:Change IP address and idx parameter (idx=177 in my example) to yours one.Code: Select all
/usr/bin/curl -s "http://172.16.1.31:8080/json.htm?type=command¶m=switchlight&idx=177&switchcmd=On"
Insert here:And also you need to add Raspberry Pi's IP address in Domoticz Settings -> Local networks field to call JSON without auth:Code: Select all
do_start() { # Turn the lights On /usr/bin/curl -s "http://172.16.1.31:8080/json.htm?type=command¶m=switchlight&idx=177&switchcmd=On" ...
for example idx is 90 and ip address (raspberry) in my local network is 192.168.0.102. so what do am i do ? in setting....
thank you
- sisaenkov
- Posts: 50
- Joined: Friday 27 May 2016 7:21
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.8
- Location: Moscow, Russia
- Contact:
Re: how run some commands in domoticz startup?
1. Read this.
2. Next type command:
3. Insert next two lines after do_start() {:
4. Press Ctrl+O for save. And Ctrl+X for exit from editor.
5. Go to Settings in Domoticz and type 127.0.0*;192.168.0.102 in Local networks field.
2. Next type command:
Code: Select all
sudo nano /etc/init.d/domoticz.sh
Code: Select all
do_start()
{
# Turn the lights On
/usr/bin/curl -s "http://192.168.0.102:8080/json.htm?type=command¶m=switchlight&idx=90&switchcmd=On"
5. Go to Settings in Domoticz and type 127.0.0*;192.168.0.102 in Local networks field.
-
- Posts: 112
- Joined: Tuesday 13 September 2016 9:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Contact:
Re: how run some commands in domoticz startup?
thank you my dear friend ,and if i want use 2 light is on :sisaenkov wrote:1. Read this.
2. Next type command:3. Insert next two lines after do_start() {:Code: Select all
sudo nano /etc/init.d/domoticz.sh
4. Press Ctrl+O for save. And Ctrl+X for exit from editor.Code: Select all
do_start() { # Turn the lights On /usr/bin/curl -s "http://192.168.0.102:8080/json.htm?type=command¶m=switchlight&idx=90&switchcmd=On"
5. Go to Settings in Domoticz and type 127.0.0*;192.168.0.102 in Local networks field.
/usr/bin/curl -s "http://192.168.0.102:8080/json.htm?type ... itchcmd=On"
/usr/bin/curl -s "http://192.168.0.102:8080/json.htm?type ... itchcmd=On"
is this true ? this command is const "/usr/bin/curl -s" for all devices ?
- sisaenkov
- Posts: 50
- Joined: Friday 27 May 2016 7:21
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.8
- Location: Moscow, Russia
- Contact:
Re: how run some commands in domoticz startup?
Yes, right.
-
- Posts: 112
- Joined: Tuesday 13 September 2016 9:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Contact:
Re: how run some commands in domoticz startup?
thank you very muchsisaenkov wrote:Yes, right.
-
- Posts: 112
- Joined: Tuesday 13 September 2016 9:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Contact:
Re: how run some commands in domoticz startup?
my friend i want use this for a orange pi one with debian-jessie os. i test this but dont worksisaenkov wrote:Yes, right.

-
- Posts: 3
- Joined: Monday 31 August 2020 21:51
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Location: Germany
- Contact:
Re: how run some commands in domoticz startup?
Code: Select all
/usr/bin/curl -s "http://127.0.0.1:8080/json.htm?type=command¶m=switchlight&idx=1&switchcmd=Off"
Pasted in /etc/init.d/domoticz.sh in do_start() method, it does not.
Does anyone have a clue what I'm missing?
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: how run some commands in domoticz startup?
Are you sure domoticz is already started when the curl gets executed?Preetz wrote:Executing this line from shell works fine.Code: Select all
/usr/bin/curl -s "http://127.0.0.1:8080/json.htm?type=command¶m=switchlight&idx=1&switchcmd=Off"
Pasted in /etc/init.d/domoticz.sh in do_start() method, it does not.
Does anyone have a clue what I'm missing?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Who is online
Users browsing this forum: Bing [Bot] and 1 guest