mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-10 21:31:53 +01:00
3c8e3efa93
This addresses https://github.com/eclipse/smarthome/issues/5099 by adding a command description with command options along with the state description. Command options will give a hint to UIs about the specific commands a channel provides. Command options could be rendered as a drop down and also represent the current state or rendered as push buttons to simply send a command to the ThingHandler. The infrstructure basically copies the StateDescription infrastructure with CommandDescriptionProviders and an `DynamicCommandDescriptionProvider` interface for bindings to hook in and provide dynamic command options. Signed-off-by: Henning Treu <henning.treu@googlemail.com>
254 lines
12 KiB
XML
254 lines
12 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
|
xmlns:thing-description="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0"
|
|
xmlns:config-description="http://eclipse.org/smarthome/schemas/config-description/v1.0.0"
|
|
targetNamespace="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0">
|
|
|
|
<xs:import namespace="http://eclipse.org/smarthome/schemas/config-description/v1.0.0"
|
|
schemaLocation="http://eclipse.org/smarthome/schemas/config-description-1.0.0.xsd"/>
|
|
|
|
<xs:element name="thing-descriptions">
|
|
<xs:complexType>
|
|
<xs:choice minOccurs="1" maxOccurs="unbounded">
|
|
<xs:element name="thing-type" type="thing-description:thingType"/>
|
|
<xs:element name="bridge-type" type="thing-description:bridgeType"/>
|
|
<xs:element name="channel-type" type="thing-description:channelType"/>
|
|
<xs:element name="channel-group-type" type="thing-description:channelGroupType"/>
|
|
</xs:choice>
|
|
<xs:attribute name="bindingId" type="config-description:idRestrictionPattern" use="required"/>
|
|
</xs:complexType>
|
|
</xs:element>
|
|
|
|
<xs:complexType name="thingType">
|
|
<xs:sequence>
|
|
<xs:element name="supported-bridge-type-refs" type="thing-description:supportedBridgeTypeRefs" minOccurs="0"/>
|
|
<xs:element name="label" type="xs:string"/>
|
|
<xs:element name="description" type="xs:string" minOccurs="0"/>
|
|
<xs:element name="category" type="xs:string" minOccurs="0"/>
|
|
<xs:choice minOccurs="0">
|
|
<xs:element name="channels" type="thing-description:channels"/>
|
|
<xs:element name="channel-groups" type="thing-description:channelGroups"/>
|
|
</xs:choice>
|
|
<xs:element name="properties" type="thing-description:properties" minOccurs="0"/>
|
|
<xs:element name="representation-property" type="xs:string" minOccurs="0"/>
|
|
<xs:choice minOccurs="0">
|
|
<xs:element name="config-description" type="config-description:configDescription"/>
|
|
<xs:element name="config-description-ref" type="config-description:configDescriptionRef"/>
|
|
</xs:choice>
|
|
</xs:sequence>
|
|
<xs:attribute name="id" type="config-description:idRestrictionPattern" use="required"/>
|
|
<xs:attribute name="listed" type="xs:boolean" default="true" use="optional"/>
|
|
<xs:attribute name="extensible" type="thing-description:namespaceIdListRestrictionPattern" use="optional"/>
|
|
</xs:complexType>
|
|
|
|
<xs:simpleType name="namespaceIdListRestrictionPattern">
|
|
<xs:restriction base="xs:string">
|
|
<xs:pattern value="[A-Za-z0-9\-_.]+(,( )?[A-Za-z0-9\-_.]+)*" />
|
|
</xs:restriction>
|
|
</xs:simpleType>
|
|
|
|
<xs:complexType name="bridgeType">
|
|
<xs:complexContent>
|
|
<xs:extension base="thing-description:thingType"/>
|
|
</xs:complexContent>
|
|
</xs:complexType>
|
|
|
|
<xs:simpleType name="auto-update-policy">
|
|
<xs:restriction base="xs:string">
|
|
<xs:enumeration value="veto" />
|
|
<xs:enumeration value="default" />
|
|
<xs:enumeration value="recommend" />
|
|
</xs:restriction>
|
|
</xs:simpleType>
|
|
|
|
<xs:complexType name="channelType">
|
|
<xs:sequence>
|
|
<xs:element name="item-type" type="xs:string" minOccurs="0"/>
|
|
<xs:element name="kind" type="xs:string" minOccurs="0"/>
|
|
<xs:element name="label" type="xs:string"/>
|
|
<xs:element name="description" type="xs:string" minOccurs="0"/>
|
|
<xs:element name="category" type="xs:string" minOccurs="0"/>
|
|
<xs:element name="tags" type="thing-description:tags" minOccurs="0"/>
|
|
<xs:element name="state" type="thing-description:state" minOccurs="0"/>
|
|
<xs:element name="command" type="thing-description:command" minOccurs="0"/>
|
|
<xs:element name="event" type="thing-description:event" minOccurs="0"/>
|
|
<xs:element name="autoUpdatePolicy" type="thing-description:auto-update-policy" minOccurs="0"/>
|
|
<xs:choice minOccurs="0">
|
|
<xs:element name="config-description" type="config-description:configDescription"/>
|
|
<xs:element name="config-description-ref" type="config-description:configDescriptionRef"/>
|
|
</xs:choice>
|
|
</xs:sequence>
|
|
<xs:attribute name="id" type="config-description:idRestrictionPattern" use="required"/>
|
|
<xs:attribute name="advanced" type="xs:boolean" default="false" use="optional"/>
|
|
<xs:attribute name="system" type="xs:boolean" default="false" use="optional"/>
|
|
</xs:complexType>
|
|
|
|
<xs:complexType name="channelGroupType">
|
|
<xs:sequence>
|
|
<xs:element name="label" type="xs:string"/>
|
|
<xs:element name="description" type="xs:string" minOccurs="0"/>
|
|
<xs:element name="category" type="xs:string" minOccurs="0"/>
|
|
<xs:element name="channels" type="thing-description:channels" minOccurs="1"/>
|
|
</xs:sequence>
|
|
<xs:attribute name="id" type="config-description:idRestrictionPattern" use="required"/>
|
|
<xs:attribute name="advanced" type="xs:boolean" default="false" use="optional"/>
|
|
</xs:complexType>
|
|
|
|
<xs:complexType name="supportedBridgeTypeRefs">
|
|
<xs:sequence>
|
|
<xs:element name="bridge-type-ref" type="thing-description:bridgeTypeRef" minOccurs="1" maxOccurs="unbounded"/>
|
|
</xs:sequence>
|
|
</xs:complexType>
|
|
|
|
<xs:complexType name="bridgeTypeRef">
|
|
<xs:attribute name="id" type="config-description:idRestrictionPattern" use="required"/>
|
|
</xs:complexType>
|
|
|
|
<xs:complexType name="channels">
|
|
<xs:sequence>
|
|
<xs:element name="channel" type="thing-description:channel" minOccurs="1" maxOccurs="unbounded"/>
|
|
</xs:sequence>
|
|
</xs:complexType>
|
|
|
|
<xs:simpleType name="namespaceIdRestrictionPattern">
|
|
<xs:restriction base="xs:string">
|
|
<xs:pattern value="[A-Za-z0-9\-_.]+" />
|
|
</xs:restriction>
|
|
</xs:simpleType>
|
|
|
|
<xs:complexType name="channel">
|
|
<xs:sequence>
|
|
<xs:element name="label" type="xs:string" minOccurs="0"/>
|
|
<xs:element name="description" type="xs:string" minOccurs="0"/>
|
|
<xs:element name="properties" type="thing-description:properties" minOccurs="0"/>
|
|
<xs:element name="autoUpdatePolicy" type="thing-description:auto-update-policy" minOccurs="0"/>
|
|
</xs:sequence>
|
|
<xs:attribute name="id" type="config-description:idRestrictionPattern" use="required"/>
|
|
<xs:attribute name="typeId" type="thing-description:namespaceIdRestrictionPattern" use="required"/>
|
|
</xs:complexType>
|
|
|
|
<xs:complexType name="channelGroups">
|
|
<xs:sequence>
|
|
<xs:element name="channel-group" type="thing-description:channelGroup" minOccurs="1" maxOccurs="unbounded"/>
|
|
</xs:sequence>
|
|
</xs:complexType>
|
|
|
|
<xs:complexType name="channelGroup">
|
|
<xs:sequence>
|
|
<xs:element name="label" type="xs:string" minOccurs="0"/>
|
|
<xs:element name="description" type="xs:string" minOccurs="0"/>
|
|
</xs:sequence>
|
|
<xs:attribute name="id" type="config-description:idRestrictionPattern" use="required"/>
|
|
<xs:attribute name="typeId" type="config-description:idRestrictionPattern" use="required"/>
|
|
</xs:complexType>
|
|
|
|
<xs:complexType name="tags">
|
|
<xs:sequence>
|
|
<xs:element name="tag" type="xs:string" minOccurs="1" maxOccurs="unbounded"/>
|
|
</xs:sequence>
|
|
</xs:complexType>
|
|
|
|
<xs:complexType name="state">
|
|
<xs:sequence>
|
|
<xs:element name="options" type="thing-description:options" minOccurs="0"/>
|
|
</xs:sequence>
|
|
<xs:attribute name="min" type="xs:decimal" use="optional"/>
|
|
<xs:attribute name="max" type="xs:decimal" use="optional"/>
|
|
<xs:attribute name="step" type="xs:decimal" use="optional"/>
|
|
<xs:attribute name="pattern" type="xs:string" use="optional"/>
|
|
<xs:attribute name="readOnly" type="xs:boolean" default="false" use="optional"/>
|
|
</xs:complexType>
|
|
|
|
<xs:complexType name="event">
|
|
<xs:sequence>
|
|
<xs:element name="options" type="thing-description:options" minOccurs="0"/>
|
|
</xs:sequence>
|
|
</xs:complexType>
|
|
|
|
<xs:complexType name="options">
|
|
<xs:sequence>
|
|
<xs:element name="option" type="thing-description:option" minOccurs="1" maxOccurs="unbounded"/>
|
|
</xs:sequence>
|
|
</xs:complexType>
|
|
|
|
<xs:complexType name="command">
|
|
<xs:sequence>
|
|
<xs:element name="options" type="thing-description:options" minOccurs="0"/>
|
|
</xs:sequence>
|
|
</xs:complexType>
|
|
|
|
<xs:complexType name="option">
|
|
<xs:simpleContent>
|
|
<xs:extension base="xs:string">
|
|
<xs:attribute name="value" type="xs:string" use="required"/>
|
|
</xs:extension>
|
|
</xs:simpleContent>
|
|
</xs:complexType>
|
|
|
|
<xs:complexType name="properties">
|
|
<xs:sequence>
|
|
<xs:element name="property" type="thing-description:property" minOccurs="1" maxOccurs="unbounded" />
|
|
</xs:sequence>
|
|
</xs:complexType>
|
|
|
|
<xs:complexType name="property">
|
|
<xs:simpleContent>
|
|
<xs:extension base="xs:string">
|
|
<xs:attribute name="name" type="xs:string" use="required" />
|
|
</xs:extension>
|
|
</xs:simpleContent>
|
|
</xs:complexType>
|
|
|
|
<xs:simpleType name="dimension">
|
|
<xs:restriction base="xs:string">
|
|
<xs:enumeration value="Intensity" />
|
|
<xs:enumeration value="Acceleration" />
|
|
<xs:enumeration value="AmountOfSubstance" />
|
|
<xs:enumeration value="Angle" />
|
|
<xs:enumeration value="AngularAcceleration" />
|
|
<xs:enumeration value="AngularVelocity" />
|
|
<xs:enumeration value="Area" />
|
|
<xs:enumeration value="CatalyticActivity" />
|
|
<xs:enumeration value="DataAmount" />
|
|
<xs:enumeration value="DataRate" />
|
|
<xs:enumeration value="Dimensionless" />
|
|
<xs:enumeration value="Duration" />
|
|
<xs:enumeration value="DynamicViscosity" />
|
|
<xs:enumeration value="ElectricCapacitance" />
|
|
<xs:enumeration value="ElectricCharge" />
|
|
<xs:enumeration value="ElectricConductance" />
|
|
<xs:enumeration value="ElectricCurrent" />
|
|
<xs:enumeration value="ElectricInductance" />
|
|
<xs:enumeration value="ElectricPotential" />
|
|
<xs:enumeration value="ElectricResistance" />
|
|
<xs:enumeration value="Energy" />
|
|
<xs:enumeration value="Force" />
|
|
<xs:enumeration value="Frequency" />
|
|
<xs:enumeration value="Illuminance" />
|
|
<xs:enumeration value="KinematicViscosity" />
|
|
<xs:enumeration value="Length" />
|
|
<xs:enumeration value="LuminousFlux" />
|
|
<xs:enumeration value="LuminousIntensity" />
|
|
<xs:enumeration value="MagneticFlux" />
|
|
<xs:enumeration value="MagneticFluxDensity" />
|
|
<xs:enumeration value="Mass" />
|
|
<xs:enumeration value="MassFlowRate" />
|
|
<xs:enumeration value="Power" />
|
|
<xs:enumeration value="Pressure" />
|
|
<xs:enumeration value="RadiationDoseAbsorbed" />
|
|
<xs:enumeration value="RadiationDoseEffective" />
|
|
<xs:enumeration value="RadioactiveActivity" />
|
|
<xs:enumeration value="SolidAngle" />
|
|
<xs:enumeration value="Speed" />
|
|
<xs:enumeration value="Temperature" />
|
|
<xs:enumeration value="Torque" />
|
|
<xs:enumeration value="Velocity" />
|
|
<xs:enumeration value="Time" />
|
|
<xs:enumeration value="Volume" />
|
|
<xs:enumeration value="VolumetricDensity" />
|
|
<xs:enumeration value="VolumetricFlowRate" />
|
|
</xs:restriction>
|
|
</xs:simpleType>
|
|
|
|
</xs:schema>
|