Author Topic: Day Or Night Plugin  (Read 66466 times)

Offline RichardTSchaefer

  • Master Member
  • *******
  • Posts: 9601
  • Karma: +733/-136
    • RTS Services Plugins
Day Or Night Plugin
« on: December 07, 2012, 11:26:16 am »
I just released a simple plugin that use's MCV internal luup.is_night to toggle a virtual Switch to indicate day time or night time. Actually it has it's own Icons. (Sun and Moon). You can provide an offset from sunrise and sunset so that you can consider day as 19 minutes before sunrise and 21 minutes after sunset if you like.
This can be used to trigger scenes, or in Plugins like Program Logic Event Generator and Program Logic Timer Switch. Since this is a also a switch ... and you can change it ... you can force or test all of your automation logic in Day and Night modes.

Offline cubs2b23

  • Jr. Member
  • **
  • Posts: 96
  • Karma: +1/-0
Re: Day Or Night Plugin
« Reply #1 on: December 07, 2012, 02:00:47 pm »
Anything special need to be done to see the new icons?  Just looks like a blue button for me.

Offline RichardTSchaefer

  • Master Member
  • *******
  • Posts: 9601
  • Karma: +733/-136
    • RTS Services Plugins
Re: Day Or Night Plugin
« Reply #2 on: December 07, 2012, 03:05:03 pm »
Try reloading your browser window!


Offline cubs2b23

  • Jr. Member
  • **
  • Posts: 96
  • Karma: +1/-0
Re: Day Or Night Plugin
« Reply #3 on: December 07, 2012, 03:21:10 pm »
Nothing.  I even tried logging into Vera through a completely different browser (Firefox vs Chrome). No change.

Offline RichardTSchaefer

  • Master Member
  • *******
  • Posts: 9601
  • Karma: +733/-136
    • RTS Services Plugins
Re: Day Or Night Plugin
« Reply #4 on: December 07, 2012, 04:25:04 pm »
I will look into this ... I needed MCV help to release this simple plugin ... we had problems with the developer side of the App store. I will delete all my files and try a clean install.


Offline Crismaison

  • Sr. Member
  • ****
  • Posts: 443
  • Karma: +2/-0
Re: Day Or Night Plugin
« Reply #5 on: December 13, 2012, 06:46:11 am »
Hi, great plugin, how do I need to set the +/-? Is it eg +01::00:: ? Or with only single :?
Vera lite - Everspring smoke & flood detectors - Fibaro doorsensors - 2 Foscams - Greenwave 6 node smartplug - Several Switches -Netatmo - PLEG - Twilio - DropBoxuploader - FindmyIphone user

Offline RichardTSchaefer

  • Master Member
  • *******
  • Posts: 9601
  • Karma: +733/-136
    • RTS Services Plugins
Re: Day Or Night Plugin
« Reply #6 on: December 13, 2012, 07:26:37 am »
Single colon ... I need to fix the label!

Offline Crismaison

  • Sr. Member
  • ****
  • Posts: 443
  • Karma: +2/-0
Re: Day Or Night Plugin
« Reply #7 on: December 13, 2012, 08:14:34 am »
thx, how can I check if I have the Luup.isNight, since whatever I fill it, it keeps on saying it is "Day" in the device. How does it know the sunrise and sunset at my place?
Vera lite - Everspring smoke & flood detectors - Fibaro doorsensors - 2 Foscams - Greenwave 6 node smartplug - Several Switches -Netatmo - PLEG - Twilio - DropBoxuploader - FindmyIphone user

Offline RichardTSchaefer

  • Master Member
  • *******
  • Posts: 9601
  • Karma: +733/-136
    • RTS Services Plugins
Re: Day Or Night Plugin
« Reply #8 on: December 16, 2012, 01:39:36 am »
luup.is_night is an internal Vera function.

It does requires that you setup the location of your Vera to operate properly.
Setup tab and Location sub tab at the top of your Vera 3.
You need to set your timezone and city. Should work properly after that.



Offline Crismaison

  • Sr. Member
  • ****
  • Posts: 443
  • Karma: +2/-0
Re: Day Or Night Plugin
« Reply #9 on: December 16, 2012, 01:53:36 am »
Thx, works perfect now to switch on my garden light in a scene based on sunset or sunrise. Keep up the good work with the plugins!
Vera lite - Everspring smoke & flood detectors - Fibaro doorsensors - 2 Foscams - Greenwave 6 node smartplug - Several Switches -Netatmo - PLEG - Twilio - DropBoxuploader - FindmyIphone user

Offline apt

  • Jr. Member
  • **
  • Posts: 96
  • Karma: +0/-0
Re: Day Or Night Plugin
« Reply #10 on: January 11, 2013, 06:10:42 am »
Thanks for the plugin. At first I thought it to be superfluous because there is the luup.is_night function. But this combines very well with your PLEG plugin to make conditional schedules.

E.g. I made a setup that turns on the light at 6 in the morning but not if it is 10 min to sunrise. At sunrise the lights are switched of again. It looks stupid to switch on the light 1 min to sunrise and switch it of 1 min later. Or worse: switch in on at 6 after sunrise, and leave the lights on all day...

Now comes the question: could you maybe supply an example LUUP-code to read the status of a night or day device? Maybe you could also show the example on your help-site.

Thanks!


Offline RichardTSchaefer

  • Master Member
  • *******
  • Posts: 9601
  • Karma: +733/-136
    • RTS Services Plugins
Re: Day Or Night Plugin
« Reply #11 on: January 11, 2013, 10:13:51 am »
The main reason I did Day or Night is so that you do not need to do LUUP coding.

But if you must ... yo do this the same way you access any other device variable.
Find the Device on the UI
Goto the Advanced Tab.
Hover the mouse over the Variable (in this case: Status)
    This will show the Service Variable.
Get the Device ID from the Same tab.

in luup:

       local val = luup.get_variable_get("Service", "Variable", tonumber(Device))

Offline apt

  • Jr. Member
  • **
  • Posts: 96
  • Karma: +0/-0
Re: Day Or Night Plugin
« Reply #12 on: January 11, 2013, 10:52:03 am »
I have a scene that is run by a schedule. But I wanted to substitute the luup.is_night condition by checking the status of your plugin because of the possibility to add a 15 min delay. I know I can avoid using luup by using your PLEG plugin but then the schedule doesn't appear in the schedule list.

I was trying to use the device type (urn:schemas-rts-services-com:device:DayTime:1) instead of the Service Variable. It looked so similar...

Now it is running as intended, thanks!

Offline RichardTSchaefer

  • Master Member
  • *******
  • Posts: 9601
  • Karma: +733/-136
    • RTS Services Plugins
Re: Day Or Night Plugin
« Reply #13 on: January 11, 2013, 05:59:02 pm »
The Schedule Tab is where you create a schedule to be used by the PLEG device.
This does not show schedules for other scenes.

Offline Cor

  • Hero Member
  • *****
  • Posts: 1108
  • Karma: +4/-4
Re: Day Or Night Plugin
« Reply #14 on: February 21, 2013, 05:27:54 pm »
I just came across this plugin and installed it ..... interresting since you can add some minutes to sunrise or sunset :-)

But how do i use it , lets say I have a scene which I only want to run when I activate it and if it is during the night (20 min after sunset and 20 minutes before sunrise).

For the moment I have the LUUP code for night inserted in the LUUP option of a scene, so that has to be deleted , but how do I say to that scene , first look at that "day or night" switch to activate or not.

thanks,
Cor