User Editable State Variables

Since RP-6.0.1-ER3 it has been possible to create state variables in such a way, that the default value stored in them is editable from the device Inspector.

The state variable MUST be declared in the device profile, with the “user_editable” property set to “yes”

<state_variable_list>
	<state_variable name="PanValue" state_center_binding="PanValue" note="Degrees movement (integer) 1-180" min_value="1" max_value="180" user_editable="yes" owning_logical_component="Security Camera">5</state_variable>
	<state_variable name="TiltValue" state_center_binding="TiltValue" note="Degrees movement (integer) 1-180" min_value="1" max_value="180" user_editable="yes" owning_logical_component="Security Camera">5</state_variable>
	<state_variable name="ZoomValue" state_center_binding="ZoomValue" note="Floating point value 0.0 - 20.0" user_editable="yes" owning_logical_component="Security Camera">1</state_variable>
</state_variable_list>

In this example the associated device profile action is:

<action name="PanLeft">
	<action_argument name="PanValue" note="Not used - Adjust state var instead"/>
	<command_interface interface="ip">
		<command response_required="no">
			<command_string type="character">stw-cgi/ptzcontrol.cgi?msubmenu=relative&amp;action=control&amp;Pan=</command_string>
			<parameter_list>
				<parameter parameter_data_type="character" state_variable="PanValue"/>
			</parameter_list>
			<delay ms_delay="200"/>
		</command>
	</command_interface>
</action>

The “action_argument” parameter must be declared to satisfy rpmProfileLint. Also, writing the action in this manner prevents us from passing the value in as an argument. The value must instead be written to the state variable, or another, custom, action must be written to perform the same task, but use arguments instead of state variables.

I don't see a way of combining both into the same action, as I'd expect an empty argument to delete the default value from the stet variable upon execution. We'd then end up sending an incomplete command to the device (in this case a security camera).


Log In