Luup programming syntax - Combining cut and paste examples

I have the following code that works fine separately (running one line or another), but having some problems being cut and pasted combining a filter (night) and action (http get).

return luup.is_night()

local status, result = luup.inet.wget("http://192.168.0.3:3480/data_request?id=lu_action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum=37", 5)

How can I still run this luup action (and other devices in the scene) and still filter it to only run at night?

Sorry for the basic Luup programming question.

It will not run the second line because you return in the first line.

Reverse the order of the lines.

Or try:

if luup.is_night() then local status, result = luup.inet.wget("http://192.168.0.3:3480/data_request?id=lu_action&serviceId=urn:micasaverde-com:serviceId:HomeAutomationGateway1&action=RunScene&SceneNum=37", 5) end

Thanks so much! :slight_smile: