Just some ideas for a shutter plugin. Any takers?
New UPnP Variables:
Device_Initialized: ´ yes/no
Current_Shutter_Position: 0…100 (%)
Time_to_Open_Shutter: 0… (s)
Time_to_Close_Shutter: 0… (s)
Device_ID: 2… (MCV’s device ID of the physical shutter device)
Device_Type: merten, duewi, …
Use_Manufacturer_Specific_Methods: yes/no
New UPnP service:
Set_Shutter_To_Position
Implementation (pseudo-code):
Set_Shutter_To_Position(pos)
begin
if pos < 0 then pos = 0 end
if pos > 100 then pos = 100 end
if pos = 0
then
Open(Device_ID)
Wait(Time_to_Open_Shutter + 5)
Current_Shutter_Position = 0
Device_Initialized = true
end
if pos = 100
then
Close(Device_ID)
Wait(Time_to_Close_Shutter + 5)
Current_Shutter_Position = 100
Device_Initialized = true
end
If NOT Device_Initialized
then
if is_dark
then
Set_Shutter_To_Position( 100 ) // recursive call, check scope of variables ...
else
Set_Shutter_To_Position( 0 )
end
if pos < Current_Shutter_Position
then
if NOT Use_Manufacturer_Specific_Methods
then
Up(Device_ID)
Wait((Current_Shutter_Position-pos)/100*Time_To_Open_Shutter)
Stop(Device_ID)
end
else
if Device_Type = merten
then
Save_Old_Z_Wave_Parameters(Device_ID)
repeat Set_Z_Wave_Parameters(Device_ID, pos, Time_To_Open_Shutter) until success
Open(Device_ID)
Wait((Current_Shutter_Position-pos)/100*Time_To_Open_Shutter + 5)
repeat Restore_Old_Z-Wave_Parameters(Device_ID) until success
end
elseif Device_Type = duewi
...
end
end
if pos > Current_Shutter_Position
then
if NOT Use_Manufacturer_Specific_Methods
then
Down(Device_ID)
Wait((pos-Current_Shutter_Position)/100*Time_To_Close_Shutter)
Stop(Device_ID)
end
else
if Device_Type = merten
then
Save_Old_Z_Wave_Parameters(Device_ID)
repeat Set_Z_Wave_Parameters(Device_ID, pos, Time_To_Close_Shutter) until success
Close(Device_ID)
Wait((pos-Current_Shutter_Position)/100*Time_To_Close_Shutter + 5)
repeat Restore_Old_Z-Wave_Parameters(Device_ID) until success
end
elseif Device_Type = duewi
...
end
end
end
Current_Shutter_Position = pos
end