Use Entities
#
Entity and Entities selectionTo select what entity you want to perform actions on use the Entity()
or Entities()
starting point. Some service calls are built-in to the Entity selections, like turn_on / turn_off.
#
Simple selectionExample 1: Selects one entity to perform action on
If you want to add attributes to the call service just do:
it is important that you use the lower case names of attributes when adding them in anonymous types.
This selects the light.light1
to perform the TurnOn
service calls on.
Example 2: Selects multiple entities to perform action on Here we have several options to turn on both light1 and light2.
This one takes a IEnumerable<string>
as input to selects multiple lights
Example 3: Selects multiple entities to perform action on using lambda
You can also use lambda expressions to select entities like select all lights that start name with light.kitchen_
. Now it gets really interesting to use advanced selections with little code using LINQ.
or select on attributes like example below.
#
Using AreasTurn on all lights in the kitchen area:
#
Special entitiesThere are no special entities implmented in V2 yet. To use media player features as an example you will have to use CallService.