-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrest.yaml
160 lines (158 loc) · 4.22 KB
/
rest.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
---
################################################################################
# rest.yaml
# https://www.home-assistant.io/integrations/rest/
################################################################################
# Cars
- resource: !secret scripts_url_cars
method: GET
scan_interval: 3600
sensor:
- name: 'Cars Last Data Refreshed'
value_template: "{{ value_json['last_data_refresh'] }}"
- name: 'Car 1'
json_attributes_path: "$.car_1"
value_template: "OK"
json_attributes:
- engine
- last_fuel_cost
- last_fuel_date
- last_fuel_gallons
- last_fuel_mileage
- last_fuel_price
- last_maintenance_cost
- last_maintenance_date
- last_maintenance_description
- last_maintenance_location
- last_maintenance_mileage
- last_registration_date
- last_reported_date
- last_reported_event
- last_reported_mileage
- last_smog_date
- license
- make
- model
- nickname
- oil_life
- total_cost_per_mile
- total_mpg
- trim
- vin
- year
- name: 'Car 2'
json_attributes_path: "$.car_2"
value_template: "OK"
json_attributes:
- engine
- last_fuel_cost
- last_fuel_date
- last_fuel_gallons
- last_fuel_mileage
- last_fuel_price
- last_maintenance_cost
- last_maintenance_date
- last_maintenance_description
- last_maintenance_location
- last_maintenance_mileage
- last_registration_date
- last_reported_date
- last_reported_event
- last_reported_mileage
- last_smog_date
- license
- make
- model
- nickname
- oil_life
- total_cost_per_mile
- total_mpg
- trim
- vin
- year
- name: 'Car 3'
json_attributes_path: "$.car_3"
value_template: "OK"
json_attributes:
- engine
- last_fuel_cost
- last_fuel_date
- last_fuel_gallons
- last_fuel_mileage
- last_fuel_price
- last_maintenance_cost
- last_maintenance_date
- last_maintenance_description
- last_maintenance_location
- last_maintenance_mileage
- last_registration_date
- last_reported_date
- last_reported_event
- last_reported_mileage
- last_smog_date
- license
- make
- model
- nickname
- oil_life
- total_cost_per_mile
- total_mpg
- trim
- vin
- year
- name: 'Car 4'
json_attributes_path: "$.car_4"
value_template: "OK"
json_attributes:
- engine
- last_fuel_cost
- last_fuel_date
- last_fuel_gallons
- last_fuel_mileage
- last_fuel_price
- last_maintenance_cost
- last_maintenance_date
- last_maintenance_description
- last_maintenance_location
- last_maintenance_mileage
- last_registration_date
- last_reported_date
- last_reported_event
- last_reported_mileage
- last_smog_date
- license
- make
- model
- nickname
- oil_life
- total_cost_per_mile
- total_mpg
- trim
- vin
- year
# Cellartracker
- resource: https://www.cellartracker.com/xlquery.asp
method: GET
scan_interval: 360000
params:
User: !secret cellartracker_username
Password: !secret cellartracker_password
Format: xml
Table: List
Location: 1
sensor:
- name: 'Cellartracker'
json_attributes_path: "$.cellartracker.list"
value_template: "{{ value_json.cellartracker.list.row | length }}"
json_attributes:
- row
- name: 'cellartracker_value'
value_template: >-
{% set totals = namespace(valuation=0) %}
{% for i in value_json.cellartracker.list.row %}
{% if i.Valuation | is_number %}
{% set totals.valuation = totals.valuation + (i.Valuation | float) %}
{% endif %}
{% endfor %}
{{ totals.valuation | round(2) }}
unit_of_measurement: "$"