Note: The functionality described in this article is only available if you are using the develop branch of SmartHomeNG. It will be generally available with the release v1.6.

 

Starting with UZSU plugin version 1.5.2 and smartVISU 2.9 commit 5d15a36 (as of end of August 2018) there is a new feature included in the universal time scheduler plugin that let’s you setup interpolation between the given points in time. This is especially useful if you want to program circadian light curves for warm white and cold white light, but may also be useful for RGB LEDs.

Note: With an activated interpolation the plugin will constantly interpolate and send values in the given interval, even over midnight. If you just want to dim your light for example between 8pm (0%) and 9pm (100%), you need to set an additional value at 9.01pm (0%). Otherwise the light will just slowly decrease between 9pm today and 8pm tomorrow.

 

Below you find an example of how the widget by Stefan Widmer in smartVISU looks like:

UZSU Graph

UZSU Graph widget showing light curves

The upper red curve shows the graph of the warm white light throughout one day (24h). There are several points set by just clicking in the graph at the specific x,y coordinates. The blue points are „standard“ time settings at approximately midnight, 5am, 8am, 6pm, 9pm. The yellow point  is based on the sunrise, the orange one on the sunset. The handles next to those points let you change the „earliest“ and „latest“ values by dragging.

The lower blue curve shows the values for the cold white light. The points are set up almost at the same points in time as for the warm white light but with peaks in the morning and early evening. Both curves are set to cubic interpolation right now. But you can change interpolation to none or linear in the upper right corner. To deactivate all UZSU settings for an item, click the tickbox in the upper left corner. To deactivate some values separately click them and deactivate the „Akt/Act“ button (seen below). Inactive entries are shown in the graph as diamonds, inactive items are greyed out.

To change existing settings you can just drag the relevant points in the graph. By clicking on an existing point you can further change some details for timings based on the sun or make the setting valid for specific days of the week only. If you do so, the graph will update like seen below where in the weekend the light stays brighter during night:

UZSU Graph

UZSU Graph widget showing light curves for a whole week

Inserting the graph widget in your smartVISU is pretty straight forward:


{{ device.uzsugraph('graph', 'coldwhite.uzsu', 'cold white', 1, 'num', [0, 255, 5]) }}

Of course it’s also possible to use the uzsuicon widget to configure your timings in a less graphical way. Implement that as:


{{ device.uzsuicon('icon', 'coldwhite.uzsu', 'cold white', '', '', 'num') }}

Clicking on the icon will open a popup as seen below:

uzsu_popup

UZSU Graph widget popup for lights

The way this widget works is further described in the smartVISU documentation and in the blog entry about using the UZSU for blind control. In that blog entry the „Back in Time“ feature seen in the lower left is also explained in further detail. Furthermore you see how to setup your items for the UZSU plugin in that article.

To update an UZSU entry via logics you can use the following functions:


# query the next scheduled value and time
sh.coldwhite.uzsu.planned()

# query the interpolation settings
sh.coldwhite.uzsu.interpolation()

# query whether the uzsu is set active or not
sh.coldwhite.uzsu.activate()

# set the uzsu active or inactive
sh.coldwhite.uzsu.activate(True/False)

# set interpolation options
sh.coldwhite.uzsu.activate(type='linear/none/cubic', interval=5, backintime=0)

# clear your settings of the uzsu item. BE CAREFUL!
sh.coldwhite.uzsu.clear(True)

These functions can also be used for some simple logics like in this example:

You want to turn on a specific light (e.g. christmas decoration) at a specific time. When leaving the house you prefer to turn that light off. When returning home it should be turned on again (only) if the UZSU would not have turned it off in the meanwhile:

uzsustatus = sh.light.uzsu.planned()
if (uzsustatus['value'] == 0) and (sh.light.uzsu.activate() == True):
    sh.light(1)

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.