|
@@ -171,8 +171,12 @@ def supervise(since):
|
171
|
171
|
last_update = 0
|
172
|
172
|
else:
|
173
|
173
|
last_update = get_last_update()
|
174
|
|
-
|
175
|
|
- h = Heatpump(mac_address, last_update, ['Analog'])
|
|
174
|
+
|
|
175
|
+ post_packets = [
|
|
176
|
+ Heatpump(mac_address, last_update, ['Analog']).__dict__()
|
|
177
|
+ Heatpump(mac_address, last_update, ['Digital']).__dict__()
|
|
178
|
+ Heatpump(mac_address, last_update, ['Integer']).__dict__()
|
|
179
|
+ ]
|
176
|
180
|
|
177
|
181
|
base_url = {
|
178
|
182
|
'scheme':config.get('supervisor', 'scheme'),
|
|
@@ -200,23 +204,26 @@ def supervise(since):
|
200
|
204
|
}
|
201
|
205
|
|
202
|
206
|
logger.info(build_url(post_url))
|
203
|
|
- data = h.__dict__()
|
204
|
|
- try:
|
205
|
|
- logger.debug(json.dumps(data))
|
206
|
|
- except Exception as e:
|
207
|
|
- print(e)
|
208
|
|
- sys.exit(1)
|
209
|
|
-
|
210
|
207
|
|
211
|
|
- logger.debug('Will send %s', data)
|
212
|
|
- post_resp = requests.post(
|
213
|
|
- url=build_url(post_url),
|
214
|
|
- json=data,
|
215
|
|
- verify=False
|
216
|
|
- )
|
217
|
|
- if post_resp.status_code == 200:
|
218
|
|
- logger.info('POST to supervisor succeeded')
|
219
|
|
- set_last_update(int(datetime.now().strftime('%s')))
|
|
208
|
+ for packet in post_packets:
|
|
209
|
+ try:
|
|
210
|
+ logger.debug(json.dumps(packet))
|
|
211
|
+ except Exception as e:
|
|
212
|
+ print(e)
|
|
213
|
+ sys.exit(1)
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+ for packet in post_packets:
|
|
217
|
+ logger.debug('Will send %s', packet)
|
|
218
|
+ post_resp = requests.post(
|
|
219
|
+ url=build_url(post_url),
|
|
220
|
+ json=packet,
|
|
221
|
+ verify=False
|
|
222
|
+ )
|
|
223
|
+ if post_resp.status_code == 200:
|
|
224
|
+ logger.info('POST to supervisor succeeded')
|
|
225
|
+
|
|
226
|
+ set_last_update(int(datetime.now().strftime('%s')))
|
220
|
227
|
|
221
|
228
|
get_path = '/'.join((
|
222
|
229
|
config.get('supervisor', 'get_path'),
|