Author Topic: Help with turning off dimmer when light hits 1%  (Read 2753 times)

Offline Greybeardvacationrental

  • Jr. Member
  • **
  • Posts: 82
  • Karma: +1/-0
Re: Help with turning off dimmer when light hits 1%
« Reply #30 on: June 03, 2018, 06:19:42 pm »

Yeah I'll just have to take some time to figure out how to write LUA code.  One of these days I'll work it in.

It really shouldn't be all that difficult. Right now, PLEG is detecting when the dimmer drops down below 5%. Your action is to turn the dimmer off at that point. You could change that as follows:

- Create a virtual on/off switch
- Have PLEG turn the virtual switch on when the dimmer drops below 5% (instead of turning the light off)
- Create a scene that detects when the virtual switch is turned on
- - Immediate action is to turn the virtual switch off AND the dimmed switch off
- - LUA code sets the variables we've already talked about

Done.

If someone partly dims the switch and then turns it off, it will come back on at the last level it was dimmed to.

I think I'm missing something here.  As far as I can tell this has the same end result.  If someone sets the dimmer down to 4% it won't matter if there is a virtual switch or if PLEG just does the turn off action itself.  The second that person sets the switch to 4% the "LastLoadLevel" gets set to 4%.  If they go to turn the light on by just tapping the up on the paddle it will go back to the LastLoadLevel which is still 4% and it would just go into the constant off loop.  What I need is a way to tell the switch to set the LastLoadLevel to xx% if it is dimmed to 4% or lower be it by virtual switch or by a simple PLEG.

Offline Greybeardvacationrental

  • Jr. Member
  • **
  • Posts: 82
  • Karma: +1/-0
Re: Help with turning off dimmer when light hits 1%
« Reply #31 on: June 04, 2018, 08:19:48 am »

Yeah I'll just have to take some time to figure out how to write LUA code.  One of these days I'll work it in.

It really shouldn't be all that difficult. Right now, PLEG is detecting when the dimmer drops down below 5%. Your action is to turn the dimmer off at that point. You could change that as follows:

- Create a virtual on/off switch
- Have PLEG turn the virtual switch on when the dimmer drops below 5% (instead of turning the light off)
- Create a scene that detects when the virtual switch is turned on
- - Immediate action is to turn the virtual switch off AND the dimmed switch off
- - LUA code sets the variables we've already talked about

Done.

If someone partly dims the switch and then turns it off, it will come back on at the last level it was dimmed to.

So I've tried this using ember1205 lua code suggestions to no avail.   The switch remains in a constant off loop if I dim it to 4% or less and then try to just turn it on.  Any suggestions on what the Lua code I should put into the scene should be to set the LoadLevelLastl to XX amount?

This:   luup.variable_set("urn:micasaverde-com:serviceId:ZWaveDevice1","LoadLevelLast","100","20")  didn't do it.
« Last Edit: June 04, 2018, 08:25:02 am by Greybeardvacationrental »

Offline ember1205

  • Sr. Member
  • ****
  • Posts: 418
  • Karma: +5/-21
Re: Help with turning off dimmer when light hits 1%
« Reply #32 on: June 04, 2018, 09:33:42 am »
You're going to need to determine what your exact variable name is. For example, I have a dimmer that uses urn:upnp-org:serviceId:Dimming1 as the name of the variable to be set as "LoadLevelLast".

Also, unless you're able to successfully set that variable, you won't have the complete "solution" and things will work as you're describing.

To determine your exact variable name, open up the device. Click on Advanced. From there, click the Variables tab. Scroll down to find "LoadLevelLast" and hover your mouse over it. The pop up box will show you the correct naming.

Offline Greybeardvacationrental

  • Jr. Member
  • **
  • Posts: 82
  • Karma: +1/-0
Re: Help with turning off dimmer when light hits 1%
« Reply #33 on: June 04, 2018, 09:38:06 am »
You're going to need to determine what your exact variable name is. For example, I have a dimmer that uses urn:upnp-org:serviceId:Dimming1 as the name of the variable to be set as "LoadLevelLast".

Also, unless you're able to successfully set that variable, you won't have the complete "solution" and things will work as you're describing.

