I’m trying to do a scene with a generic luup script.
Basicly, I want to toogle a urn:schemas-upnp-org:device:DimmableLight:1 off if it’s on and on if it’s off.
That’s not a big deal, the problem comes when I want to pass the deviceId via the url when I call the API.
The scene script :
local id = 5 → replace this static id with something like get_url_param(“deviceId”)
local old_status = luup.variable_get(“urn:upnp-org:serviceId:SwitchPower1”, “Status”, id)
local new_status = “0”
if old_status == “0” then
new_status = “1”
end
luup.call_action(“urn:upnp-org:serviceId:SwitchPower1”, “SetTarget”, {newTargetValue = new_status }, id)
Yes I already thought using the SetTarget on the Device but to switch the state I’ll need to do two request instead of one and put the logic on the client side.
Makes sense. Have you considered creating a scene on Vera that toggles that light, then initiating the scene (using HTTP run scene command) from your remote device?
Yes I did that too but the problem is, as RichardTSchaefer said, that you can’t send any parameter to the scene. So I would have to create a scene for each device I want to switch and unfortunately I can’t effort this.
Best Home Automation shopping experience. Shop at Ezlo!