Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove deprecations #100

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/hassfest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ jobs:
validate:
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- uses: "actions/checkout@v3"
- uses: home-assistant/actions/hassfest@master
82 changes: 41 additions & 41 deletions custom_components/goecharger/sensor.py
Original file line number Diff line number Diff line change
@@ -1,69 +1,69 @@
"""Platform for go-eCharger sensor integration."""
import logging
from homeassistant.const import (
TEMP_CELSIUS,
ENERGY_KILO_WATT_HOUR
PERCENTAGE,
UnitOfElectricCurrent,
UnitOfElectricPotential,
UnitOfEnergy,
UnitOfPower,
UnitOfTemperature,
)

from homeassistant import core, config_entries
from homeassistant.helpers.update_coordinator import CoordinatorEntity
from homeassistant.components.sensor import (
STATE_CLASS_TOTAL_INCREASING,
SensorDeviceClass,
SensorEntity
SensorEntity,
SensorStateClass
)


from .const import CONF_CHARGERS, DOMAIN, CONF_NAME, CONF_CORRECTION_FACTOR

AMPERE = 'A'
VOLT = 'V'
POWER_KILO_WATT = 'kW'
CARD_ID = 'Card ID'
PERCENT = '%'

_LOGGER = logging.getLogger(__name__)

