Get Current Setting of Dimmer When Switching On

Moderator: leecollings

Post Reply
tcbeaton
Posts: 1
Joined: Monday 25 April 2016 4:46
Target OS: Linux
Domoticz version:
Contact:

Get Current Setting of Dimmer When Switching On

Post by tcbeaton »

I have a dimmer type switch defined, which I'm using to send commands to an ESP-01 module to dim an LED strip, below is the code snippet in question.

The situation I have is that the code works fine when clicking on the dimmer slider to change the level and clicking on "off" to shut the light off; but when I click on "on" the LUA code is not getting the current level of the slider, instead seeing the value of zero.

Code: Select all

1: if (devicechanged['dev'] == 'Off') then
2:   print ('Off')
3: else
4:   print (otherdevices_svalues['dev'])
5: end
Here's the scenario:
1) I click on the slider at 62%, line 4 returns the the value 20.
2) I click the light bulb to turn the switch off, line 2 returns 'Off'.
3) I click the light bulb to turn the switch on, line 4 returns 0 (even thought the sliders remains at 62%).

Is there a way to get the current value of the slider at line 4 above, so the light will return to the previous value?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest