implement insert/update to postgresql with current device status