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

Reparation des energy meters #324

Closed
wants to merge 15 commits into from
Closed
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: 0 additions & 2 deletions .github/FUNDING.yml

This file was deleted.

8 changes: 4 additions & 4 deletions .github/workflows/constraints.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
black==24.3.0
pre-commit==3.7.0
pip==24.0
flake8==7.0.0
black==23.12.0
pre-commit==3.6.0
pip==23.3.1
flake8==6.1.0
reorder-python-imports==3.12.0
1 change: 1 addition & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- master

jobs:
labeler:
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ on:
push:
branches:
- main
- master
jobs:
draft_release:
name: Release Drafter
runs-on: ubuntu-latest
steps:
- name: Run release-drafter
uses: release-drafter/release-drafter@v6.0.0
uses: release-drafter/release-drafter@v5.25.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 2 additions & 3 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- master
- dev
pull_request:
schedule:
Expand All @@ -21,7 +22,7 @@ jobs:
uses: actions/checkout@v4

- name: Set up Python ${{ env.DEFAULT_PYTHON }}
uses: actions/setup-python@v5.1.0
uses: actions/setup-python@v5.0.0
with:
python-version: ${{ env.DEFAULT_PYTHON }}

Expand All @@ -35,8 +36,6 @@ jobs:
pip install --constraint=.github/workflows/constraints.txt pre-commit black flake8 reorder-python-imports

- name: Run pre-commit on all files
env:
SKIP: no-commit-to-branch
run: |
pre-commit run --all-files --show-diff-on-failure --color=always

Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ venv
.venv
.vscode
.DS_Store
.idea*
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ Contributing to this project should be as easy and transparent as possible, whet
- Submitting a fix
- Proposing new features

## GitHub is used for everything
## Github is used for everything

GitHub is used to host code, to track issues and feature requests, as well as accept pull requests.
Github is used to host code, to track issues and feature requests, as well as accept pull requests.

Pull requests are the best way to propose changes to the codebase.

Expand All @@ -23,9 +23,9 @@ Pull requests are the best way to propose changes to the codebase.

