-
Notifications
You must be signed in to change notification settings - Fork 2
/
sensor.yaml
30 lines (30 loc) · 1.65 KB
/
sensor.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
##
## This command line template uses "jq" to process the insteon_devices.json into organized insteon scenes.
## It *only* reads the scenes in the hub (not devive to device scenes).
## It returns JSON as attributes for only records that are "in_use" in the ALDB.
##
## sensor.insteon_groups
##
- platform: command_line
scan_interval: 30
name: insteon_groups
command: "jq '{ groups: [ .[0].\"address\" as $modemaddress | .[] | .\"address\" as $device_address | select(.\"address\" != $modemaddress) | .aldb | .[] | .target=$modemaddress | { group: .\"group\", in_use: .\"in_use\", device_address: $device_address, target: .\"target\", controller: .\"controller\", brightness: .\"data1\", ramp_rate: .\"data2\", button: .\"data3\"} ] | sort_by(.group) | map(select(.\"group\" > 20)) | map(select(.in_use))}' insteon_devices.json"
value_template: "{{ now() }}"
json_attributes:
- groups
##
## These two sensors are used to store the currently selected device, group.
## The first one basicially contains the entity_id for the selected device and is populated when a device is selected from an input_select containing all the devices.
## The input_select.insteon_devices is structured as "friendly_name (entity_id)" so one can see what devices are what. The "sensor.selected_insteon_device" parses off the entity_id part.
##
## sensor.selected_insteon_device
##
- platform: template
sensors:
selected_insteon_device:
value_template: "{{ states.input_select.insteon_devices.state.split('(')[1].split(')')[0] }}"
##
## sensor.targeted_insteon_group
##
targeted_insteon_group:
value_template: "{{ states('input_number.target_insteon_group')|int }}"