To determine your exact variable name, open up the device. Click on Advanced. From there, click the Variables tab. Scroll down to find "LoadLevelLast" and hover your mouse over it. The pop up box will show you the correct naming.

Yes this is exactly the same name I get when I hover over it.  My device number is 20.  And The name of it is LoadLevelLast   I have no idea if these Jesco/GE dimmers allow it to be changed.  I've written the company... as you can imagine... still waiting.

If I put this in my LUA on my scene using he virtual switch as a trigger from PLEG and then try to run the scene.. it fails.

luup.variable_set("urn:upnp-org:serviceId:Dimming1","LoadLevelLast","100","20")
« Last Edit: June 04, 2018, 09:43:48 am by Greybeardvacationrental »

Offline ember1205

  • Sr. Member
  • ****
  • Posts: 418
  • Karma: +5/-21
Re: Help with turning off dimmer when light hits 1%
« Reply #34 on: June 04, 2018, 09:50:00 am »
Try:

Code: [Select]
luup.variable_set("urn:upnp-org:serviceId:Dimming1","LoadLevelLast","100",20)

Offline Greybeardvacationrental

  • Jr. Member
  • **
  • Posts: 82
  • Karma: +1/-0
Re: Help with turning off dimmer when light hits 1%
« Reply #35 on: June 04, 2018, 10:26:35 am »
Try:

Code: [Select]
luup.variable_set("urn:upnp-org:serviceId:Dimming1","LoadLevelLast","100",20)

THANK YOU!!!  What a couple little quotation marks can do.  Although now I have the daunting task of creating a couple dozen virtual switches and PLEG devices BUT it gets the job done!   Much appreciated ember1205.  You rule the day!

Offline ember1205

  • Sr. Member
  • ****
  • Posts: 418
  • Karma: +5/-21
Re: Help with turning off dimmer when light hits 1%
« Reply #36 on: June 04, 2018, 10:32:16 am »
Glad it worked. I didn't immediately notice it because I do it just a little differently.

In my LUA code, I first set a variable like this:

Code: [Select]
DeviceID = 20
Then I send the command like this:

Code: [Select]
luup.variable_set("urn:upnp-org:serviceId:Dimming1","LoadLevelLast","100",DeviceID)
So, my code doesn't end up with that number being quoted.

On another note... I also set global variables with my startup LUA. I will do things like this:

Code: [Select]
DiningRoomDimmerID = 5
LivingRoomDimmerID = 7
MasterBedroomDimmerID = 10
MasterBedroomFanID = 15

Since those variables are global, I can reference them anywhere and don't have to set them within the scenes. I can change the above command to something like:

Code: [Select]
luup.variable_set("urn:upnp-org:serviceId:Dimming1","LoadLevelLast","100",MasterBedroomDimmerID)
And not have to declare that variable within the scene first.

Offline Greybeardvacationrental

  • Jr. Member
  • **
  • Posts: 82
  • Karma: +1/-0
Re: Help with turning off dimmer when light hits 1%
« Reply #37 on: June 04, 2018, 10:42:29 am »
Very good.   I hope I don't run into issues with the number of devices.  I think the Vera 3 has a limit.  Or do virtual devices not count toward that?  Also, is there a way to update the controller after a PLEG change without having to reboot it?

Offline ember1205

  • Sr. Member
  • ****
  • Posts: 418
  • Karma: +5/-21
Re: Help with turning off dimmer when light hits 1%
« Reply #38 on: June 04, 2018, 10:52:50 am »
Everything has limits.  :)

My VeraLite has quite a few items in it and it's fine. I can't imagine the Vera 3 is more restrictive. Also, if you are adding LUA code directly to your PLEG items, you wouldn't need the virtual switches. You can act on the devices directly when you detect that you're at 4% dim or less.

Can't tell you much about PLEG because I've never used it. I always wrote my own code because it was much more flexible. And free.  ;)

Offline Greybeardvacationrental

  • Jr. Member
  • **
  • Posts: 82
  • Karma: +1/-0
Re: Help with turning off dimmer when light hits 1%
« Reply #39 on: June 04, 2018, 11:06:23 am »
Everything has limits.  :)