In short, when you submit code changes, your submissions are understood to be under the same [MIT License](http://choosealicense.com/licenses/mit/) that covers the project. Feel free to contact the maintainers if that's a concern.

## Report bugs using GitHub's [issues](../../issues)
## Report bugs using Github's [issues](../../issues)

GitHub's issues are used to track public bugs.
GitHub issues are used to track public bugs.
Report a bug by [opening a new issue](../../issues/new/choose); it's that easy!

## Write bug reports with detail, background, and sample code
Expand Down Expand Up @@ -55,7 +55,7 @@ People _love_ thorough bug reports. I'm not even kidding.
Use [black](https://github.com/ambv/black) to make sure the code follows the style.

Or use the `pre-commit` settings implemented in this repository
(see dedicated section below).
(see deicated section below).

## Test your code modification

Expand Down
113 changes: 8 additions & 105 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,12 @@ This is a beta release. There will be some bugs, issues, etc. Please bear with u
# Hilo
[Hilo](https://www.hydroquebec.com/hilo/en/) integration for Home Assistant

# :warning: Breaking change (v2024.2.2 and lower will become unusable)
Hilo's login will stop using "Resource Owner Password Flow" and start using "Authorization Code Flow with PKCE". A few weeks after this change, the current login method will be permanently closed and unusable.

## Introduction

This is the unofficial HACS Hilo integration for Home Assistant. [Hilo](https://www.hiloenergie.com/en-ca/) is a smart home platform developed
by an [Hydro Quebec](https://www.hydroquebec.com/hilo/en/) subsidiary.
This integration has no direct tie with Hilo or Hydro Quebec. This is a community initiative. Please don't contact
Hilo or Hydro-Quebec with issues with this Home Assistant integration, you can open an issue in the GitHub repository
Hilo or Hydro-Quebec with issues with this Home Assistant integration, you can open an issue in the github repository
instead.

If you want to help with the development of this integration, you can always submit a feedback form from the Hilo
Expand All @@ -47,7 +44,7 @@ rewrite it. Hilo is now pushing device readings via websocket from SignalR.
### Features
- Support for switches and dimmers as light devices
- Get current and set target temperature of thermostat
- Get energy usage of pretty much each device
- Get energy usage of pretty much each devices
- Generates energy meters and sensors
- Sensor for Hilo Events (challenges)
- Sensor for Hilo Gateway
Expand All @@ -64,11 +61,6 @@ rewrite it. Hilo is now pushing device readings via websocket from SignalR.

## Installation

### Step 0: Compatible install
This custom component requires that Hilo has carried out the install in your home. It will not be possible to set it up otherwise.

This custom component has been tested to work by various users on HA OS (as bare metal or VM), Docker with the official (ghcr.io) image and Podman. Other types of install may cause permissions issues during creation of a few files by the custom component.

### Step 1: Download files

#### Option 1: Via HACS
Expand All @@ -85,39 +77,13 @@ Download and copy the `custom_components/hilo` directory from the [latest releas
In HA, go to Settings > Devices & Services > Integrations.
In the bottom right corner, click the '+ ADD INTEGRATION' button.

![Add Integration](https://github.com/dvd-dev/hilo/assets/108159253/7906f2c9-9547-4478-a625-feaa68e62c5f)

If the component is properly installed, you should be able to find the 'Hilo integration' in the list. You might need to clear you browser cache for the integration to show up.

![Search Integration](https://github.com/dvd-dev/hilo/assets/108159253/1b560a73-042b-46cf-963c-98e5326e98e8)


## Configuration (new install)

The configuration is done in the UI. When you add the integration, you will be redirected to Hilo's website login page to authenticate.

![Open Website](https://github.com/dvd-dev/hilo/assets/108159253/23b4fb34-f8c3-40b3-8e01-b3e737cc9d44)


![Auth Hilo](https://github.com/dvd-dev/hilo/assets/108159253/e4e98b32-78d0-4c49-a2d7-3bd0ae95e9e0)

You must then accept to link your account. To do so, you must enter your Home Assistant instance's URL or IP address and click Link Account.
## Configuration

![Link](https://github.com/dvd-dev/hilo/assets/108159253/5eb945f7-fa5e-458f-b0fe-ef252aaadf93)

![Link URL](https://github.com/dvd-dev/hilo/assets/108159253/2c54df64-2e1c-423c-89cf-0eee8f0d4b7b)

After this, you will be prompted with assigning a room for each one of your devices.

## Configuration (update from a version earlier than v2024.3.1)

After update, you will get an error saying you must reauthenticate for the integration to work.

![Reconfiguration 2](https://github.com/dvd-dev/hilo/assets/108159253/a711d011-17a9-456f-abf6-74cf099014f1)

![Reath](https://github.com/dvd-dev/hilo/assets/108159253/70118e68-90b9-4667-b056-38ee2cd33133)

After correctly linking your account like in the previous section, you should see a popup telling you the reauthentification was sucessful.
The configuration is done in the UI. When you add the integration, you will be prompted with your
Hilo username and password. After this, you will be prompted with assigning a room for each one of
your devices.

### Energy meters

Expand Down Expand Up @@ -199,14 +165,6 @@ Other options are available under the `Configure` button in Home Assistant:
- `rate d`
- `flex d`

- `appreciation phase`: Integer (hours)

Add an appreciation phase of X hours before the preheat phase.

- `pre_cold phase`: Integer (hours)

Add a cooldown phase of X hours to reduce temperatures before the appreciation phase

- `Scan interval (min: 60s)`: Integer

Number of seconds between each device update. Defaults to 60 and it's not recommended to go below 30 as it might
Expand Down Expand Up @@ -248,69 +206,14 @@ logger:

If you have any kind of python/home-assistant experience and want to contribute to the code, feel free to submit a pull request.

### Prepare a dev environment in MacOS / Linux

1. Prepare necessary directories:
```console
$ HASS_DEV=~/hass-dev/
$ HASS_RELEASE=2023.12.3
$ mkdir -p ${HASS_DEV}/config
$ cd $HASS_DEV
$ git clone https://github.com/dvd-dev/hilo.git
$ git clone https://github.com/dvd-dev/python-hilo.git
$ git clone https://github.com/home-assistant/core.git
$ git --git-dir core/ checkout $HASS_RELEASE
```

**NOTE**: We also clone home-assistant's core to make it easier to add logging at that level [repo](https://github.com/home-assistant/core).

2. Launch the container:

```console
$ docker run -d -p 8123:8123 \
--name hass \
-v ${HASS_DEV}/config:/config \
-v ${HASS_DEV}/python-hilo/pyhilo:/usr/local/lib/python3.11/site-packages/pyhilo:ro \
-v ${HASS_DEV}/hilo/custom_components/hilo/:/config/custom_components/hilo:ro \
-v ${HASS_DEV}/core/homeassistant:/usr/src/homeassistant/homeassistant:ro \
homeassistant/home-assistant:$HASS_RELEASE
```

3. Check the container is running

```console
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
bace2264ee54 homeassistant/home-assistant:2023.12.3 "/init" 3 hours ago Up 28 minutes 0.0.0.0:8123->8123/tcp hass
```

4. Check home-assistant logs
```console
$ less ${HASS_DEV}/config/home-assistant.log
$ grep hilo ${HASS_DEV}/config/home-assistant.log
```

5. Activate debug logs

```console
$ cat << EOF >> ${HASS_DEV}/config/configuration.yaml
logger:
default: info
logs:
custom_components.hilo: debug
pyhilo: debug
EOF
$ docker restart hass
```

### Before submiting a Pull Request

It goes without saying you must test your modifications on your local install for problems. You may modify the .py files inside the following folder. Don't forget a backup!
```
custom_components/hilo
```

If you need to modify python-hilo for your tests, you can pull your own fork into Home Assistant with the following on the CLI:
If you need to modify python-hilo for your tests tests, you can pull your own fork into Home Assistant with the following on the CLI:

```
pip install -e git+https://github.com/YOUR_FORK_HERE/python-hilo.git#egg=python-hilo
Expand Down Expand Up @@ -344,7 +247,7 @@ git commit -m "I changed this because blabla"
```
git push
```
- At this point, if you visit the [upstream repository](https://github.com/dvd-dev/hilo), GitHub should prompt you to create a Pull Request (aka PR). Just follow the instructions.
- At this point, if you visit the [upstream repository](https://github.com/dvd-dev/hilo), Github should prompt you to create a Pull Request (aka PR). Just follow the instructions.

### Initial collaborators

Expand Down
Loading