diff --git a/.github/workflows/constraints.txt b/.github/workflows/constraints.txt index 3032803..f37381d 100644 --- a/.github/workflows/constraints.txt +++ b/.github/workflows/constraints.txt @@ -1,5 +1,5 @@ pip==23.0.1 pre-commit==3.3.3 -black==23.3.0 +black==23.7.0 flake8==6.0.0 -reorder-python-imports==3.9.0 +reorder-python-imports==3.10.0 \ No newline at end of file diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index b692376..49f39a9 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -10,6 +10,6 @@ jobs: runs-on: ubuntu-latest steps: - name: Run release-drafter - uses: release-drafter/release-drafter@v5.23.0 + uses: release-drafter/release-drafter@v5.24.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index ef5e584..9d20eb9 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ [![Community Forum][forum-shield]][forum] myenergi custom component for [Home Assistant](https://home-assistant.io). -This component will make all [myenergi](https://myenergi.com) devices connected to your hub accessible in Home Assistant. +This component will make all supported [myenergi](https://myenergi.com) devices (libbi is not currently supported) connected to your hub accessible in Home Assistant. The energy sensors are fully compatible with the energy dashboard in Home Assistant. It will create HA devices depending on what you have installed: @@ -25,13 +25,13 @@ It will create HA devices depending on what you have installed: - Grid power sensor (W) - Grid voltage sensor (V) - Grid frequency sensor (Hz) - - Genertion power sensor (W) + - Generation power sensor (W) - Charging/heating power sensor (W) - - Home power today sensor (W), power that is not charging, heating, generation and export + - Home power today sensor (W); consumption - power that is not charging, heating, generation and export - Energy generated today sensor (kWh) - Energy exported today sensor (kWh) - Energy imported today sensor (kWh) - - Green energy today sensor (kWh), this is the amount of generated energy that was used for charging or heating instead of being exported + - Green energy today sensor (kWh); this is the amount of generated energy that was used for charging or heating instead of being exported - Zappi @@ -42,21 +42,29 @@ It will create HA devices depending on what you have installed: - Power sensors for internal and external CT clamps (W) - Plug status sensor - Charger status sensor - - Minumum green level number input + - Minumum green level number input; how much power must be sourced from green sources (local generation) to do diversion charging - Service to start boost (provide boost amount in kWh as parameter) - Service to start smart boost (provide boost amount in kWh and desired finished time as paramters) - Eddi + - Operating mode selector that let you switch between Stopped (no heating will take place) and Normal modes - Power sensors for internal and external CT clamps (W) - Temperature sensors if fitted - - service to start boost (provide boost amount in minutes as parameter) + - Service to start boost (provide boost amount in minutes as parameter) + - Heater priority; whether the first or second heater should be used first - Harvi - Power sensors for internal and external CT clamps (W) -Talking to the myenergi API using the [pymyenergi python library](https://github.com/cjne/pymyenergi) +Common sensor entities may also include: + +- Serial number +- Firmware version +- Device priority; used for deciding which gets power first + +This Home Assistant add-on talks to the myenergi API using the [pymyenergi python library](https://github.com/cjne/pymyenergi). **This component will set up the following platforms.** @@ -110,6 +118,8 @@ custom_components/myenergi/services.yaml If you have trouble logging in you might need to request an API key from myenergi. You can generate one at your [myenergi account page](https://myaccount.myenergi.com). See the [myenergi support article](https://support.myenergi.com/hc/en-gb/articles/5069627351185-How-do-I-get-an-API-key-) for more information. +If you need to change your API key for any reason, you will need to remove the device from "Integration entries", and re-add it again with the new API key. Historical data will not be lost. + ## Contributions are welcome! diff --git a/custom_components/myenergi/const.py b/custom_components/myenergi/const.py index a891445..a57e08e 100644 --- a/custom_components/myenergi/const.py +++ b/custom_components/myenergi/const.py @@ -6,7 +6,7 @@ VERSION = "0.0.23" ATTRIBUTION = "Data provided by myenergi" -ISSUE_URL = "https://github.com/cjne/myenergi/issues" +ISSUE_URL = "https://github.com/CJNE/ha-myenergi/issues" # Icons ICON = "mdi:format-quote-close" diff --git a/custom_components/myenergi/sensor.py b/custom_components/myenergi/sensor.py index e2c84ff..93f18b8 100644 --- a/custom_components/myenergi/sensor.py +++ b/custom_components/myenergi/sensor.py @@ -306,14 +306,6 @@ async def async_setup_entry(hass, entry, async_add_devices): # Sensors common to Zapi and Eddi if device.kind in [ZAPPI, EDDI]: - sensors.append( - MyenergiSensor( - coordinator, - device, - entry, - create_meta("Status", "status", None, None, None, "mdi:ev-station"), - ) - ) sensors.append( MyenergiSensor( coordinator, @@ -352,6 +344,14 @@ async def async_setup_entry(hass, entry, async_add_devices): ) # Zappi only sensors if device.kind == ZAPPI: + sensors.append( + MyenergiSensor( + coordinator, + device, + entry, + create_meta("Status", "status", None, None, None, "mdi:ev-station"), + ) + ) sensors.append( MyenergiSensor( coordinator, @@ -425,6 +425,14 @@ async def async_setup_entry(hass, entry, async_add_devices): ) elif device.kind == EDDI: # Eddi specifc sensors + sensors.append( + MyenergiSensor( + coordinator, + device, + entry, + create_meta("Status", "status", None, None, None, "mdi:shower"), + ) + ) sensors.append( MyenergiSensor( coordinator, @@ -433,6 +441,20 @@ async def async_setup_entry(hass, entry, async_add_devices): create_energy_meta("Energy consumed session", "consumed_session"), ) ) + sensors.append( + MyenergiSensor( + coordinator, + device, + entry, + create_meta("Active Heater", + "active_heater", + None, + None, + None, + "mdi:fraction-one-half", + ), + ) + ) if device.temp_1 != -1: sensors.append( MyenergiSensor( diff --git a/requirements_dev.txt b/requirements_dev.txt index e63749d..0b86cef 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,7 +1,7 @@ -pre-commit==3.2.2 -black==23.3.0 +pre-commit==3.3.3 +black==23.7.0 flake8==6.0.0 -reorder-python-imports==3.9.0 +reorder-python-imports==3.10.0 homeassistant pymyenergi -pytest +pytest \ No newline at end of file