forked from bendikwa/igrill
-
Notifications
You must be signed in to change notification settings - Fork 3
/
TODO list
213 lines (194 loc) · 6.63 KB
/
TODO list
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
- #!/usr/bin/env python in monitor.py to #!/usr/bin/env python3
- ADDRESS and mqtt_server in monitor_igrill_v2.py
- mqtt.yaml to show my host IP and port for my mqtt server
- 3 shouldn’t have been nexessary, I think, because the mqtt info is hardcoded in the file monitor_igrill_v2.py anyway
I also modified the monitor_igrillv2.py like this and made the file executable:
import json
import time
import paho.mqtt.client as mqtt
from igrill import IGrillV2Peripheral
ADDRESS = 'RE:AL:MA:CD'
mqtt_server = "mqtt"
input_select:
bbq_sensor_1:
name: Sensor 1
options:
- none
- Kern
- BBQ
initial: none
icon: mdi:pin
bbq_sensor_2:
name: Sensor 2
options:
- none
- Kern
- BBQ
initial: none
icon: mdi:pin
input_number:
sensor_min_1:
name: min
unit_of_measurement: "°C"
initial: 50
min: 0
max: 350
step: 1
sensor_max_1:
name: max
unit_of_measurement: "°C"
initial: 350
min: 0
max: 350
step: 1
sensor_kern_1:
name: kern
mode: box
unit_of_measurement: "°C"
initial: 50
min: 30
max: 100
step: 1
sensor_min_2:
name: min
unit_of_measurement: "°C"
initial: 50
min: 0
max: 350
step: 1
sensor_max_2:
name: max
unit_of_measurement: "°C"
initial: 350
min: 0
max: 350
step: 1
sensor_kern_2:
name: kern
mode: box
unit_of_measurement: "°C"
initial: 50
min: 30
max: 100
step: 1
group:
probe_1:
name: Probe 1
entities:
# - sensor.sensor1
- input_select.bbq_sensor_1
# - input_boolean.min_alarm_sensor_1
probe_2:
name: Probe 2
entities:
# - sensor.sensor2
- input_select.bbq_sensor_2
probe_bbq_1:
name: Probe 1 bbq
entities:
- input_number.sensor_min_1
- input_number.sensor_max_1
- input_boolean.min_alarm_sensor_1
probe_bbq_2:
name: Probe 2 bbq
entities:
- input_number.sensor_min_2
- input_number.sensor_max_2
- input_boolean.min_alarm_sensor_2
probe_kern_1:
name: Probe 1 bbq
entities:
- input_number.sensor_kern_1
probe_kern_2:
name: Probe 2 bbq
entities:
- input_number.sensor_kern_2
input_boolean:
min_alarm_sensor_1:
name: Min Alarm Sensor 1
initial: off
min_alarm_sensor_2:
name: Min Alarm Sensor 2
initial: off
Appdeamon in apps folder called bbq.py
Copy to clipboard
import appdaemon.plugins.hass.hassapi as hass
class BBQtemp(hass.Hass):
def initialize(self):
self.select = "input_select.bbq_sensor_" + str(self.args["number"])
self.sensor = "sensor.sensor_" + str(self.args["number"])
self.number_kern = "input_number.sensor_kern_" + str(self.args["number"])
self.number_min = "input_number.sensor_min_" + str(self.args["number"])
self.number_max = "input_number.sensor_max_" + str(self.args["number"])
self.min_alarm = "input_boolean.min_alarm_sensor_" + str(self.args["number"])
self.group_kern = "group.probe_kern_" + str(self.args["number"])
self.group_bbq = "group.probe_bbq_" + str(self.args["number"])
self.group_probe = "group.probe_" + str(self.args["number"])
self.listen_state(self.temp_change, self.sensor)
self.listen_state(self.temp_type, self.select)
self.warning = False
def temp_change(self, entity, attribute, old, new, kwargs):
self.log(entity)
self.log(new)
if new == "unknown":
self.log(new)
self.call_service("notify/pushbullet", message = "temperatuur sensor " + str(self.args["number"]) + " is uitgevallen")
# self.call_service("group/set_visibility", entity_id = self.group_probe, visible = False )
self.call_service("group/set_visibility", entity_id = self.group_bbq, visible = False )
self.call_service("group/set_visibility", entity_id = self.group_kern, visible = False )
else:
self.type = self.get_state(entity = self.select)
if self.type == "Kern":
if int(float(new)) >= int(float(self.get_state(entity = self.number_kern))) and self.warning == False:
self.warning = True
self.log("heet")
self.call_service("notify/pushbullet", message = "kern temperatuur sensor " + str(self.args["number"]) + " bereikt")
# self.call_service("tts/google_say", intity_id = "media_player.google_home", message = "kern temperatuur sensor " + str(self.args["number"]) + " bereikt")
self.run_in(self.warning_timer, 3)
elif self.type == "BBQ":
#self.log("type is BBQ")
self.start = self.get_state(self.min_alarm)
if int(float(new)) < int(float(self.get_state(entity = self.number_min))) and self.warning == False and self.start == "on":
self.warning = True
self.log("bbq te koud")
self.call_service("notify/pushbullet", message = "BBQ sensor " + str(self.args["number"]) + " te koud")
# self.call_service("tts/google_say", intity_id = "media_player.google_home", message = "kern temperatuur sensor 1 bereikt")
self.run_in(self.warning_timer, 3)
elif int(float(new)) > int(float(self.get_state(entity = self.number_max))) and self.warning == False:
self.set_state(self.min_alarm, state = "on")
self.warning = True
self.log("BBQ te heet")
self.call_service("notify/pushbullet", message = "BBQ sensor " + str(self.args["number"]) + " te heet")
# self.call_service("tts/google_say", intity_id = "media_player.google_home", message = "kern temperatuur sensor 1 bereikt")
self.run_in(self.warning_timer, 3)
else:
self.log("type is None")
self.call_service("group/set_visibility", entity_id = self.group_probe, visible = True )
def temp_type(self, entity, attribute, old, new, kwargs):
# if state = "None"
# self.log (new)
if new == "none":
self.log("set to none")
self.log(self.group_bbq)
self.call_service("group/set_visibility", entity_id = self.group_bbq, visible = False )
self.call_service("group/set_visibility", entity_id = self.group_kern, visible = False )
if new == "Kern":
self.log("set to Kern")
self.call_service("group/set_visibility", entity_id = self.group_bbq, visible = False )
self.call_service("group/set_visibility", entity_id = self.group_kern, visible = True )
if new == "BBQ":
self.log("set to BBQ")
self.call_service("group/set_visibility", entity_id = self.group_bbq, visible = True )
self.call_service("group/set_visibility", entity_id = self.group_kern, visible = False )
def warning_timer(self, kwargs):
self.warning = False
apps.yaml of appdeamon:
Copy to clipboard
bbq1:
module: bbq
class: BBQtemp
number: 1
bbq2:
module: bbq
class: BBQtemp
number: 2