Disable Switch use certain times of day? Topic is solved
Moderator: leecollings
-
- Posts: 9
- Joined: Friday 13 January 2017 12:27
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Disable Switch use certain times of day?
I have a switch that wants to make unavailable from 12am till 8 am every day but I'm not sure how to set it up, I'm thinking it can't be that hard i just can't really figure the simplest way to get it to work any suggestions would be great
- waltervl
- Posts: 5149
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: Disable Switch use certain times of day?
I never heard of such a functionality.
But perhaps you can run a script that disables/enables it but I don't know if there is an API for switching a device enabled/disabled. A quick scan returned nothing in https://www.domoticz.com/wiki/Domoticz_API/JSON_URL%27s
But perhaps you can run a script that disables/enables it but I don't know if there is an API for switching a device enabled/disabled. A quick scan returned nothing in https://www.domoticz.com/wiki/Domoticz_API/JSON_URL%27s
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Disable Switch use certain times of day?
The API to enable / disable a device is
Code: Select all
http://<domoticz ip:domoticz port>/json.htm?type=command¶m=setdevused&idx=<device idx>&used=<true/false>&name=<device name>
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
-
- Posts: 9
- Joined: Friday 13 January 2017 12:27
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Disable Switch use certain times of day?
Thanks for taking the time to help me out not 100% sure how to use the API, my scripts for the most part i have been useing blocky and haven't really used Lua.
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Disable Switch use certain times of day?
From a blockly script you can use something like
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
-
- Posts: 9
- Joined: Friday 13 January 2017 12:27
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Disable Switch use certain times of day?
Thanks for getting back to me
still, no luck if you have time could you really dumb it down seems I feel a bit very lost what I'm thinking,
Have one Switch IDX 2651 that controls a light which I want to disable between 12 am-8 am
still, no luck if you have time could you really dumb it down seems I feel a bit very lost what I'm thinking,
Have one Switch IDX 2651 that controls a light which I want to disable between 12 am-8 am
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Disable Switch use certain times of day?
Please share what you actually tried using the openURL in a time based Blockly script.
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
-
- Posts: 33
- Joined: Wednesday 15 November 2017 19:40
- Target OS: Linux
- Domoticz version: 2020.2
- Location: Belgium
- Contact:
Re: Disable Switch use certain times of day?
Can you discribe the setup?
What type of switch do you use?
Zwave, zigbee, shelly?
What type of switch do you use?
Zwave, zigbee, shelly?
-
- Posts: 9
- Joined: Friday 13 January 2017 12:27
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Disable Switch use certain times of day?
Sure
So what I've succeeded with is at the moment when a mobile phone gets close to our home it turns on a switch via an app for geofencing and within that switch on Domoticz, its plays out a sound over our Sonos speaker and that mp3 audio is triggered as a notification all of this works without any problems.
what I would like to achieve now is that the audio is not played out between 00:00 - 08:00
I was thinking of moving the audio/notification to its own switch so the geofencing switch still works but the audio/notification would only be active between said times and link the geofencing mobile switch vi blocky to the separate switch for the audio/notification playout.
Its all hosted on a pi
with zwave, rfxcom 433mhz for most part temps, and sensors most lights via Hue
So what I've succeeded with is at the moment when a mobile phone gets close to our home it turns on a switch via an app for geofencing and within that switch on Domoticz, its plays out a sound over our Sonos speaker and that mp3 audio is triggered as a notification all of this works without any problems.
what I would like to achieve now is that the audio is not played out between 00:00 - 08:00
I was thinking of moving the audio/notification to its own switch so the geofencing switch still works but the audio/notification would only be active between said times and link the geofencing mobile switch vi blocky to the separate switch for the audio/notification playout.
Its all hosted on a pi
with zwave, rfxcom 433mhz for most part temps, and sensors most lights via Hue
-
- Posts: 9
- Joined: Friday 13 January 2017 12:27
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Disable Switch use certain times of day?
Seems I'm not even sure where to start I haven't been able to set a blocky script for this i was thinking something like this but never used json before
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Disable Switch use certain times of day?
Can you try this ?
You can import below xml in the event editor (use the +, Blockly, import button, paste below code and save as time triggered)
Code: Select all
<xml xmlns="http://www.w3.org/1999/xhtml"><block type="domoticzcontrols_ifelseif" id="yaJ1v4J{D{d5qvKaWL5M" x="13" y="14"><mutation elseif="1"></mutation><value name="IF0"><block type="logic_timeofday" id="P}IqP(8(ZGLRRSX*jXF$"><field name="OP">EQ</field><value name="Time"><block type="logic_timevalue" id="=k#353ET?9+gn~W=NnxE"><field name="TEXT">00:00</field></block></value></block></value><statement name="DO0"><block type="open_url" id="U=u((isL{0TE)ZVzZga="><value name="urlToOpen"><block type="url_text" id="w,mie_uNr!J*_Z.k_|K9"><field name="TEXT">192.168.1.14:8080/json.htm?type=command&param=setdevused&idx=2651&used=false</field></block></value></block></statement><value name="IF1"><block type="logic_timeofday" id="!=/s@}gG86^sJwoedFI:"><field name="OP">EQ</field><value name="Time"><block type="logic_timevalue" id="J@.|QA?wjQJ;CH0sDCYF"><field name="TEXT">08:00</field></block></value></block></value><statement name="DO1"><block type="open_url" id="T;d`?$~(~,|?EaEt{U`s"><value name="urlToOpen"><block type="url_text" id="l1avg@Tohkn$V#fzM%kQ"><field name="TEXT">192.168.1.14:8080/json.htm?type=command&param=setdevused&idx=2651&used=true</field></block></value></block></statement></block></xml>
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
-
- Posts: 9
- Joined: Friday 13 January 2017 12:27
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Disable Switch use certain times of day?
Ok yep imported it and have tried it by changing times just so I can test it, but seems if I goto switches and click the switch with that IDX it turns on as normal, anything I'm missing that you can think of?
once again thanks for taking your time to help me
once again thanks for taking your time to help me
waaren wrote: ↑Tuesday 09 March 2021 15:48Can you try this ?
Blockly 20210309 Disable device.png
You can import below xml in the event editor (use the +, Blockly, import button, paste below code and save as time triggered)
Code: Select all
<xml xmlns="http://www.w3.org/1999/xhtml"><block type="domoticzcontrols_ifelseif" id="yaJ1v4J{D{d5qvKaWL5M" x="13" y="14"><mutation elseif="1"></mutation><value name="IF0"><block type="logic_timeofday" id="P}IqP(8(ZGLRRSX*jXF$"><field name="OP">EQ</field><value name="Time"><block type="logic_timevalue" id="=k#353ET?9+gn~W=NnxE"><field name="TEXT">00:00</field></block></value></block></value><statement name="DO0"><block type="open_url" id="U=u((isL{0TE)ZVzZga="><value name="urlToOpen"><block type="url_text" id="w,mie_uNr!J*_Z.k_|K9"><field name="TEXT">192.168.1.14:8080/json.htm?type=command&param=setdevused&idx=2651&used=false</field></block></value></block></statement><value name="IF1"><block type="logic_timeofday" id="!=/s@}gG86^sJwoedFI:"><field name="OP">EQ</field><value name="Time"><block type="logic_timevalue" id="J@.|QA?wjQJ;CH0sDCYF"><field name="TEXT">08:00</field></block></value></block></value><statement name="DO1"><block type="open_url" id="T;d`?$~(~,|?EaEt{U`s"><value name="urlToOpen"><block type="url_text" id="l1avg@Tohkn$V#fzM%kQ"><field name="TEXT">192.168.1.14:8080/json.htm?type=command&param=setdevused&idx=2651&used=true</field></block></value></block></statement></block></xml>
- waltervl
- Posts: 5149
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: Disable Switch use certain times of day?
You perhaps will have to refresh the switches page to see the device disappear if disabled.
To test de link: If you copy past the url in a webbrowser it will also enable/disable the device, does it work?
To test de link: If you copy past the url in a webbrowser it will also enable/disable the device, does it work?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
-
- Posts: 9
- Joined: Friday 13 January 2017 12:27
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Disable Switch use certain times of day?
Ok tested to post from web browsers but it revies an error
status "ERR"
in the log it shows as "EventSystem: Fetching URL 192.168.1.14:8080/json.htm?type=command¶m=setdevused&idx=2651&used=false after 0.2 seconds..."
status "ERR"
in the log it shows as "EventSystem: Fetching URL 192.168.1.14:8080/json.htm?type=command¶m=setdevused&idx=2651&used=false after 0.2 seconds..."
- waltervl
- Posts: 5149
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: Disable Switch use certain times of day?
Are you sure the idx is 2651 because that seems a high number. See the idx column in menu setup - devices.
Did you try the other status too: true or false? Could perhaps giving an error if it was already that status.
Did you try the other status too: true or false? Could perhaps giving an error if it was already that status.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
-
- Posts: 9
- Joined: Friday 13 January 2017 12:27
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Disable Switch use certain times of day?
Checked the IDX its correct think over the years my DB over devices has picked up a lot of stuff that not used anymore, and also tried the status check both ways like you suggested but no different reports back status error.
- waltervl
- Posts: 5149
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: Disable Switch use certain times of day?
I tried it myself on a device and I get the same ERR status back.
@waaren, can you check? i am on:
Version: 2020.2 (build 12901)
Build Hash: b6dc22e8b-modified
Compile Date: 2021-02-01 17:52:08
dzVents Version: 3.1.4
@waaren, can you check? i am on:
Version: 2020.2 (build 12901)
Build Hash: b6dc22e8b-modified
Compile Date: 2021-02-01 17:52:08
dzVents Version: 3.1.4
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Disable Switch use certain times of day?
I checked on latest beta. It works ok This API was implemented in build 12921 (see the wiki page with all commit descriptions )
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: No registered users and 1 guest