Auto-On, Auto-Off and Auto-OnOff
Moderator: leecollings
-
- Posts: 84
- Joined: Sunday 14 August 2016 13:45
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.1
- Location: Netherlands
- Contact:
Re: Auto-On, Auto-Off and Auto-OnOff
I found what caused the errors. One of the switches and one of the Temprature devices had some text in their description. This can not be when using Auto-off script
-
- Posts: 470
- Joined: Thursday 26 October 2017 13:37
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Delft
- Contact:
Re: Auto-On, Auto-Off and Auto-OnOff
Yes, this is intentional. It is an information message that these devices are ignored by auto-off because the description is not in a valid json format. If you lower your warning level, the message will no longer be shown. json is the only reasonable format that allows multiple scripts/hardwares to share the same description field, but many script writers don't consider the fact that other script writers might as well use that same description field. I did, so:
- I chose a format that could be used to share the description field with other scripts and
- I give an informational message to help the end user when his device isn't switched off because there is an invalid json text in the description field. The script still works though for all other devices.
-
- Posts: 86
- Joined: Wednesday 11 October 2017 8:50
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022.1ß
- Location: Friesland
- Contact:
Auto-scenes?
Hi rrozema,
I had an idea and tried to add this myself, but I can't
I wanted to add scenes/groups. Example:
Movement in kitchen is detected. it is a bit dark, but not the middle of he night, so assume 100% of all lights are needed:
- activate 100% kitchen scene for 15 minutes (all lights in the kitchen go to 100% and color is set to bright white)
- after 15 minutes no new motion activate kitchen scene 2: lights 75% and set them to warm white, but keep the light above the counter at 100% white.
- 5 minutes later active kitchen scene 3 - all to 50%
- 5 minutes later all off
If it IS middle of the night (switch nightmode is on) then
- activate scene midnightsnack - all light in kitchen to 10% for 10 minutes, then off
Is this an idea, or did i come up with a complicated solution for a simple problem?
Thx
S.
I had an idea and tried to add this myself, but I can't
I wanted to add scenes/groups. Example:
Movement in kitchen is detected. it is a bit dark, but not the middle of he night, so assume 100% of all lights are needed:
- activate 100% kitchen scene for 15 minutes (all lights in the kitchen go to 100% and color is set to bright white)
- after 15 minutes no new motion activate kitchen scene 2: lights 75% and set them to warm white, but keep the light above the counter at 100% white.
- 5 minutes later active kitchen scene 3 - all to 50%
- 5 minutes later all off
If it IS middle of the night (switch nightmode is on) then
- activate scene midnightsnack - all light in kitchen to 10% for 10 minutes, then off
Is this an idea, or did i come up with a complicated solution for a simple problem?
Thx
S.
--
Domoticz on rPi4 - RFXCOM RFXtrx433 USB - ZW090 Z-Stick Gen5 EU - IKEA Tradfri - Philips HUE - YouLess meter - SolarEdge
Domoticz on rPi4 - RFXCOM RFXtrx433 USB - ZW090 Z-Stick Gen5 EU - IKEA Tradfri - Philips HUE - YouLess meter - SolarEdge
-
- Posts: 470
- Joined: Thursday 26 October 2017 13:37
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Delft
- Contact:
Re: Auto-On, Auto-Off and Auto-OnOff
The idea behind auto-off is that it can determine a 'current level' the device is at, plus how long it is at this level: if the time it is at some level is longer than the time set for that level, it will set the device to the next level. In your suggested idea I don't see a way to determine the current level, nor how long it is at this level. So I don't think I can add your suggestion into these scripts. Sorry.
-
- Posts: 86
- Joined: Wednesday 11 October 2017 8:50
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022.1ß
- Location: Friesland
- Contact:
Re: Auto-On, Auto-Off and Auto-OnOff
No probleem, I totally understand. Plus, one should be careful with adding things to scripts. At one point it will become messy and too much.
I might experiment with a virtual dim level switch. Your script will set certain dim levels, and a new script (I still have to make, but it should be a piece of cake) could activate a certain scene when it detects the virtual switch has been set to a certain level.
Thanks for the reply
I might experiment with a virtual dim level switch. Your script will set certain dim levels, and a new script (I still have to make, but it should be a piece of cake) could activate a certain scene when it detects the virtual switch has been set to a certain level.
Thanks for the reply
--
Domoticz on rPi4 - RFXCOM RFXtrx433 USB - ZW090 Z-Stick Gen5 EU - IKEA Tradfri - Philips HUE - YouLess meter - SolarEdge
Domoticz on rPi4 - RFXCOM RFXtrx433 USB - ZW090 Z-Stick Gen5 EU - IKEA Tradfri - Philips HUE - YouLess meter - SolarEdge
-
- Posts: 470
- Joined: Thursday 26 October 2017 13:37
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Delft
- Contact:
Re: Auto-On, Auto-Off and Auto-OnOff
New feature added for Auto-On: Initial dimmer level. Auto-On can set the level of a dimmer device to a specific level whenever it activates a device.
The device and when to activate it is exactly like it was before; to make sure a device is always started at some specific level, include in the device's description field json text specifing the attribute "auto_on_level" followed by a level from 1 to 100 to set the dimmer to when the device is activated by auto-on. For example:this will set the dimmer to 50% whenever it gets activated by Auto-On.
The script is in github.
There's some extra code in the script as well. This is for an unfinished experiment: delayed activation of a device. That code is however not yet complete and may or may not work, so don't look at it yet
The device and when to activate it is exactly like it was before; to make sure a device is always started at some specific level, include in the device's description field json text specifing the attribute "auto_on_level" followed by a level from 1 to 100 to set the dimmer to when the device is activated by auto-on. For example:
Code: Select all
{
"auto_on_level": "50"
}
The script is in github.
There's some extra code in the script as well. This is for an unfinished experiment: delayed activation of a device. That code is however not yet complete and may or may not work, so don't look at it yet
-
- Posts: 86
- Joined: Wednesday 11 October 2017 8:50
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022.1ß
- Location: Friesland
- Contact:
Re: Auto-On, Auto-Off and Auto-OnOff
Sweet
Gonna play with it this weekend!
Gonna play with it this weekend!
--
Domoticz on rPi4 - RFXCOM RFXtrx433 USB - ZW090 Z-Stick Gen5 EU - IKEA Tradfri - Philips HUE - YouLess meter - SolarEdge
Domoticz on rPi4 - RFXCOM RFXtrx433 USB - ZW090 Z-Stick Gen5 EU - IKEA Tradfri - Philips HUE - YouLess meter - SolarEdge
-
- Posts: 86
- Joined: Wednesday 11 October 2017 8:50
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2022.1ß
- Location: Friesland
- Contact:
Re: Auto-On, Auto-Off and Auto-OnOff
This gave me an error. It worked without the quotes.rrozema wrote: ↑Friday 11 December 2020 17:27this will set the dimmer to 50% whenever it gets activated by Auto-On.Code: Select all
{ "auto_on_level": "50" }
Code: Select all
{
"auto_on_level": 50
}
--
Domoticz on rPi4 - RFXCOM RFXtrx433 USB - ZW090 Z-Stick Gen5 EU - IKEA Tradfri - Philips HUE - YouLess meter - SolarEdge
Domoticz on rPi4 - RFXCOM RFXtrx433 USB - ZW090 Z-Stick Gen5 EU - IKEA Tradfri - Philips HUE - YouLess meter - SolarEdge
-
- Posts: 470
- Joined: Thursday 26 October 2017 13:37
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Delft
- Contact:
Re: Auto-On, Auto-Off and Auto-OnOff
It was my intention that both should work, so I must have missed something. I'll have a look at it later. Thanks for reporting.Sarcas wrote: ↑Monday 21 December 2020 11:37This gave me an error. It worked without the quotes.rrozema wrote: ↑Friday 11 December 2020 17:27this will set the dimmer to 50% whenever it gets activated by Auto-On.Code: Select all
{ "auto_on_level": "50" }
Code: Select all
{ "auto_on_level": 50 }
Re: Auto-On, Auto-Off and Auto-OnOff
Found a solution for my previous mentioned problem when there is already something else in the description field.
I use that description field for dzga and I put the type of battery as text in that field for battery powered devices and some other stuff that might be handy to know for that device.
I changed on several places in
and put something like in the description.
The changes are the 2 piping '|' characters at the beginning and the end of the description text.
Currently under test, but no problem or error so far.
I noticed that the memory consumption of Domoticz raised with 10-20 Mb extra (varies a bit).
I use that description field for dzga and I put the type of battery as text in that field for battery powered devices and some other stuff that might be handy to know for that device.
I changed on several places
Code: Select all
local description = switch.description
Code: Select all
local description = string.match(switch.description,'%|(.*)%|')
Code: Select all
|{ "auto_off_minutes": 5,
"auto_off_motion_device": "PIR Keuken Sensor"
}|
Currently under test, but no problem or error so far.
I noticed that the memory consumption of Domoticz raised with 10-20 Mb extra (varies a bit).
-
- Posts: 470
- Joined: Thursday 26 October 2017 13:37
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Delft
- Contact:
Re: Auto-On, Auto-Off and Auto-OnOff
I like your idea! But do you need really those | - characters? Why not simply test for the { } characters and use what's in between and ignore anything that's not inside the { } characters?
I've created version 2.04 with your suggestion in it, but without adding the | characters. This way anything that is in the descriptions but not within curly braces is going to be ignored. Works great so far! Thanks EddyG!
I've created version 2.04 with your suggestion in it, but without adding the | characters. This way anything that is in the descriptions but not within curly braces is going to be ignored. Works great so far! Thanks EddyG!
Re: Auto-On, Auto-Off and Auto-OnOff
I already have on some places the [ and ] and { and } characters so this was my simple shortcut.
I might have to solve that problem in the future.
I might have to solve that problem in the future.
Re: Auto-On, Auto-Off and Auto-OnOff
I think you forgot the 'Auto-On' script.
-
- Posts: 470
- Joined: Thursday 26 October 2017 13:37
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Delft
- Contact:
Re: Auto-On, Auto-Off and Auto-OnOff
You are so absolutely right. I totally forgot that in Auto-On the description is retrieved too. Plus, when I looked at that code I saw some sloppy coding in there, so fixed that right away too. It's checked in now, so "Thank you" for the 2nd time!
Re: Auto-On, Auto-Off and Auto-OnOff
Hello!
I have problem with light level.
I have problem with light level.
{
"auto_on_level": "50",
"auto_off_minutes": 2,
"auto_off_motion_device": "PIR Aqara 06 predsoblje"
}
Status: dzVents: Info: Handling events for: "PIR Aqara 06 predsoblje", value: "On"
Status: dzVents: Info: ------ Start internal script: Auto-On: Device: "PIR Aqara 06 predsoblje (deCONZ)", Index: 207
Status: dzVents: Info: PIR Aqara 06 predsoblje: state true.
Status: dzVents: Info: Checking IKEA ZAR04.
Status: dzVents: Info: Checking IKEA ZAR05.
Status: dzVents: Info: Found auto_on_level of 100 for IKEA ZAR05.
Status: dzVents: Info: setLevel(100) : IKEA ZAR05.
Status: dzVents: Error (2.4.19): An error occured when calling event handler Auto-On
Status: dzVents: Error (2.4.19): ...i/domoticz/scripts/dzVents/generated_scripts/Auto-On.lua:217: attempt to call field 'setLevel' (a nil value)
Status: dzVents: Info: ------ Finished Auto-On
-
- Posts: 470
- Joined: Thursday 26 October 2017 13:37
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Delft
- Contact:
Re: Auto-On, Auto-Off and Auto-OnOff
Are you sure the device called IKEA ZAR05 is actually a dimmer device? Only dimmers have the setLevel method, for a normal switch setLevel is undefined, hence the error message.
When I find some time I will adapt the script to check for this situation and give a more clear message.
When I find some time I will adapt the script to check for this situation and give a more clear message.
Re: Auto-On, Auto-Off and Auto-OnOff
Yes it is dimmer device.
My workaroud is to put in device configuration
My workaroud is to put in device configuration
Who is online
Users browsing this forum: No registered users and 0 guests