select count(*),min(time),max(time),
sensor_type,
addr as mac,
json->'sensor_name' as sensor_name
from eg5120
group by 
sensor_type,
addr,
sensor_name
order by sensor_type asc, max desc
;