My VeraLite has quite a few items in it and it's fine. I can't imagine the Vera 3 is more restrictive. Also, if you are adding LUA code directly to your PLEG items, you wouldn't need the virtual switches. You can act on the devices directly when you detect that you're at 4% dim or less.

Can't tell you much about PLEG because I've never used it. I always wrote my own code because it was much more flexible. And free.  ;)

I did try to add the code into PLEG after I found it worked with the virtual switch but it did not fly.  Not sure why.  I'll probably play with it some more as I find the time but this will work for now and the summer rental season is upon me and I don't like to play around with the Vera while that is going on.  Cause you just never know and I'm not near it to fix it.  I don't do updates during that time... and actually after the last update I won't do them anymore until I update my controller.  Everytime I have to back up, then reset the controller back to factory, do the update and then restore.  I'm not there so this was always nerve racking.  I solved it by having a web enabled power strip, a camera and a mini computer all in the cabinet with my controller.   After I backed up, and then factory reset I'd loose all my inet configuration (wifi) so I'd turn on the mini pc which was then bridged with the vera and I could then configure the wifi settings again.  But I was just there before the season with the most recent update and even with me there it didn't go well.  Backup failed, called support, they were in the unit for quite some time but finally got it but the back up they used was old so lost everything i had done the prior 4 days and didn't want to take a chance so I just reconfigured the whole damn thing and then said no more of that.  So next year I'll upgrade to a new model so I can avoid that whole mess because of lack of space. 

Offline ember1205

  • Sr. Member
  • ****
  • Posts: 418
  • Karma: +5/-21
Re: Help with turning off dimmer when light hits 1%
« Reply #40 on: June 04, 2018, 11:28:35 am »


I did try to add the code into PLEG after I found it worked with the virtual switch but it did not fly.  Not sure why.  I'll probably play with it some more as I find the time but this will work for now and the summer rental season is upon me and I don't like to play around with the Vera while that is going on.  Cause you just never know and I'm not near it to fix it.  I don't do updates during that time... and actually after the last update I won't do them anymore until I update my controller.  Everytime I have to back up, then reset the controller back to factory, do the update and then restore.  I'm not there so this was always nerve racking.  I solved it by having a web enabled power strip, a camera and a mini computer all in the cabinet with my controller.   After I backed up, and then factory reset I'd loose all my inet configuration (wifi) so I'd turn on the mini pc which was then bridged with the vera and I could then configure the wifi settings again.  But I was just there before the season with the most recent update and even with me there it didn't go well.  Backup failed, called support, they were in the unit for quite some time but finally got it but the back up they used was old so lost everything i had done the prior 4 days and didn't want to take a chance so I just reconfigured the whole damn thing and then said no more of that.  So next year I'll upgrade to a new model so I can avoid that whole mess because of lack of space.

IMHO, the way VERA pushes the firmware upgrades, requiring a factory reset, is an AWFUL process. What's worse is that the pages they link you to on how to do it don't actually give you all of the steps that are required. I've done it remote on my controller once, and it was pretty nerve-wracking. I took a slightly different approach, though. I did a full backup of the controller and ensured I had the copy of everything downloaded. Then I stripped out devices by hand until most of it was gone and there was enough room for the upgrade. The upgrade was pushed through, and then I restored a backup to put everything (including the Z-Wave network) back.

It is an abomination of a process and really needs to be addressed by VERA.

Offline Greybeardvacationrental

  • Jr. Member
  • **
  • Posts: 82
  • Karma: +1/-0
Re: Help with turning off dimmer when light hits 1%
« Reply #41 on: June 04, 2018, 11:36:44 am »


