<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://wiki.mios.com/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://wiki.mios.com/index.php?action=history&amp;feed=atom&amp;title=Luup_Example</id>
		<title>Luup Example - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.mios.com/index.php?action=history&amp;feed=atom&amp;title=Luup_Example"/>
		<link rel="alternate" type="text/html" href="http://wiki.mios.com/index.php?title=Luup_Example&amp;action=history"/>
		<updated>2026-06-03T08:01:47Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.19.8</generator>

	<entry>
		<id>http://wiki.mios.com/index.php?title=Luup_Example&amp;diff=7780&amp;oldid=prev</id>
		<title>George: Created page with &quot; == Luup Examples ==   Here is an example where the lua function luup.call_timer is used as a delay timer rather than using the GUI interface delay  -- Get time and set local ...&quot;</title>
		<link rel="alternate" type="text/html" href="http://wiki.mios.com/index.php?title=Luup_Example&amp;diff=7780&amp;oldid=prev"/>
				<updated>2013-12-13T19:08:50Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot; == Luup Examples ==   Here is an example where the lua function luup.call_timer is used as a delay timer rather than using the GUI interface delay  -- Get time and set local ...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
== Luup Examples ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here is an example where the lua function luup.call_timer is used as a delay timer rather than using the GUI interface delay&lt;br /&gt;
&lt;br /&gt;
-- Get time and set local variables.&lt;br /&gt;
local CurrentTime =  os.date(&amp;quot;*t&amp;quot;)&lt;br /&gt;
local BenchLamp = 5&lt;br /&gt;
local StandingLamp = 3&lt;br /&gt;
local EntertainmentSwitch = 6&lt;br /&gt;
&lt;br /&gt;
function AllOff()&lt;br /&gt;
 local BenchLamp = 5&lt;br /&gt;
 local StandingLamp = 3&lt;br /&gt;
 local EntertainmentSwitch = 6&lt;br /&gt;
&lt;br /&gt;
 luup.call_action(&amp;quot;urn:upnp-org:serviceId:SwitchPower1&amp;quot;, &amp;quot;SetTarget&amp;quot;, {newTargetValue = &amp;quot;0&amp;quot;}, EntertainmentSwitch )&lt;br /&gt;
 luup.call_action(&amp;quot;urn:upnp-org:serviceId:SwitchPower1&amp;quot;, &amp;quot;SetTarget&amp;quot;, {newTargetValue = &amp;quot;0&amp;quot;}, StandingLamp )&lt;br /&gt;
 luup.call_action(&amp;quot;urn:upnp-org:serviceId:SwitchPower1&amp;quot;, &amp;quot;SetTarget&amp;quot;, {newTargetValue = &amp;quot;0&amp;quot;}, BenchLamp )&lt;br /&gt;
&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-- If it's night time (after 5pm and before 5am) then delay for 10 minutes before turning all off.&lt;br /&gt;
if tonumber(CurrentTime.hour) &amp;gt;= 17 then&lt;br /&gt;
 -- evening&lt;br /&gt;
 luup.call_timer(&amp;quot;AllOff&amp;quot;, 1, &amp;quot;10m&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;)&lt;br /&gt;
 return true&lt;br /&gt;
elseif tonumber(CurrentTime.hour) &amp;lt;= 5 then&lt;br /&gt;
 -- early morning&lt;br /&gt;
 luup.call_timer(&amp;quot;AllOff&amp;quot;, 1, &amp;quot;10m&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;)&lt;br /&gt;
 return true&lt;br /&gt;
else&lt;br /&gt;
 -- day time&lt;br /&gt;
 -- turn everything off instantly&lt;br /&gt;
 AllOff() &lt;br /&gt;
&lt;br /&gt;
return false&lt;br /&gt;
end&lt;/div&gt;</summary>
		<author><name>George</name></author>	</entry>

	</feed>