made a dimmer in KnxWeb2 like dimmer in old version of KnxWeb
we have to use 3 button widget :
- light
- plus
- minus
in this case we use subpage for made a new advanced widget called "old_dimmer" and we can use it many times in the design
we add somes parameters to this sub-page
we have an on/off object and an other object for send the illuminance value off the light (type 5.xxx from 0 to 255)
off this object we can have command and feedback inormation in different object so 4 parameters
then we can use this parameter in the end of all "list of objects" in all widgets in the subpage
we had a button widget with light on and off picture the "feedback object" is a parameter of the subpage
the action when inactive is a "set-value" "on" to the command on/off subpage object
the action when active is a "set-value" "off" to the command on/off subpage object
we had a button widget with "plus" picture
the action when inactive is a "formula" to add "13" ( 5% of 255) to the status value object to send to command value, subpage objects
we had a button widget with "minus" picture
the action when inactive is a "formula" to add "-13" ( 5% of 255) to the status value object to send to command value, subpage objects
then save subpage and you can use it in design edit 1 or more times we only have to define the 4 parameter objects of the subpage for each widget add in the design view
finally the xml in design/subpages.xml :
<subpage name="old_dimmer" width="32" height="96" bgcolor="#999999">
<parameters>
<parameter id="cmd_on_off_object" label="command object" type="object"/>
<parameter id="cmd_dim_object" label="command dimmer obj" type="object"/>
<parameter id="status_on_off_object" label="status on off object" type="object"/>
<parameter id="status_dim_object" label="status dim object" type="object"/>
</parameters>
<controls>
<control type="button" picture="32x32_ampouleOff.png" picture-active="32x32_ampouleOn.png" text="" size="12" color="#000000" align="default" text-padding="0" feedback-object="_status_on_off_object" feedback-compare="eq" feedback-value="on" inactive-goto="" inactive-action="" active-goto="" active-action="" x="0" y="0" width="32" height="32" undefined="32">
<actionlist id="inactive-action">
<action type="set-value" id="_cmd_on_off_object" value="on"/>
</actionlist>
<actionlist id="active-action">
<action type="set-value" id="_cmd_on_off_object" value="off"/>
</actionlist>
</control>
<control type="button" picture="32x32_plus.png" picture-active="" text="" size="12" color="#000000" align="default" text-padding="0" feedback-object="" feedback-compare="eq" feedback-value="" inactive-goto="" inactive-action="" active-goto="" active-action="" x="0" y="32" width="32" height="32" undefined="32">
<actionlist id="inactive-action">
<action type="formula" id="_cmd_dim_object" x="_status_dim_object" a="1" b="0" c="13" m="1" n="0"/>
</actionlist>
<actionlist id="active-action"/>
</control>
<control type="button" picture="32x32_moins.png" picture-active="" text="" size="12" color="#000000" align="default" text-padding="0" feedback-object="" feedback-compare="eq" feedback-value="" inactive-goto="" inactive-action="" active-goto="" active-action="" x="0" y="64" width="32" height="32" undefined="64">
<actionlist id="inactive-action">
<action type="formula" id="_cmd_dim_object" x="_status_dim_object" a="1" b="0" c="-13" m="1" n="0"/>
</actionlist>
</control>
</controls>
</subpage>