_sensorUnits = {
'charger_temp': {'unit': TEMP_CELSIUS, 'name': 'Charger Temp'},
'charger_temp0': {'unit': TEMP_CELSIUS, 'name': 'Charger Temp 0'},
'charger_temp1': {'unit': TEMP_CELSIUS, 'name': 'Charger Temp 1'},
'charger_temp2': {'unit': TEMP_CELSIUS, 'name': 'Charger Temp 2'},
'charger_temp3': {'unit': TEMP_CELSIUS, 'name': 'Charger Temp 3'},
'p_l1': {'unit': POWER_KILO_WATT, 'name': 'Power L1'},
'p_l2': {'unit': POWER_KILO_WATT, 'name': 'Power L2'},
'p_l3': {'unit': POWER_KILO_WATT, 'name': 'Power L3'},
'p_n': {'unit': POWER_KILO_WATT, 'name': 'Power N'},
'p_all': {'unit': POWER_KILO_WATT, 'name': 'Power All'},
'current_session_charged_energy': {'unit': ENERGY_KILO_WATT_HOUR, 'name': 'Current Session charged'},
'current_session_charged_energy_corrected': {'unit': ENERGY_KILO_WATT_HOUR, 'name': 'Current Session charged corrected'},
'energy_total': {'unit': ENERGY_KILO_WATT_HOUR, 'name': 'Total Charged'},
'energy_total_corrected': {'unit': ENERGY_KILO_WATT_HOUR, 'name': 'Total Charged corrected'},
'charge_limit': {'unit': ENERGY_KILO_WATT_HOUR, 'name': 'Charge limit'},
'u_l1': {'unit': VOLT, 'name': 'Voltage L1'},
'u_l2': {'unit': VOLT, 'name': 'Voltage L2'},
'u_l3': {'unit': VOLT, 'name': 'Voltage L3'},
'u_n': {'unit': VOLT, 'name': 'Voltage N'},
'i_l1': {'unit': AMPERE, 'name': 'Current L1'},
'i_l2': {'unit': AMPERE, 'name': 'Current L2'},
'i_l3': {'unit': AMPERE, 'name': 'Current L3'},
'charger_max_current': {'unit': AMPERE, 'name': 'Charger max current setting'},
'charger_absolute_max_current': {'unit': AMPERE, 'name': 'Charger absolute max current setting'},
'charger_temp': {'unit': UnitOfTemperature.CELSIUS, 'name': 'Charger Temp'},
'charger_temp0': {'unit': UnitOfTemperature.CELSIUS, 'name': 'Charger Temp 0'},
'charger_temp1': {'unit': UnitOfTemperature.CELSIUS, 'name': 'Charger Temp 1'},
'charger_temp2': {'unit': UnitOfTemperature.CELSIUS, 'name': 'Charger Temp 2'},
'charger_temp3': {'unit': UnitOfTemperature.CELSIUS, 'name': 'Charger Temp 3'},
'p_l1': {'unit': UnitOfPower.KILO_WATT, 'name': 'Power L1'},
'p_l2': {'unit': UnitOfPower.KILO_WATT, 'name': 'Power L2'},
'p_l3': {'unit': UnitOfPower.KILO_WATT, 'name': 'Power L3'},
'p_n': {'unit': UnitOfPower.KILO_WATT, 'name': 'Power N'},
'p_all': {'unit': UnitOfPower.KILO_WATT, 'name': 'Power All'},
'current_session_charged_energy': {'unit': UnitOfEnergy.KILO_WATT_HOUR, 'name': 'Current Session charged'},
'current_session_charged_energy_corrected': {'unit': UnitOfEnergy.KILO_WATT_HOUR, 'name': 'Current Session charged corrected'},
'energy_total': {'unit': UnitOfEnergy.KILO_WATT_HOUR, 'name': 'Total Charged'},
'energy_total_corrected': {'unit': UnitOfEnergy.KILO_WATT_HOUR, 'name': 'Total Charged corrected'},
'charge_limit': {'unit': UnitOfEnergy.KILO_WATT_HOUR, 'name': 'Charge limit'},
'u_l1': {'unit': UnitOfElectricPotential.VOLT, 'name': 'Voltage L1'},
'u_l2': {'unit': UnitOfElectricPotential.VOLT, 'name': 'Voltage L2'},
'u_l3': {'unit': UnitOfElectricPotential.VOLT, 'name': 'Voltage L3'},
'u_n': {'unit': UnitOfElectricPotential.VOLT, 'name': 'Voltage N'},
'i_l1': {'unit': UnitOfElectricCurrent.AMPERE, 'name': 'Current L1'},
'i_l2': {'unit': UnitOfElectricCurrent.AMPERE, 'name': 'Current L2'},
'i_l3': {'unit': UnitOfElectricCurrent.AMPERE, 'name': 'Current L3'},
'charger_max_current': {'unit': UnitOfElectricCurrent.AMPERE, 'name': 'Charger max current setting'},
'charger_absolute_max_current': {'unit': UnitOfElectricCurrent.AMPERE, 'name': 'Charger absolute max current setting'},
'cable_lock_mode': {'unit': '', 'name': 'Cable lock mode'},
'cable_max_current': {'unit': AMPERE, 'name': 'Cable max current'},
'cable_max_current': {'unit': UnitOfElectricCurrent.AMPERE, 'name': 'Cable max current'},
'unlocked_by_card': {'unit': CARD_ID, 'name': 'Card used'},
'lf_l1': {'unit': PERCENT, 'name': 'Power factor L1'},
'lf_l2': {'unit': PERCENT, 'name': 'Power factor L2'},
'lf_l3': {'unit': PERCENT, 'name': 'Power factor L3'},
'lf_n': {'unit': PERCENT, 'name': 'Loadfactor N'},
'lf_l1': {'unit': PERCENTAGE, 'name': 'Power factor L1'},
'lf_l2': {'unit': PERCENTAGE, 'name': 'Power factor L2'},
'lf_l3': {'unit': PERCENTAGE, 'name': 'Power factor L3'},
'lf_n': {'unit': PERCENTAGE, 'name': 'Loadfactor N'},
'car_status': {'unit': '', 'name': 'Status'}
}

_sensorStateClass = {
'energy_total': STATE_CLASS_TOTAL_INCREASING,
'energy_total_corrected': STATE_CLASS_TOTAL_INCREASING,
'current_session_charged_energy': STATE_CLASS_TOTAL_INCREASING,
'current_session_charged_energy_corrected': STATE_CLASS_TOTAL_INCREASING
'energy_total': SensorStateClass.TOTAL_INCREASING,
'energy_total_corrected': SensorStateClass.TOTAL_INCREASING,
'current_session_charged_energy': SensorStateClass.TOTAL_INCREASING,
'current_session_charged_energy_corrected': SensorStateClass.TOTAL_INCREASING
}

_sensorDeviceClass = {
Expand Down