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

Master 1.0.0 beta #53

Closed
wants to merge 158 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
158 commits
Select commit Hold shift + click to select a range
e2d17d9
add URI links clean binary sensors and sensors
jontofront Nov 21, 2023
f908106
api changes
jontofront Nov 21, 2023
be1a166
fix letter
jontofront Nov 21, 2023
c54f8a4
fix to test
jontofront Nov 22, 2023
aa67464
another fix
jontofront Nov 22, 2023
857c406
add precision add translation structure
jontofront Nov 22, 2023
585c9e3
add keys
jontofront Nov 22, 2023
fbfa52f
add reg params keys
jontofront Nov 24, 2023
0020160
add one more sensors
jontofront Nov 24, 2023
9bfd278
ass unit from constant
jontofront Nov 24, 2023
43634c0
Testing out new way of creating entities from nedpoint
KirilKurkianec Nov 24, 2023
fc82696
Merge pull request #22 from jontofront/Feature-rewrite-endpoint-and-l…
jontofront Nov 24, 2023
2baa1f7
fix error
jontofront Nov 24, 2023
2fa69d2
Rewriting param maps, continuye from MODE
KirilKurkianec Dec 2, 2023
9c7ff80
add constants and fix code style
jontofront Dec 4, 2023
486f9f0
add 2 sensors in constant
jontofront Dec 4, 2023
ba6356b
gathered all sensors in mapp, performed some refactoring
KirilKurkianec Dec 8, 2023
6a27171
ruff style check fix
jontofront Dec 9, 2023
bbac10c
Merge branch 'Feature-rewrite-endpoint-and-logic-extended' of https:/…
jontofront Dec 9, 2023
02a6c13
Merge pull request #40 from jontofront/Feature-rewrite-endpoint-and-l…
jontofront Dec 9, 2023
484971c
Fixing issue whe coordinator keys not in sync with entity keys
KirilKurkianec Dec 11, 2023
eb8e396
Merge pull request #41 from jontofront/Feature-rewrite-endpoint-and-l…
jontofront Dec 11, 2023
e22eb66
fix translation and add process val lamba
jontofront Dec 11, 2023
5df2ba3
add name
jontofront Dec 11, 2023
a7957f3
fix some const
jontofront Dec 11, 2023
0af7a04
Made alterations to some code
KirilKurkianec Dec 11, 2023
95290c3
Merge pull request #42 from jontofront/Feature-rewrite-endpoint-and-l…
jontofront Dec 11, 2023
309d9cc
restore da_key in logger
jontofront Dec 11, 2023
31904b8
change and add reg param precision
jontofront Dec 11, 2023
cc3ddb5
add changes
jontofront Dec 11, 2023
30af718
add more keys to test
jontofront Dec 11, 2023
6744b95
add more keys
jontofront Dec 11, 2023
8812a10
add device class diagnostic
jontofront Dec 11, 2023
926b9b7
Hassfest for custom components
jontofront Dec 12, 2023
05684bc
change sort of manifes
jontofront Dec 12, 2023
60fe8a3
rename translation boilerpower key
jontofront Dec 12, 2023
525c814
change boiler_Power to boiler_power
jontofront Dec 12, 2023
639ad16
translate for debug
jontofront Dec 12, 2023
3c738eb
Black styling
KirilKurkianec Dec 12, 2023
3189fdd
Added function for converting camle to snake case
KirilKurkianec Dec 12, 2023
af12f6e
Merge pull request #43 from jontofront/Feature-rewrite-endpoint-and-l…
jontofront Dec 12, 2023
a324836
tranlation fix
jontofront Dec 13, 2023
9e554f0
fix line 44 column 1
jontofront Dec 13, 2023
5d8bf11
O to o
jontofront Dec 13, 2023
b37a51a
testing translation
jontofront Dec 13, 2023
7de6868
test
jontofront Dec 15, 2023
67cb370
fix translations
denpamusic Dec 15, 2023
0a54d09
Merge pull request #44 from denpaforks/dev-1.0.0-beta
jontofront Dec 20, 2023
a614fb3
add logger for create entity description
jontofront Dec 20, 2023
daa62d6
add logger for create sensor descritpion
jontofront Dec 20, 2023
d2aadd5
remove 'name'
jontofront Dec 20, 2023
f6334bf
black
jontofront Dec 20, 2023
848f111
Print out the values of key, map_key, and REG_PARAM_MAP
jontofront Dec 20, 2023
5364964
add self.entity_description to logger
jontofront Dec 20, 2023
fb3c564
last code for translation investigation
jontofront Dec 20, 2023
61c381c
fix inheritance in entity classes
denpamusic Dec 21, 2023
6a818e2
use property decorator
denpamusic Dec 21, 2023
26781c8
Merge pull request #45 from denpaforks/dev-1.0.0-beta
jontofront Dec 21, 2023
5a3f8ba
oerder sensor description by sugestion VSC template
jontofront Dec 21, 2023
0b3bd51
add Icons to sensors
jontofront Dec 21, 2023
6e4710e
save work
jontofront Dec 21, 2023
6028d5a
add translations in translation file
jontofront Dec 21, 2023
cdfbe8e
Invalid translations/en.json: Invalid translation key 'servoMixer1'
jontofront Dec 21, 2023
ff97fa3
add lamda proces for status_wifi and main_server
jontofront Dec 21, 2023
f375b6e
add binary sensors keys for developing binary_sensor from api
jontofront Dec 21, 2023
f6f9e1a
save project
jontofront Dec 21, 2023
b2f0618
s
jontofront Dec 21, 2023
1978b4c
separrate Binary sensors and sensors map keys
jontofront Dec 21, 2023
b9865d4
VSC error save
jontofront Dec 21, 2023
1c9df5b
rename constants
jontofront Dec 22, 2023
90920f3
add read binary_sensor from api key
jontofront Dec 22, 2023
bee56ad
fix small code
jontofront Dec 22, 2023
cc650a6
Bity of clean up, also moved camel case function to seperate file for…
KirilKurkianec Dec 22, 2023
939039c
Merge pull request #46 from jontofront/dev-1.0.0-beta-kirkur
jontofront Dec 22, 2023
156d413
fix common import
jontofront Dec 22, 2023
7f6da23
add debug lines
jontofront Dec 22, 2023
d7ecbdc
add EN translations and debug lines fo binary sensors
jontofront Dec 22, 2023
bb9b45c
sync strings.json
denpamusic Dec 23, 2023
02e5811
add strings for boiler mode
denpamusic Dec 23, 2023
3355517
add strings for lambda status
denpamusic Dec 23, 2023
87a6976
fix binary sensor issue
denpamusic Dec 24, 2023
8e4058c
fix typo
denpamusic Dec 24, 2023
0926101
reverse data lookup
denpamusic Dec 24, 2023
ef76f65
Merge pull request #47 from denpaforks/dev-1.0.0-beta
jontofront Dec 25, 2023
a735ac1
Merge pull request #48 from denpaforks/binary_sensor_fix
jontofront Dec 25, 2023
78df040
add entity logger.debug
jontofront Dec 25, 2023
df64799
update info in Readme file
jontofront Dec 25, 2023
e66c1cb
add pictures to readme
jontofront Dec 25, 2023
7c4c955
replace pictures
jontofront Dec 25, 2023
29c4ccf
fix png extension
jontofront Dec 25, 2023
2a09295
add
jontofront Dec 25, 2023
481f898
update Readme contributing
jontofront Dec 25, 2023
7ea3b91
add image link
jontofront Dec 25, 2023
f8199cc
thanks
jontofront Dec 25, 2023
ec00dd3
fix name :)
jontofront Dec 25, 2023
1c03378
add hacs badge
jontofront Dec 25, 2023
11ef1e4
fix wifi and thermostat sensors
jontofront Dec 25, 2023
7bd93f3
add server icon
jontofront Dec 26, 2023
a606650
add HACS Action
jontofront Dec 26, 2023
16277e5
test hasfet action status
jontofront Dec 26, 2023
c2e120c
change extension
jontofront Dec 26, 2023
9873d31
add number for set boiler temp.
jontofront Jan 8, 2024
155d9e5
comment in const
jontofront Nov 20, 2023
150c1c3
change depricated HA TEMP_CELSIUS constant
jontofront Nov 25, 2023
c30d8b2
add sensor precision
jontofront Nov 25, 2023
c28c2dc
add translansion keys
jontofront Nov 25, 2023
206a1ad
Added translations for the sensors
jontofront Nov 25, 2023
7314c8e
add strings
jontofront Nov 25, 2023
dcedb92
recovery names to sensor
jontofront Nov 25, 2023
971a187
add nubmer.py
jontofront Nov 29, 2023
fbb1c7c
done
jontofront Nov 29, 2023
a08fbc0
changes
jontofront Nov 29, 2023
b112202
fix number.py file location
jontofront Nov 29, 2023
72c27c8
updated version and uses f-strings
jontofront Nov 29, 2023
b50c60c
configuration project stylke formating from HA
jontofront Nov 30, 2023
385091b
refactor api.py by Ruff warnings
jontofront Nov 30, 2023
4a98294
fix number.py by Ruff
jontofront Nov 30, 2023
78c4bf7
covert to Fstring change style by HA Ruff
jontofront Nov 30, 2023
33580ac
common.py by Ruff change
jontofront Nov 30, 2023
f64a481
Update Changelog
jontofront Nov 30, 2023
8d76841
z
jontofront Nov 30, 2023
05359b7
change link to repo
jontofront Dec 5, 2023
891273c
stile fix by Ruff
jontofront Dec 3, 2023
6fdc071
Rename `pumpCO` binary_sensor name to `Boiler pump`
jontofront Dec 3, 2023
4aad384
Add `HUW temperature` sensor key `tempCWUSet`
jontofront Dec 3, 2023
6f65e50
update readme by disclaimer
jontofront Dec 4, 2023
b2c2fcf
add constant tempCWUSet
jontofront Dec 4, 2023
4d531fc
organise imports
jontofront Dec 4, 2023
f2b311e
add docstring
jontofront Dec 4, 2023
eca63ce
add mixer set temp. sensor
jontofront Dec 4, 2023
0ba9e2b
fix
jontofront Dec 4, 2023
de07e83
organise import
jontofront Dec 4, 2023
d23048a
Added Upper buffer temperature
jontofront Dec 4, 2023
5f5f95e
Update CHANGELOG.md
jontofront Dec 4, 2023
abfde0d
add name for mixer
jontofront Dec 5, 2023
0e7c8fc
rename set temp
jontofront Dec 5, 2023
545c2f8
edit pyrpject
jontofront Dec 5, 2023
8891d4f
remove plugins
jontofront Dec 5, 2023
a29fd11
small fix before clean testing
jontofront Dec 5, 2023
d45f41a
rename mixe pump
jontofront Dec 5, 2023
a953904
rollback entity bad used parameters
jontofront Dec 5, 2023
cb75e88
add alarms constants for future
jontofront Dec 8, 2023
2b6aabc
rename translation keys by recomendation ha
jontofront Dec 13, 2023
1ced4c0
add ver change log
jontofront Dec 14, 2023
f0a8c2c
for testing returning translation key
jontofront Dec 20, 2023
a2ad6c6
translation_key is not None, use translation key, If translation_key…
jontofront Dec 20, 2023
46dd65e
Add boilerPowerKW sensor #50
jontofront Jan 8, 2024
d1054d5
Making preparations for master MERGE
KirilKurkianec Jan 10, 2024
dd5966d
Merge branch 'master' into dev-1.0.0.beta_to_master
KirilKurkianec Jan 10, 2024
85d9eb5
Fixes for mixer
KirilKurkianec Jan 10, 2024
f52871b
Merge pull request #51 from jontofront/dev-1.0.0.beta_to_master
jontofront Jan 11, 2024
7a5a4e8
api.py code style fix by ruff
jontofront Jan 11, 2024
85e4868
remove dublicate funkcion
jontofront Jan 11, 2024
cac9834
fix
jontofront Jan 11, 2024
46065f5
Small fix code stykle ruff
jontofront Jan 11, 2024
d24822b
Clean up
jontofront Jan 12, 2024
fc98ade
Minor Fixes
KirilKurkianec Jan 15, 2024
a777347
Merge branch 'master' into master-1.0.0-beta
KirilKurkianec Jan 15, 2024
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
17 changes: 17 additions & 0 deletions .github/workflows/hacs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: HACS Action

