|
|
@@ -30,6 +30,12 @@ if __name__ == '__main__': |
|
|
|
#print `raineagle.get_summation_values(macid, interval='day')` |
|
|
|
#print `raineagle.get_fast_poll_status(macid)` |
|
|
|
|
|
|
|
fields = [ 'demand_timestamp', 'meter_status', 'demand', |
|
|
|
'threshold_upper_demand', 'demand_units', 'summation_delivered', |
|
|
|
'summation_received', 'summation_units', ] |
|
|
|
tzfields = [ 'timezone_tzName', 'timezone_localTime', |
|
|
|
'timezone_utcTime', 'timezone_utcOffset' ] |
|
|
|
|
|
|
|
interval = conf.get('interval', 10) |
|
|
|
tzinterval = conf.get('tzinterval', 24*60*60) |
|
|
|
tzs = s = time.time() |
|
|
@@ -39,10 +45,11 @@ if __name__ == '__main__': |
|
|
|
print `usage_data` |
|
|
|
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'} |
|
|
|
fields = [ 'demand_timestamp', 'meter_status', 'demand', |
|
|
|
'threshold_upper_demand', 'demand_units', 'summation_delivered', |
|
|
|
'summation_received', 'summation_units', ] |
|
|
|
print_data('l', *(usage_data[x] for x in fields)) |
|
|
|
try: |
|
|
|
print_data('l', *(usage_data[x] for x in fields)) |
|
|
|
except KeyError: |
|
|
|
print_data('e', 'usage', `usage_data`) |
|
|
|
|
|
|
|
e = time.time() |
|
|
|
|
|
|
|
if e >= tzs: |
|
|
@@ -51,9 +58,10 @@ if __name__ == '__main__': |
|
|
|
tzinfo = raineagle.get_timezone(macid) |
|
|
|
tzoffset = int(tzinfo['timezone_utcTime']) - \ |
|
|
|
int(tzinfo['timezone_localTime']) |
|
|
|
tzfields = [ 'timezone_tzName', 'timezone_localTime', |
|
|
|
'timezone_utcTime', 'timezone_utcOffset' ] |
|
|
|
print_data('z', *(tzinfo[x] for x in tzfields)) |
|
|
|
try: |
|
|
|
print_data('z', *(tzinfo[x] for x in tzfields)) |
|
|
|
except KeyError: |
|
|
|
print_data('e', 'tz', `usage_data`) |
|
|
|
|
|
|
|
sys.stdout.flush() |
|
|
|
s += interval |
|
|
|