Skip to content
This repository has been archived by the owner on Jul 12, 2023. It is now read-only.

integrate to pyduke-energy 1.0.0 #53

Merged
merged 1 commit into from
Dec 18, 2021
Merged
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
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ If you want to install manually, you can install dev dependencies with `pip inst

Before commiting, run `pre-commit run --all-files`.

### Working With In Development `pyduke-energy` Versions

If you are working on implementing new changes from `pyduke-energy` but do not want to release version of that library, you can set up your development environment to install from a remote working branch.

1. Update [`requirements_dev.txt`](requirements_dev.txt) to replace the `main` in `git+https://github.com/mjmeli/pyduke-energy@main` with your working branch and update the username if you have a fork (e.g. `git+https://github.com/notmjmeli/pyduke-energy@new-feature-dev-branch`)
2. Uninstall locally cached version of `pyduke-energy`: `pip uninstall -y pyduke-energy`
3. Re-run requirements installation: `pip install -r requirements_dev.txt`

## Contributions are welcome!

If you want to contribute to this please read the [Contribution guidelines](CONTRIBUTING.md)
Expand Down
2 changes: 1 addition & 1 deletion custom_components/duke_energy_gateway/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
if unloaded:
hass.data[DOMAIN].pop(entry.entry_id)

# Cleanup real-time stream if it wasn't already done so (it should already be done by the sensor entity)
# Cleanup real-time stream if it wasn't already done so (it should be done by the sensor entity)
_LOGGER.debug("Checking for clean-up of real-time stream in async_unload_entry")
coordinator.realtime_cancel()
coordinator.async_realtime_unsubscribe_all_from_dispatcher()
Expand Down
6 changes: 3 additions & 3 deletions custom_components/duke_energy_gateway/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ async def _async_update_data(self):
def realtime_initialize(self):
"""Setup callbacks, connect, and subscribe to the real-time usage MQTT stream."""
try:
self.realtime.on_msg = self._realtime_on_msg
self.realtime.on_message = self._realtime_on_message
self.realtime_task = asyncio.create_task(
self.realtime.connect_and_subscribe()
self.realtime.connect_and_subscribe_forever()
)
_LOGGER.debug("Triggered real-time connect/subscribe async task")
except Exception as exception:
Expand All @@ -81,7 +81,7 @@ def realtime_cancel(self):
self.realtime_task = None
_LOGGER.debug("Cancelled real-time async task")

def _realtime_on_msg(self, msg):
def _realtime_on_message(self, msg):
"""Handler for the real-time usage MQTT messages."""
try:
measurement = self.realtime.msg_to_usage_measurement(msg)
Expand Down
4 changes: 2 additions & 2 deletions custom_components/duke_energy_gateway/manifest.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"domain": "duke_energy_gateway",
"name": "Duke Energy Gateway",
"version": "0.1.0b8",
"version": "0.1.0b9",
"documentation": "https://github.com/mjmeli/ha-duke-energy-gateway",
"issue_tracker": "https://github.com/mjmeli/ha-duke-energy-gateway/issues",
"dependencies": [],
"config_flow": true,
"codeowners": ["@mjmeli"],
"requirements": ["pyduke-energy==0.0.15"],
"requirements": ["pyduke-energy==1.0.0"],
"iot_class": "cloud_polling"
}