Skip to content

Commit

Permalink
Merge pull request #22 from mbillow/ha-upgrades
Browse files Browse the repository at this point in the history
Update HA Setup Call and Fix Monetary Sensor Device Classes
  • Loading branch information
mbillow authored Feb 17, 2023
2 parents 9619e3a + 259306d commit 7b3fe8a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion custom_components/chargepoint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ async def async_update_data(is_retry: bool = False):
await coordinator.async_config_entry_first_refresh()

# Setup components
hass.config_entries.async_setup_platforms(entry, PLATFORMS)
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)

return True

Expand Down
2 changes: 1 addition & 1 deletion custom_components/chargepoint/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
NAME = "ChargePoint"
DOMAIN = "chargepoint"
DOMAIN_DATA = f"{DOMAIN}_data"
VERSION = "0.3.0"
VERSION = "0.4.0"
ATTRIBUTION = "Data provided by https://www.chargepoint.com"
ISSUE_URL = "https://github.com/mbillow/ha-chargepoint/issues"

Expand Down
2 changes: 1 addition & 1 deletion custom_components/chargepoint/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
],
"config_flow": true,
"issue_tracker": "https://github.com/mbillow/ha-chargepoint/issues",
"version": "0.3.1",
"version": "0.4.0",
"iot_class": "cloud_polling"
}
4 changes: 2 additions & 2 deletions custom_components/chargepoint/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def native_value(self):
icon="mdi:wallet",
device_class=SensorDeviceClass.MONETARY,
unit=lambda entity: entity.account.account_balance.currency,
state_class=SensorStateClass.MEASUREMENT,
state_class=SensorStateClass.TOTAL,
value=lambda entity: f"{float(entity.account.account_balance.amount):.2f}",
),
]
Expand Down Expand Up @@ -227,7 +227,7 @@ def native_value(self):
key="session_cost",
name_suffix="Charge Cost",
icon="mdi:cash-multiple",
state_class=SensorStateClass.TOTAL_INCREASING,
state_class=SensorStateClass.TOTAL,
device_class=SensorDeviceClass.MONETARY,
value=lambda entity: f"{entity.session.total_amount:.2f}"
if entity.session
Expand Down

0 comments on commit 7b3fe8a

Please sign in to comment.