|
|
@ -2,7 +2,7 @@ |
|
|
|
// for details on configuring this project to bundle and minify static web assets.
|
|
|
|
// for details on configuring this project to bundle and minify static web assets.
|
|
|
|
|
|
|
|
|
|
|
|
// Write your JavaScript code.
|
|
|
|
// Write your JavaScript code.
|
|
|
|
$(function() { |
|
|
|
$(function () { |
|
|
|
if ($("#login_card").length == 0) { |
|
|
|
if ($("#login_card").length == 0) { |
|
|
|
$.ajax({ |
|
|
|
$.ajax({ |
|
|
|
type: "GET", |
|
|
|
type: "GET", |
|
|
@ -19,7 +19,7 @@ $(function() { |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$("#json_data").change(function() { |
|
|
|
$("#json_data").change(function () { |
|
|
|
var jsonData = JSON.parse($("#json_data").val()); |
|
|
|
var jsonData = JSON.parse($("#json_data").val()); |
|
|
|
console.log(jsonData); |
|
|
|
console.log(jsonData); |
|
|
|
$("#vehicle_name").html(jsonData.display_name); |
|
|
|
$("#vehicle_name").html(jsonData.display_name); |
|
|
@ -29,13 +29,6 @@ $("#json_data").change(function() { |
|
|
|
$("#range_units").html(jsonData.gui_settings.gui_distance_units.includes("mi") ? " mi" : " km"); |
|
|
|
$("#range_units").html(jsonData.gui_settings.gui_distance_units.includes("mi") ? " mi" : " km"); |
|
|
|
$("#locate_vehicle_btn").attr("href", "https://whoogle.nmare.net/search?q=" + jsonData.drive_state.latitude + "," + jsonData.drive_state.longitude); |
|
|
|
$("#locate_vehicle_btn").attr("href", "https://whoogle.nmare.net/search?q=" + jsonData.drive_state.latitude + "," + jsonData.drive_state.longitude); |
|
|
|
$("#climate_status").html(jsonData.climate_state.is_climate_on.includes("true") ? "On" : "Off"); |
|
|
|
$("#climate_status").html(jsonData.climate_state.is_climate_on.includes("true") ? "On" : "Off"); |
|
|
|
/* |
|
|
|
|
|
|
|
if (jsonData.gui_settings.gui_temperature_units.includes("F")) { |
|
|
|
|
|
|
|
jsonData.climate_state.outside_temp = ((jsonData.climate_state.outside_temp * 1.8) + 32).toFixed(0); |
|
|
|
|
|
|
|
jsonData.climate_state.inside_temp = ((jsonData.climate_state.inside_temp * 1.8) + 32).toFixed(0); |
|
|
|
|
|
|
|
jsonData.climate_state.driver_temp_setting = ((jsonData.climate_state.driver_temp_setting * 1.8) + 32).toFixed(0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
$("#outside_temp").html(jsonData.climate_state.outside_temp); |
|
|
|
$("#outside_temp").html(jsonData.climate_state.outside_temp); |
|
|
|
$("#inside_temp").html(jsonData.climate_state.inside_temp); |
|
|
|
$("#inside_temp").html(jsonData.climate_state.inside_temp); |
|
|
|
$("#climate_setting").val(jsonData.climate_state.driver_temp_setting) |
|
|
|
$("#climate_setting").val(jsonData.climate_state.driver_temp_setting) |
|
|
@ -47,21 +40,53 @@ $("#json_data").change(function() { |
|
|
|
if (!jsonData.charge_state.charging_state.includes("Disconnected")) { |
|
|
|
if (!jsonData.charge_state.charging_state.includes("Disconnected")) { |
|
|
|
$("#charge_state_card").css("display", "flex"); |
|
|
|
$("#charge_state_card").css("display", "flex"); |
|
|
|
$("#connected_cable").html(jsonData.charge_state.conn_charge_cable); |
|
|
|
$("#connected_cable").html(jsonData.charge_state.conn_charge_cable); |
|
|
|
if (jsonData.charge_state.minutes_to_full_charge != 0 ) { |
|
|
|
if (jsonData.charge_state.minutes_to_full_charge != 0) { |
|
|
|
$("#till_full").css("display", "block"); |
|
|
|
$("#till_full").css("display", "block"); |
|
|
|
$("#time_to_full").html(jsonData.charge_state.minutes_to_full_charge); |
|
|
|
minTillFull = jsonData.charge_state.minutes_to_full_charge; |
|
|
|
|
|
|
|
hoursTillFull = Math.trunc(minTillFull / 60); |
|
|
|
|
|
|
|
minTillFull = minTillFull % 60 |
|
|
|
|
|
|
|
timeTillFullOutput = ""; |
|
|
|
|
|
|
|
if (hoursTillFull >= 1) { |
|
|
|
|
|
|
|
timeTillFullOutput += hoursTillFull + "h"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (minTillFull >= 1) { |
|
|
|
|
|
|
|
timeTillFullOutput += minTillFull + "m"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
$("#time_to_full").html(timeTillFullOutput); |
|
|
|
$("#charge_ctrl_btn").html("Stop Charging") |
|
|
|
$("#charge_ctrl_btn").html("Stop Charging") |
|
|
|
$("#charge_ctrl_btn").attr("href", "/?handler=Command&command=charge_stop"); |
|
|
|
$("#charge_ctrl_btn").attr("href", "/?handler=Command&command=charge_stop"); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$("#charge_ctrl_btn").html("Start Charging") |
|
|
|
$("#charge_ctrl_btn").html("Start Charging") |
|
|
|
$("#charge_ctrl_btn").attr("href", "/?handler=Command&command=charge_start"); |
|
|
|
$("#charge_ctrl_btn").attr("href", "/?handler=Command&command=charge_start"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$("#current_current").html((jsonData.charge_state.charger_voltage * jsonData.charge_state.charger_actual_current) / 1000); |
|
|
|
if (jsonData.charge_state.fast_charger_brand.includes("Tesla")) { |
|
|
|
if (jsonData.charge_state.fast_charger_brand.includes("Tesla")) { |
|
|
|
$("#connection_ind").html("Supercharging") |
|
|
|
$("#connection_ind").html("Supercharging") |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$("#connection_ind").html(jsonData.charge_state.charging_state) |
|
|
|
$("#connection_ind").html(jsonData.charge_state.charging_state) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (jsonData.climate_state.is_preconditioning == "true") { |
|
|
|
|
|
|
|
$("#climate_btn").html("Stop Climate"); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
$(".card-deck").css("display", "flex"); |
|
|
|
$(".card-deck").css("display", "flex"); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function runClimate() { |
|
|
|
|
|
|
|
var jsonData = JSON.parse($("#json_data").val()); |
|
|
|
|
|
|
|
climateTemp = $("#climate_setting").val(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (jsonData.gui_settings.gui_temperature_units == "F") { |
|
|
|
|
|
|
|
climateTemp = (climateTemp * 1.8) + 32; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (climateTemp > jsonData.climate_state.max_avail_temp || climateTemp < jsonData.climate_state.min_avail_temp) { |
|
|
|
|
|
|
|
alert("Invalid temperature setting."); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (jsonData.climate_state.is_preconditioning == "true") { |
|
|
|
|
|
|
|
window.location.href = "/?handler=Command&command=auto_conditioning_stop&climateTemp=" + climateTemp; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
window.location.href = "/?handler=Command&command=auto_conditioning_start&climateTemp=" + climateTemp; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |