From 2e9245cb2a3c3aecae1ab6fe6ceb1e3e9156684e Mon Sep 17 00:00:00 2001 From: tmjo <54450177+tmjo@users.noreply.github.com> Date: Sat, 7 Nov 2020 00:35:50 +0100 Subject: [PATCH] Update status and status text according to breaking change on easee_hass v0.9.22 --- package-lock.json | 2 +- package.json | 2 +- src/const.js | 189 +++++++++++++++++++-------------------- src/translations/en.json | 14 +-- src/translations/nb.json | 14 +-- 5 files changed, 106 insertions(+), 115 deletions(-) diff --git a/package-lock.json b/package-lock.json index f2a821d..e00d8fe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "charger-card", - "version": "1.10.1", + "version": "1.10.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 45fa007..c3ba736 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "charger-card", - "version": "1.10.1", + "version": "1.10.2", "description": "Charger card for Home Assistant Lovelace UI", "main": "dist/charger-card.js", "scripts": { diff --git a/src/const.js b/src/const.js index 3f85abb..229a7c0 100644 --- a/src/const.js +++ b/src/const.js @@ -1,47 +1,68 @@ export const CARD_VERSION = '0.0.1'; -export const CHARGERDOMAIN = "easee"; -export const STATUS_ENTITY_BASE = "_status"; +export const CHARGERDOMAIN = 'easee'; +export const STATUS_ENTITY_BASE = '_status'; export const CHARGERSTATUS = { - STANDBY_1:"STANDBY", - PAUSED_2:"PAUSED", - CHARGING_3:"CHARGING", - READY_4:"READY_TO_CHARGE", - ERROR_5:"ERROR", - CONNECTED_6:"CAR_CONNECTED", + STANDBY_1: 'disconnected', + PAUSED_2: 'awaiting_start', + CHARGING_3: 'charging', + READY_4: 'completed', + ERROR_5: 'error', + CONNECTED_6: 'ready_to_charge', +}; + +export const LEDIMAGES = { + normal: { + DEFAULT: ledOff, + disconnected: ledWhite2, + awaiting_start: ledWhiteAll, + charging: ledWhiteFlashing, + completed: ledWhiteAll, + error: ledRedFlashing, + ready_to_charge: ledWhiteAll, + }, + smart: { + DEFAULT: ledOff, + disconnected: ledBlue2, + awaiting_start: ledBlueAll, + charging: ledBlueFlashing, + completed: ledBlueAll, + error: ledRedFlashing, + ready_to_charge: ledBlueAll, + }, }; export const ENTITIES = { - cableLocked : "binary_sensor.cable_locked_car", - cableLockedPermanently : "switch.cable_permanently_locked_charger", - basicSchedule : "binary_sensor.basic_schedule", - circuitCurrent : "sensor.circuit_current", - costPerKwh : "sensor.cost_per_kwh", - dynamicChargerCurrent : "sensor.dynamic_charger_current", - dynamicCircuitCurrent : "sensor.dynamic_circuit_current", - enableIdleCurrent : "switch.enable_idle_current", - inCurrent : "sensor.in_current", - isEnabled : "switch.is_enabled", - maxChargerCurrent : "sensor.max_charger_current", - maxCircuitCurrent : "sensor.max_circuit_current", - isOnline : "binary_sensor.online", - outputCurrent : "sensor.output_current", - reasonForNoCurrent : "sensor.reason_for_no_current", - sessionEnergy : "sensor.session_energy", - energyPerHour : "sensor.energy_per_hour", - smartCharging : "switch.smart_charging", - totalPower : "sensor.total_power", - updateAvailable : "binary_sensor.update_available", - voltage : "sensor.voltage", + cableLocked: 'binary_sensor.cable_locked_car', + cableLockedPermanently: 'switch.cable_permanently_locked_charger', + basicSchedule: 'binary_sensor.basic_schedule', + circuitCurrent: 'sensor.circuit_current', + costPerKwh: 'sensor.cost_per_kwh', + dynamicChargerCurrent: 'sensor.dynamic_charger_current', + dynamicCircuitCurrent: 'sensor.dynamic_circuit_current', + enableIdleCurrent: 'switch.enable_idle_current', + inCurrent: 'sensor.in_current', + isEnabled: 'switch.is_enabled', + maxChargerCurrent: 'sensor.max_charger_current', + maxCircuitCurrent: 'sensor.max_circuit_current', + isOnline: 'binary_sensor.online', + outputCurrent: 'sensor.output_current', + reasonForNoCurrent: 'sensor.reason_for_no_current', + sessionEnergy: 'sensor.session_energy', + energyPerHour: 'sensor.energy_per_hour', + smartCharging: 'switch.smart_charging', + totalPower: 'sensor.total_power', + updateAvailable: 'binary_sensor.update_available', + voltage: 'sensor.voltage', }; export const SERVICES = { - chargerMaxCurrent: 'set_charger_max_current', - chargerDynCurrent: 'set_charger_dynamic_current', - circuitMaxCurrent: 'set_charger_circuit_max_current', - circuitDynCurrent: 'set_charger_circuit_dynamic_current' -} + chargerMaxCurrent: 'set_charger_max_current', + chargerDynCurrent: 'set_charger_dynamic_current', + circuitMaxCurrent: 'set_charger_circuit_max_current', + circuitDynCurrent: 'set_charger_circuit_dynamic_current', +}; import imageGeneric from './img/charger_generic_223x302.png'; import imageAnthracite from './img/charger_anthracite_223x302.png'; @@ -50,15 +71,14 @@ import imageBlack from './img/charger_black_223x302.png'; import imageWhite from './img/charger_white_223x302.png'; import imageDarkblue from './img/charger_darkblue_223x302.png'; - -export const DEFAULTIMAGE = "Generic"; +export const DEFAULTIMAGE = 'Generic'; export const CHARGER_IMAGES = [ - {name: "Generic", img: imageGeneric}, - {name: "Anthracite", img: imageAnthracite}, - {name: "Red", img: imageRed}, - {name: "Black", img: imageBlack}, - {name: "White", img: imageWhite}, - {name: "Darkblue", img: imageDarkblue}, + { name: 'Generic', img: imageGeneric }, + { name: 'Anthracite', img: imageAnthracite }, + { name: 'Red', img: imageRed }, + { name: 'Black', img: imageBlack }, + { name: 'White', img: imageWhite }, + { name: 'Darkblue', img: imageDarkblue }, ]; import ledOff from './img/charger_leds_bg.gif'; @@ -70,67 +90,38 @@ import ledBlueAll from './img/charger_leds_blue_all.gif'; import ledBlueFlashing from './img/charger_leds_blue_flashing.gif'; import ledRedFlashing from './img/charger_leds_red_flashing.gif'; - -export const LEDIMAGES = { - normal: { - 'DEFAULT': ledOff, - 'STANDBY': ledWhite2, - 'PAUSED': ledWhiteAll, - 'CHARGING': ledWhiteFlashing, - 'READY_TO_CHARGE': ledWhiteAll, - 'ERROR': ledRedFlashing, - 'CAR_CONNECTED': ledWhiteAll, - }, - smart: { - 'DEFAULT': ledOff, - 'STANDBY': ledBlue2, - 'PAUSED': ledBlueAll, - 'CHARGING': ledBlueFlashing, - 'READY_TO_CHARGE': ledBlueAll, - 'ERROR': ledRedFlashing, - 'CAR_CONNECTED': ledBlueAll, - } - +export const ICONS = { + 'binary_sensor.cable_locked_car': 'mdi:lock', + 'switch.cable_permanently_locked_charger': 'mdi:lock', + 'binary_sensor.basic_schedule': 'mdi:clock-check', + 'sensor.circuit_current': 'mdi:sine-wave', + 'sensor.cost_per_kwh': 'mdi:currency-usd', + 'sensor.dynamic_charger_current': 'mdi:sine-wave', + 'sensor.dynamic_circuit_current': 'mdi:sine-wave', + 'switch.enable_idle_current': 'mdi:current-dc', + 'sensor.in_current': 'mdi:sine-wave', + 'switch.is_enabled': 'mdi:power', + 'sensor.max_charger_current': 'mdi:sine-wave', + 'sensor.max_circuit_current': 'mdi:sine-wave', + 'binary_sensor.online': 'mdi:wifi', + 'sensor.output_current': 'mdi:sine-wave', + 'sensor.reason_for_no_current': 'mdi:alert-circle', + 'sensor.session_energy': 'mdi:flash', + 'sensor.energy_per_hour': 'mdi:flash', + 'switch.smart_charging': 'mdi:auto-fix', + 'sensor.total_power': 'mdi:flash', + 'binary_sensor.update_available': 'mdi:file-download', + 'sensor.voltage': 'mdi:sine-wave', }; - -export const ICONS={ - "binary_sensor.cable_locked_car" : "mdi:lock", - "switch.cable_permanently_locked_charger" : "mdi:lock", - "binary_sensor.basic_schedule" : "mdi:clock-check", - "sensor.circuit_current" : "mdi:sine-wave", - "sensor.cost_per_kwh" : "mdi:currency-usd", - "sensor.dynamic_charger_current" : "mdi:sine-wave", - "sensor.dynamic_circuit_current" : "mdi:sine-wave", - "switch.enable_idle_current" : "mdi:current-dc", - "sensor.in_current" : "mdi:sine-wave", - "switch.is_enabled" : "mdi:power", - "sensor.max_charger_current" : "mdi:sine-wave", - "sensor.max_circuit_current" : "mdi:sine-wave", - "binary_sensor.online" : "mdi:wifi", - "sensor.output_current" : "mdi:sine-wave", - "sensor.reason_for_no_current" : "mdi:alert-circle", - "sensor.session_energy" : "mdi:flash", - "sensor.energy_per_hour" : "mdi:flash", - "switch.smart_charging" : "mdi:auto-fix", - "sensor.total_power" : "mdi:flash", - "binary_sensor.update_available" : "mdi:file-download", - "sensor.voltage" : "mdi:sine-wave", - -} - export const CURRENTLIMITS = [8.0, 10.0, 16.0, 20.0, 25.0, 32.0]; - -export const DEFAULT_CUSTOMCARDTHEME = "theme_default"; +export const DEFAULT_CUSTOMCARDTHEME = 'theme_default'; export const CUSTOM_CARD_THEMES = [ - {name: "theme_default", desc: "Default (HA)"}, - {name: "theme_transp_blue", desc: "Transparent Blue"}, - {name: "theme_transp_black", desc: "Transparent Black"}, - {name: "theme_lightgrey_blue", desc: "LightGrey Blue"} + { name: 'theme_default', desc: 'Default (HA)' }, + { name: 'theme_transp_blue', desc: 'Transparent Blue' }, + { name: 'theme_transp_black', desc: 'Transparent Black' }, + { name: 'theme_lightgrey_blue', desc: 'LightGrey Blue' }, ]; - -export const STATE_BUTTONS = [ - {state: "PAUSED", img: imageGeneric}, -]; +export const STATE_BUTTONS = [{ state: 'PAUSED', img: imageGeneric }]; diff --git a/src/translations/en.json b/src/translations/en.json index d3251b3..7c6ce35 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -1,11 +1,11 @@ { "status": { - "STANDBY": "Standby", - "PAUSED": "Paused", - "CHARGING": "Charging", - "READY_TO_CHARGE": "Ready to charge", - "ERROR": "Error", - "CAR_CONNECTED": "Car connected" + "disconnected": "Disconnected", + "awaiting_start": "Paused or awaiting start", + "charging": "Charging", + "completed": "Completed or awaiting car", + "error": "Error", + "ready_to_charge": "Ready to charge" }, "common": { "name": "Charger Card", @@ -43,7 +43,7 @@ "show_stats_aria_label_off": "Toggle display data table off", "show_collapsibles": "Show collapsible menu buttons", "show_collapsibles_aria_label_on": "Toggle display collapsible menus on", - "show_collapsibles_aria_label_off": "Toggle display collapsible menus off", + "show_collapsibles_aria_label_off": "Toggle display collapsible menus off", "show_toolbar": "Show Toolbar", "show_toolbar_aria_label_on": "Toggle display toolbar on", "show_toolbar_aria_label_off": "Toggle display toolbar off", diff --git a/src/translations/nb.json b/src/translations/nb.json index de9c94b..5cd0951 100644 --- a/src/translations/nb.json +++ b/src/translations/nb.json @@ -1,11 +1,11 @@ { "status": { - "STANDBY": "Ventemodus", - "PAUSED": "Pause", - "CHARGING": "Lader", - "READY_TO_CHARGE": "Klar til lading", - "ERROR": "Feil", - "CAR_CONNECTED": "Bil tilkoblet" + "disconnected": "Frakoblet", + "awaiting_start": "Pauset eller venter på start", + "charging": "Lader", + "completed": "Fullført eller venter på bil", + "error": "Feil", + "ready_to_charge": "Klar til lading" }, "common": { "name": "Charger Card", @@ -43,7 +43,7 @@ "show_stats_aria_label_off": "Toggle display data table off", "show_collapsibles": "Vis sammenslåbare menyvalg", "show_collapsibles_aria_label_on": "Toggle display collapsible menus on", - "show_collapsibles_aria_label_off": "Toggle display collapsible menus off", + "show_collapsibles_aria_label_off": "Toggle display collapsible menus off", "show_toolbar": "Vis verktøylinje", "show_toolbar_aria_label_on": "Toggle display toolbar on", "show_toolbar_aria_label_off": "Toggle display toolbar off",