Use current state later in script

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

Use current state later in script

Postby NLcom » Saturday 29 October 2016 12:04

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: 549
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi
Domoticz version:
Location: Ermelo
Contact:

Re: Use current state later in script

Postby dannybloe » Wednesday 02 November 2016 9:36

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 - RPiB+ZWay - Aeotec MultiSensor (6x) - Fibaro/Popp/GreenWave wall plugs - TKB Home dimmer - Aeotec Door sensor - Toon - 2x FGD-212, 8x FGD-211, 3x Qubino Flush dimmers - EvoHome Wifi+HGI80 - ESPEasy

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

Re: Use current state later in script

Postby NLcom » Wednesday 02 November 2016 10:06

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
Domoticz version:
Contact:

Re: Use current state later in script

Postby NLcom » Tuesday 15 November 2016 9:57

Can anyone give me some pointers?


Return to “dzVents Lua Framework”

Who is online

Users browsing this forum: No registered users and 2 guests