Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
<Namespace Name="Atomiton"> <Domain Name="Lights"> <PhilipLightBaseURI>http://10.0.2.16/api/newdeveloper</PhilipLightBaseURI> <Macro Name="ExecuteQuery"> <Argument> <QueryString> <Query/> </QueryString> </Argument> <Result> <OnRequest> <Target>[:RuntimeParams.FacetIDName:]</Target> <Process> <Message> <Value>[:$Macro.Argument.QueryString:]</Value> </Message> </Process> </OnRequest> </Result> </Macro> <Macro Name="AddLight"> <Argument> <LightNumber/> <On/> <bri/> <hue/> <sat/> </Argument> <Result> <ExecuteQuery> <QueryString> <DeleteAll> <PhilipLightModel> <LightNumber eq="[:$Macro.Argument.LightNumber:]"/> </PhilipLightModel> </DeleteAll> <Create> <PhilipLightModel> <LightNumber>[:$Macro.Argument.LightNumber:]</LightNumber> <state> <On>[:$Macro.Argument.On:]</On> <bri>[:$Macro.Argument.bri:]</bri> <hue>[:$Macro.Argument.hue:]</hue> <sat>[:$Macro.Argument.sat:]</sat> </state> </PhilipLightModel> </Create> </QueryString> </ExecuteQuery> </Result> </Macro> <Def Name="PhilipLightState"> <Boolean Name="On"/> <Integer Name="bri"/> <Integer Name="hue"/> <Integer Name="sat"/> <String Name="effect"/> <Double Name="xy" cardinality="2"/> <Integer Name="ct"/> <String Name="alert"/> <String Name="colormode"/> <Boolean Name="reachable"/> </Def> <Def Name="PointSymbol"> <String name="1" default="none"/> <String name="2" default="none"/> <String name="3" default="none"/> <String name="4" default="none"/> <String name="5" default="none"/> <String name="6" default="none"/> <String name="7" default="none"/> <String name="8" default="none"/> </Def> <ThingFacet Name="PhilipLightFacet"> <String Name="LightNumber"/> <PhilipLightState Name="state" KnownBy="PhilipLightActionUsingCurl"/> <String Name="Type"/> <String Name="Name"/> <String Name="modelid"/> <String Name="uniqueid"/> <String Name="swversion"/> <PointSymbol Name="Pointsymbol"/> <AA>[:#o#Event.Argument:]</AA> <Ontrue>{"on":true}</Ontrue> <Onfalse>"on":false</Onfalse> <Action Name="PhilipLightActionUsingCurl"> <Workflow Limit="1" Live="1" Timeout="-1"> <Task name="Main" While="True"> <Event name="Argument" as="ActionArgument"/> <Invoke name="SetState" waitFor="ActionArgument" execute="curl -X PUT -d '{"on":[%:[:AA:].state.On.Value:%]}' [:PhilipLightBaseURI:]/lights/[%:[:AA:].LightNumber.Value:%]/state"/> <Log Message="[:Invoke.SetState:]"/> <Output name="Result" as="ActionResult"> <Value> <state> [%:[:AA:].state.On.Value:%] </state> </Value> </Output> </Task> </Workflow> </Action> </ThingFacet> <ThingFacet Name="PhilipLightManagerFacet"> <String Name="LoadLights" KnownBy="LoadLightsAction"/> <Action Name="LoadLightsAction"> <Workflow Limit="1" Live="1" Timeout="-1"> <Task Name="Main" While="True"> <Event Name="Argument" as="ActionArgument"/> <Invoke Name="GetLights" waitFor="ActionArgument" Get="[:PhilipLightBaseURI:]/lights"/> <Log Message="Lights Loaded...[:Invoke.GetLights.Message.Value:]"/> <Invoke Name="ParseGetLightsResult"> <FacetScript> <AddLight> <LightNumber>1</LightNumber> <On>[:Invoke.GetLights.Message.Value.1.State.On:]</On> <bri>[:Invoke.GetLights.Message.Value.1.State.bri:]</bri> <hue>[:Invoke.GetLights.Message.Value.1.State.hue:]</hue> <sat>[:Invoke.GetLights.Message.Value.1.State.sat:]</sat> </AddLight> <AddLight> <LightNumber>2</LightNumber> <On>[:Invoke.GetLights.Message.Value.2.State.On:]</On> <bri>[:Invoke.GetLights.Message.Value.2.State.bri:]</bri> <hue>[:Invoke.GetLights.Message.Value.2.State.hue:]</hue> <sat>[:Invoke.GetLights.Message.Value.2.State.sat:]</sat> </AddLight> <AddLight> <LightNumber>3</LightNumber> <On>[:Invoke.GetLights.Message.Value.3.State.On:]</On> <bri>[:Invoke.GetLights.Message.Value.3.State.bri:]</bri> <hue>[:Invoke.GetLights.Message.Value.3.State.hue:]</hue> <sat>[:Invoke.GetLights.Message.Value.3.State.sat:]</sat> </AddLight> </FacetScript> </Invoke> <Output Name="Result" as="ActionResult"> <Value> <LoadLights>True</LoadLights> </Value> </Output> </Task> </Workflow> </Action> </ThingFacet> <ThingModel Name="PhilipLightModel" Combines="PhilipLightFacet"> <Sid Name="LightId"/> </ThingModel> <ThingModel Name="PhilipLightManagerModel" Combines="PhilipLightManagerFacet"> <sid Name="ManagerId"/> </ThingModel> </Domain> </Namespace> |
Page Comparison
General
Content
Integrations