// Google maps api URL // This is required to get the timezone offset from the current user's location $google_json = "https://maps.googleapis.com/maps/api/timezone/json?location=" . $user_lat . "," . $user_long . "×tamp=" . $timestamp; $google_time = json_decode(file_get_contents($google_json)); $dst_offset = $google_time->dstOffset; $raw_offset = $google_time->rawOffset; $timestamp_offset = ( $dst_offset + $raw_offset ) / 60 / 60; //$local_time = $timestamp + $dst_offset + $raw_offset; */ $nest = new Nest($nest_username, $nest_password_decrypt); $nest_devices = $nest->getDevices(); foreach ($nest_devices as $device) { // Gather information from the Nest class object for storage $infos = $nest->getDeviceInfo($device); $energy = $nest->getEnergyLatest($device); $weather_nest = $nest->getWeather($user_location); // Gather the device information for storage $device_serial_number = $infos->serial_number; $nest_location = $infos->where; $device_name = $infos->name; $battery_level = $infos->current_state->battery_level; // Outside weather pulled from the nest class $outside_humidity = $weather_nest->outside_humidity; $outside_temperature = $weather_nest->outside_temperature; // Inside weather pulled from the nest class $temperature = $infos->current_state->temperature; $humidity = $infos->current_state->humidity; // Current running statistics for the graph $ac = $infos->current_state->ac == "" ? 0 : $infos->current_state->ac; $heat = $infos->current_state->heat == "" ? 0 : $infos->current_state->heat; $scale = $infos->scale;