Browse Source

update to include the current time when polling... helps make

sure time is correct
main
John-Mark Gurney 5 years ago
parent
commit
789109e813
1 changed files with 4 additions and 3 deletions
  1. +4
    -3
      bin/poll.py

+ 4
- 3
bin/poll.py View File

@@ -41,17 +41,18 @@ if __name__ == '__main__':
tzs = s = time.time() tzs = s = time.time()
while True: while True:
usage_data = raineagle.get_usage_data(macid) usage_data = raineagle.get_usage_data(macid)

e = time.time()

if False: if False:
print `usage_data` print `usage_data`
else: else:
#{u'message_queue': u'active', u'threshold_lower_demand': u'-2.000000', u'fast_poll_frequency': u'0x00', u'summation_delivered': u'65374.021', u'message_read': u'Y', u'price': u'0.2700', u'demand_timestamp': u'1571842464', u'fast_poll_endtime': u'0x00000000', u'meter_status': u'Connected', u'message_confirm_required': u'N', u'message_confirmed': u'N', u'demand_units': u'kW', u'summation_units': u'kWh', u'demand': u'0.9980', u'price_units': u'840', u'message_timestamp': u'946684800', u'price_label': u'Set by User', u'threshold_upper_demand': u'9.155000', u'message_id': u'0', u'summation_received': u'0.000'} #{u'message_queue': u'active', u'threshold_lower_demand': u'-2.000000', u'fast_poll_frequency': u'0x00', u'summation_delivered': u'65374.021', u'message_read': u'Y', u'price': u'0.2700', u'demand_timestamp': u'1571842464', u'fast_poll_endtime': u'0x00000000', u'meter_status': u'Connected', u'message_confirm_required': u'N', u'message_confirmed': u'N', u'demand_units': u'kW', u'summation_units': u'kWh', u'demand': u'0.9980', u'price_units': u'840', u'message_timestamp': u'946684800', u'price_label': u'Set by User', u'threshold_upper_demand': u'9.155000', u'message_id': u'0', u'summation_received': u'0.000'}
try: try:
print_data('l', *(usage_data[x] for x in fields))
print_data('m', str(e), *(usage_data[x] for x in fields))
except KeyError: except KeyError:
print_data('e', 'usage', `usage_data`) print_data('e', 'usage', `usage_data`)


e = time.time()

if e >= tzs: if e >= tzs:
tzs += tzinterval tzs += tzinterval
# {u'timezone_tzName': u'GMT+7', u'timezone_status': u'success', u'timezone_localTime': u'1571844539', u'timezone_olsonName': u'Etc/GMT+7', u'timezone_utcTime': u'1571869739', u'timezone_utcOffset': u'-0700'} # {u'timezone_tzName': u'GMT+7', u'timezone_status': u'success', u'timezone_localTime': u'1571844539', u'timezone_olsonName': u'Etc/GMT+7', u'timezone_utcTime': u'1571869739', u'timezone_utcOffset': u'-0700'}


Loading…
Cancel
Save