I did try to add the code into PLEG after I found it worked with the virtual switch but it did not fly.  Not sure why.  I'll probably play with it some more as I find the time but this will work for now and the summer rental season is upon me and I don't like to play around with the Vera while that is going on.  Cause you just never know and I'm not near it to fix it.  I don't do updates during that time... and actually after the last update I won't do them anymore until I update my controller.  Everytime I have to back up, then reset the controller back to factory, do the update and then restore.  I'm not there so this was always nerve racking.  I solved it by having a web enabled power strip, a camera and a mini computer all in the cabinet with my controller.   After I backed up, and then factory reset I'd loose all my inet configuration (wifi) so I'd turn on the mini pc which was then bridged with the vera and I could then configure the wifi settings again.  But I was just there before the season with the most recent update and even with me there it didn't go well.  Backup failed, called support, they were in the unit for quite some time but finally got it but the back up they used was old so lost everything i had done the prior 4 days and didn't want to take a chance so I just reconfigured the whole damn thing and then said no more of that.  So next year I'll upgrade to a new model so I can avoid that whole mess because of lack of space.

IMHO, the way VERA pushes the firmware upgrades, requiring a factory reset, is an AWFUL process. What's worse is that the pages they link you to on how to do it don't actually give you all of the steps that are required. I've done it remote on my controller once, and it was pretty nerve-wracking. I took a slightly different approach, though. I did a full backup of the controller and ensured I had the copy of everything downloaded. Then I stripped out devices by hand until most of it was gone and there was enough room for the upgrade. The upgrade was pushed through, and then I restored a backup to put everything (including the Z-Wave network) back.

It is an abomination of a process and really needs to be addressed by VERA.

Yes this last time the support guy told me about the deletion of apps and devices but really.. is that any less nerve racking for me?  No.  MORE time consuming... Yes.  I think the way they are addressing it is... upgrade your old controller.  Which I get.  I mean phones, computers, anything that has constant evolution will eventually be outgrown by it's software counterparts.  However, they could have taken the time to automate the issue all the while giving a warning that this or that will cease to be supported on a given date so we have time to plan for it.  But it is what it is.  I'm good not updating.  I just need it to work along like the workhorse it's always been.  And thanks for the help.  It would have taken me days to figure out that it was just two quotation marks.  That's why I love the forum.  Smart people like you with experience.  Hopefully someday I'll be able to help someone too.  Hell just by reading this it will help someone.  Thanks again.

Offline kwieto

  • Hero Member
  • *****
  • Posts: 612
  • Karma: +27/-15
Re: Help with turning off dimmer when light hits 1%
« Reply #42 on: June 05, 2018, 04:07:21 am »
I think the way they are addressing it is... upgrade your old controller. 

The problem is that for example Plus has less storage space than Edge, (I'm not talking about RAM, but about the room where system files are stored) and as such "upgrading" may be in fact a "downgrade" in terms of stability and reliability.

Offline Greybeardvacationrental

  • Jr. Member
  • **
  • Posts: 82
  • Karma: +1/-0
Re: Help with turning off dimmer when light hits 1%
« Reply #43 on: June 05, 2018, 04:21:33 am »
I think the way they are addressing it is... upgrade your old controller. 

The problem is that for example Plus has less storage space than Edge, (I'm not talking about RAM, but about the room where system files are stored) and as such "upgrading" may be in fact a "downgrade" in terms of stability and reliability.

Plus has less storage space?  Other threads on here contradict that.  How much less space?  Do people with a new Plus or Edge have to reset to factory default before updating?  That's all I care about.  I'm over doing that it with my beloved Vera 3

Offline kwieto

  • Hero Member
  • *****
  • Posts: 612
  • Karma: +27/-15
Re: Help with turning off dimmer when light hits 1%
« Reply #44 on: June 05, 2018, 05:24:23 am »
The question is what memory we are talking about.
If you ssh to Vera and run "df -h" command, or run this command via AltUI OS.Command section, you'll see following results (look for "rootfs", "/dev/mtdblock7" and "overlayfs:/overlay" sections, as too much memory used here causes "no space left on device" error and problems with firmware upgrade or other issues):

For Vera PLUS rootfs, /dev/mtdblock7 and overlayfs:/overlay sections report size of 8,6MB, while for Vera Edge reported size is 9,4MB.
And this makes a difference of 800KB, which is about 10% of your total memory.

In practice, the same setup (restored from the same backup file) on Plus gives me memory filled in about 90%, while on Edge it is around 72%.
I don't know why the difference is bigger than it should be when you compare just amounts of total memory of both controllers. Probably Edge needs less system files (i.e. no Zigbee or Bluetooth files) and this gives some additional space.