I am a new owner of a TED Pro Home with a 4-60A, 4-20A Spyder. Though we had a pretty good suspicion (it is nearly 30 years old), TED confirmed our hot water heater is eating electricity.
After getting the MTU and Spyder installed, the next task is setting up a database to store the data. The ECC is polled via the http://..../history.export.raw, then error checking is performed, i.e. checksum matches. Finally, the data is inserted into the database. The database has a unique constraint on the measurement type (second, minute, hour, ...), device (MTU, Spyder circuit 1, 2, 3, etc), measurement time. When querying the ECC for the MTU second data, my code is throwing a lot of errors about duplicate data. While reviewing the data, it appears the timestamp is being reported multiple times. See the messages below, the interesting fields are 'timestamp' and 'source'
This is the URL: http://.../history/export.raw?S=1478484245&M=1&D=0&T=1
Is this expected behavior?
If so, how should data from the same time be handled, first is best, drop the rest or sum all the values, or last is best?
If not, any ideas on what may be causing duplicate data?
Thanks!
Jack
2016-11-06 21:15:51,236 - query_ted - INFO - {'good_data': True, 'header': 164, 'timestamp': 1478484252, 'active_power': 1387, 'zerodata': False, 'source': '{164, 28, 225, 31, 88, 107, 5, 0, 0, 13, 0, 0, 0, 183, 4, 80}', 'cost': 13, 'voltage': 1207, 'circuit': 1, 'chksum': 80}
2016-11-06 21:15:51,248 - query_ted - INFO - {'good_data': True, 'header': 164, 'timestamp': 1478484261, 'active_power': 1387, 'zerodata': False, 'source': '{164, 37, 225, 31, 88, 107, 5, 0, 0, 13, 0, 0, 0, 183, 4, 89}', 'cost': 13, 'voltage': 1207, 'circuit': 1, 'chksum': 89}
2016-11-06 21:15:51,256 - query_ted - INFO - {"message": "duplicate key value violates unique constraint \"measurement_device_id_measurement_type_id_measurement_time_key\""}
2016-11-06 21:15:51,257 - query_ted - INFO - {'good_data': True, 'header': 164, 'timestamp': 1478484252, 'active_power': 1387, 'zerodata': False, 'source': '{164, 28, 225, 31, 88, 107, 5, 0, 0, 13, 0, 0, 0, 183, 4, 80}', 'cost': 13, 'voltage': 1207, 'circuit': 1, 'chksum': 80}
2016-11-06 21:15:51,261 - query_ted - INFO - {"message": "duplicate key value violates unique constraint \"measurement_device_id_measurement_type_id_measurement_time_key\""}
2016-11-06 21:15:51,262 - query_ted - INFO - {'good_data': True, 'header': 164, 'timestamp': 1478484251, 'active_power': 1379, 'zerodata': False, 'source': '{164, 27, 225, 31, 88, 99, 5, 0, 0, 13, 0, 0, 0, 181, 4, 69}', 'cost': 13, 'voltage': 1205, 'circuit': 1, 'chksum': 69}
2016-11-06 21:15:51,269 - query_ted - INFO - {'good_data': True, 'header': 164, 'timestamp': 1478484250, 'active_power': 1374, 'zerodata': False, 'source': '{164, 26, 225, 31, 88, 94, 5, 0, 0, 13, 0, 0, 0, 182, 4, 64}', 'cost': 13, 'voltage': 1206, 'circuit': 1, 'chksum': 64}
2016-11-06 21:15:51,278 - query_ted - INFO - {'good_data': True, 'header': 164, 'timestamp': 1478484249, 'active_power': 1377, 'zerodata': False, 'source': '{164, 25, 225, 31, 88, 97, 5, 0, 0, 13, 0, 0, 0, 185, 4, 69}', 'cost': 13, 'voltage': 1209, 'circuit': 1, 'chksum': 69}
2016-11-06 21:15:51,289 - query_ted - INFO - {'good_data': True, 'header': 164, 'timestamp': 1478484248, 'active_power': 1377, 'zerodata': False, 'source': '{164, 24, 225, 31, 88, 97, 5, 0, 0, 13, 0, 0, 0, 185, 4, 68}', 'cost': 13, 'voltage': 1209, 'circuit': 1, 'chksum': 68}
2016-11-06 21:15:51,298 - query_ted - INFO - {'good_data': True, 'header': 164, 'timestamp': 1478484252, 'active_power': 1377, 'zerodata': False, 'source': '{164, 28, 225, 31, 88, 97, 5, 0, 0, 13, 0, 0, 0, 185, 4, 72}', 'cost': 13, 'voltage': 1209, 'circuit': 1, 'chksum': 72}
2016-11-06 21:15:51,307 - query_ted - INFO - {"message": "duplicate key value violates unique constraint \"measurement_device_id_measurement_type_id_measurement_time_key\""}
2016-11-06 21:15:51,308 - query_ted - INFO - {'good_data': True, 'header': 164, 'timestamp': 1478484248, 'active_power': 1373, 'zerodata': False, 'source': '{164, 24, 225, 31, 88, 93, 5, 0, 0, 13, 0, 0, 0, 182, 4, 61}', 'cost': 13, 'voltage': 1206, 'circuit': 1, 'chksum': 61}
2016-11-06 21:15:51,312 - query_ted - INFO - {"message": "duplicate key value violates unique constraint \"measurement_device_id_measurement_type_id_measurement_time_key\""}