on:
push:
pull_request:
schedule:
- cron: "0 0 * * *"

jobs:
hacs:
name: HACS Action
runs-on: "ubuntu-latest"
steps:
- name: HACS Action
uses: "hacs/action@main"
with:
category: "integration"
14 changes: 14 additions & 0 deletions .github/workflows/hassfest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Validate with hassfest

on:
push:
pull_request:
schedule:
- cron: "0 0 * * *"

jobs:
validate:
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v3"
- uses: home-assistant/actions/hassfest@master
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
__pycache__
draft
.idea/
.vscode/*
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@
"files.associations": {
"*.yaml": "home-assistant"
},
}
"editor.formatOnSave": true,
"editor.defaultFormatter": "ms-python.black-formatter",
"python.globalModuleInstallation": false,
}
43 changes: 35 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@ Due to a stall on the original [pblxptr/ecoNET-300-Home-Assistant-Integration](h
Most of the work was done by pblxpt, for which we're very thankful as the community.

# ecoNET300 Home Assistant integration

[![Code_formatter](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![hacs_badge](https://img.shields.io/badge/HACS-Default-41BDF5.svg)](https://github.com/hacs/integration)
[![HACS Action](https://github.com/jontofront/ecoNET-300-Home-Assistant-Integration/actions/workflows/hacs.yml/badge.svg)](https://github.com/jontofront/ecoNET-300-Home-Assistant-Integration/actions/workflows/hacs.yml)
[![stability-alpha](https://img.shields.io/badge/stability-alpha-f4d03f.svg)](https://guidelines.denpa.pro/stability#alpha)
[![Validate with hassfest](https://github.com/jontofront/ecoNET-300-Home-Assistant-Integration/actions/workflows/hassfest.yaml/badge.svg)](https://github.com/jontofront/ecoNET-300-Home-Assistant-Integration/actions/workflows/hassfest.yaml)

<div align="center">

| Home Assistant | ecoNET300 |
| --------------- | ------------- |
| <img src="https://raw.githubusercontent.com/jontofront/ecoNET-300-Home-Assistant-Integration/master/images/ha.png" width="100" height="100" /> | <img src="https://raw.githubusercontent.com/jontofront/ecoNET-300-Home-Assistant-Integration/master/images/econet.webp" width="95" height="95" /> |
| Home Assistant | ecoNET300 | device |
| --------------- | ------------- | ------------- |
| <img src="images/ha.png" width="100" height="100" /> | <img src="images/econet.webp" width="95" height="95" /> | <img src="images/econet300_device.jpg" width="100" height="100" /> |

</div>

Expand All @@ -21,10 +28,24 @@ It works locally, which means it connects directly to your local device using lo

This integration is available from the Lovelace frontend without the need to configure the devices in the file configuration.yaml

Integration tested with ecoMAX controller ecoMAX810P-L TOUCH manufactured by [Plum Sp. z o.o.](https://www.plum.pl/)

**Bear in mind that the project is in a very early, pre-alpha phase.**

Plans for first relase:
- support for some of readonly properties (like mixer temp, ext sensor temp)
## versions
* v0.3.3 - version is stable. Most of the work was done by @pblxpt, for which we're very thankful as the community.
* v1.0.0_beta - is a new dev integration version that fetches more data from API, I don't know yet if it will be better or worse :). It's my first work.


## Example
Here is an example setup showing econet300 device entities:

<div align="center">


<img src="images/sensors.png" />

</div>

## HACS Installation ##
Follow [this guide](https://hacs.xyz/docs/faq/custom_repositories/) to add ecoNET-300-Home-Assistant-Integration as a custom repository to the HACS.
Expand Down Expand Up @@ -105,11 +126,17 @@ __Password__: Local password (NOT the password that you use to login to econet24
- Fan (fanWorks)
- Feeder (fanWorks)

## Contribution
## Contributing

This is HA integration open-source project. We are always open to people who want to use the code or contribute to it.


I work on this project only in my very-limited free time. At this moment I have opened a few other projects which are on a bit higher priority than this one, but I'm going to work on this quite regularlly as I use it in my home automation. However, if you want to help and contribute to this project **it will be highly appreciated.**
### Contributors
Many thanks to @denpamusic for his help and pointing me in the right direction

Also if you see a need for a particular feature, don't hesitate to let me know.
<a href="https://github.com/jontofront/ecoNET-300-Home-Assistant-Integration/graphs/contributors">
<img src="https://contrib.rocks/image?repo=jontofront/ecoNET-300-Home-Assistant-Integration" />
</a>

---
## DISCLAIMER
Expand Down
80 changes: 40 additions & 40 deletions custom_components/econet300/api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Module provides the API functionality for ecoNET-300 Home Assistant Integration."""
"""Econet300 API class class describint methods of getting and setting data."""
import asyncio
from http import HTTPStatus
import logging
Expand All @@ -12,8 +12,8 @@
from .const import (
API_EDITABLE_PARAMS_LIMITS_DATA,
API_EDITABLE_PARAMS_LIMITS_URI,
API_REG_PARAMS_PARAM_DATA,
API_REG_PARAMS_URI,
API_REG_PARAMS_DATA_PARAM_DATA,
API_REG_PARAMS_DATA_URI,
API_SYS_PARAMS_PARAM_HW_VER,
API_SYS_PARAMS_PARAM_SW_REV,
API_SYS_PARAMS_PARAM_UID,
Expand All @@ -34,7 +34,7 @@ def map_param(param_name):


class Limits:
"""Construct all the necessary attributes for the Limits object."""
"""Class difining entity value set limits."""

def __init__(self, min_v: float, max_v: float):
"""Construct the necessary attributes for the Limits object."""
Expand All @@ -58,7 +58,7 @@ class DataError(Exception):


class EconetClient:
"""Client for interacting with the ecoNET-300 API."""
"""Econet client class."""

def __init__(
self, host: str, username: str, password: str, session: ClientSession
Expand All @@ -77,28 +77,20 @@ def __init__(
self._session = session
self._auth = BasicAuth(username, password)

def host(self):
"""Get the host."""
@property
def host(self) -> str:
"""Get host address."""
return self._host

async def set_param(self, key: str, value: str):
"""Set a parameter."""
url = f"{self._host}/econet/rmCurrNewParam?newParamKey={key}&newParamValue={value}"

return await self._get(url)
"""Set a parameter via API call."""
return await self._get(
f"{self._host}/econet/rmCurrNewParam?newParamKey={key}&newParamValue={value}"
)

async def get_params(self, reg: str):
"""Get parameters for a given registry.

Args:
reg (str): The registry to retrieve parameters from.

Returns:
dict: The parameters retrieved from the registry.
"""
url = f"{self._host}/econet/{reg}"

return await self._get(url)
"""Call for getting api param."""
return await self._get(f"{self._host}/econet/{reg}")

async def _get(self, url):
attempt = 1
Expand All @@ -112,7 +104,7 @@ async def _get(self, url):
if resp.status == HTTPStatus.UNAUTHORIZED:
raise AuthError

elif resp.status != HTTPStatus.OK:
if resp.status != HTTPStatus.OK:
return None

return await resp.json()
Expand All @@ -124,6 +116,11 @@ async def _get(self, url):
attempt += 1


def get_param_id(name: str):
"""Check if param is mapped and return its value."""
return lambda name=name: EDITABLE_PARAMS_MAPPING_TABLE.get(name, None)


class Econet300Api:
"""Client for interacting with the ecoNET-300 API."""

Expand All @@ -137,30 +134,34 @@ def __init__(self, client: EconetClient, cache: MemCache) -> None:

@classmethod
async def create(cls, client: EconetClient, cache: MemCache):
"""Create an instance of Econet300Api."""
"""Create and return initial object."""
c = cls(client, cache)
await c.init()

return c

def host(self):
"""Get the host."""
return self._client.host()
@property
def host(self) -> str:
"""Get clients host address."""
return self._client.host

@property
def uid(self) -> str:
"""Get the UID."""
"""Get uid."""
return self._uid

@property
def sw_rev(self) -> str:
"""Get the software revision."""
# Set a parameter value via the Econet 300 API.
"""Get software version."""
return self._sw_revision

@property
def hw_ver(self) -> str:
"""Get the hardware version."""
"""Get hardware version."""
return self._hw_version

async def init(self):
"""Initialize the Econet300Api."""
"""Econet300 Api initilization."""
sys_params = await self._client.get_params(API_SYS_PARAMS_URI)

if API_SYS_PARAMS_PARAM_UID not in sys_params:
Expand Down Expand Up @@ -188,8 +189,8 @@ async def init(self):
self._hw_version = sys_params[API_SYS_PARAMS_PARAM_HW_VER]

async def set_param(self, param, value) -> bool:
"""Set a parameter value via the Econet 300 API."""
param_idx = map_param(param)
"""Set param value in Econet300 API."""
param_idx = get_param_id(param)
if param_idx is None:
_LOGGER.warning(
"Requested param set for: '{param}' but mapping for this param does not exist"
Expand Down Expand Up @@ -217,7 +218,7 @@ async def get_param_limits(self, param: str):
self._cache.set(API_EDITABLE_PARAMS_LIMITS_DATA, limits)

limits = self._cache.get(API_EDITABLE_PARAMS_LIMITS_DATA)
param_idx = map_param(param)
param_idx = get_param_id(param)

if param_idx is None:
_LOGGER.warning(
Expand All @@ -238,12 +239,11 @@ async def get_param_limits(self, param: str):
return Limits(curr_limits["min"], curr_limits["max"])

async def fetch_data(self) -> dict[str, Any]:
"""Fetch merged reg_params and sys_params data."""
"""Fetch data from regParamsData."""
reg_params = await self._fetch_reg_key(
API_REG_PARAMS_URI, API_REG_PARAMS_PARAM_DATA
API_REG_PARAMS_DATA_URI, API_REG_PARAMS_DATA_PARAM_DATA
)
sys_params = await self._fetch_reg_key(API_SYS_PARAMS_URI)
return {**reg_params, **sys_params}
return reg_params

async def _fetch_reg_key(self, reg, data_key: str | None = None):
"""Fetch a key from the json-encoded data returned by the API for a given registry If key is None, then return whole data."""
Expand All @@ -263,7 +263,7 @@ async def _fetch_reg_key(self, reg, data_key: str | None = None):


async def make_api(hass: HomeAssistant, cache: MemCache, data: dict):
"""Create an Econet 300 API instance."""
"""Create api object."""
return await Econet300Api.create(
EconetClient(
data["host"],
Expand Down
Loading