Use current state later in script

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

Moderator: leecollings

Post Reply
NLcom
Posts: 3
Joined: Saturday 29 October 2016 11:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Use current state later in script

Post by NLcom »

I'm looking for a way to dim my Hue lights when a certain user variable has value 1. After the value has gone back to value 0 I want to switch the lights back to their original state.

How can I do this with this framework?
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: Use current state later in script

Post by dannybloe »

You could create a persistent-storage variable that you set when you set the variable to 1. When the variable is 0 again you read that variable. Quite simple actually.

Let me know if you need more help.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
NLcom
Posts: 3
Joined: Saturday 29 October 2016 11:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Use current state later in script

Post by NLcom »

Thanks, Danny.

I was looking at that item in the wiki but don't quite understand how to put the current Hue state of a group of lights in a variable. The user variable that I want to check before dimming the lights is controlled in a different script.

So basically this would be my logic:
- Check user variable = 1
- Save current Hue svalue
- Dim lights
- Check user variable = 0
- Set Hue group to previous svalue
NLcom
Posts: 3
Joined: Saturday 29 October 2016 11:48
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Use current state later in script

Post by NLcom »

Can anyone give me some pointers?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest