Skip to content

Commit

Permalink
Merge pull request #76 from jontofront/dev
Browse files Browse the repository at this point in the history
add ServoMix1 HA states
  • Loading branch information
jontofront authored Oct 16, 2024
2 parents b0645cf + b7177de commit 6cea62e
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 11 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,17 @@ Thank for @pblxptr add new code line from him
- Separated entity by types for better management
- Moved Mixer sensors to the Mixer sensor group and added icons

## [v1.0.3-beta] 2024-10-15
### Added
- Introduced new `ServoMixer1` state handling with predefined Home Assistant states (`STATE_OFF`, `STATE_CLOSING`, `STATE_OPENING`).
- Added logging for non-numeric values in sensor processing to improve debugging.

### Changed
- Updated `ENTITY_VALUE_PROCESSOR` to use predefined Home Assistant states for `ServoMixer1`.
- Improved error handling in `create_controller_sensors` to skip non-numeric values and log warnings.

### Fixed
- Fixed `ValueError` caused by non-numeric values in sensor state processing.
- Resolved Mypy type incompatibility issue in `STATE_CLASS_MAP` by removing the `servoMixer1` entry with `None` value.


31 changes: 22 additions & 9 deletions custom_components/econet300/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,20 @@
from homeassistant.const import (
PERCENTAGE,
SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
STATE_CLOSING,
STATE_OFF,
STATE_OPENING,
STATE_UNKNOWN,
EntityCategory,
UnitOfTemperature,
)

SERVO_MIXER_VALVE_HA_STATE: dict[int, str] = {
0: STATE_OFF,
1: STATE_CLOSING,
2: STATE_OPENING,
}

# Constant for the econet Integration integration
DOMAIN = "econet300"

Expand Down Expand Up @@ -44,7 +54,7 @@
## Mapunits for params data map API_RM_CURRENT_DATA_PARAMS_URI
API_RM_PARAMSUNITSNAMES_URI = "rmParamsUnitsNames"

## Boiler staus keys map
# Boiler staus keys map
# boiler mode names from endpoint http://LocalIP/econet/rmParamsEnums?
OPERATION_MODE_NAMES = {
0: "off",
Expand Down Expand Up @@ -86,14 +96,14 @@
}

###################################
######## NUMBER of AVAILABLE MIXERS
# NUMBER of AVAILABLE MIXERS
###################################
AVAILABLE_NUMBER_OF_MIXERS = 6
MIXER_AVAILABILITY_KEY = "mixerTemp"
MIXER_KEY = "mixerPumpWorks"

#######################
######## REG PARAM MAPS
# REG PARAM MAPS
#######################
SENSOR_MAP = {
"26": "tempFeeder",
Expand Down Expand Up @@ -221,7 +231,7 @@
"protocolType": None,
"controllerID": None,
"valveMixer1": None,
"servoMixer1": None,
"servoMixer1": SensorDeviceClass.ENUM,
"Status_wifi": None,
"main_server": None,
}
Expand All @@ -234,10 +244,11 @@
"tempCWUSet": NumberDeviceClass.TEMPERATURE,
}

#############################
# BINARY SENSORS
#############################

ENTITY_BINARY_DEVICE_CLASS_MAP = {
#############################
# BINARY SENSORS
#############################
"lighter": BinarySensorDeviceClass.RUNNING,
"weatherControl": BinarySensorDeviceClass.RUNNING,
"unseal": BinarySensorDeviceClass.RUNNING,
Expand Down Expand Up @@ -296,6 +307,8 @@
"mixerSetTemp": "mdi:thermometer",
"valveMixer1": "mdi:valve",
"mixerSetTemp1": "mdi:thermometer-chevron-up",
"servoMixer1": "mdi:valve",
"mixerTemp1": "mdi:thermometer",
}

ENTITY_ICON_OFF = {
Expand Down Expand Up @@ -324,10 +337,10 @@
),
"status_wifi": lambda x: "Connected" if x == 1 else "Disconnected",
"main_server": lambda x: "Server available" if x == 1 else "Server not available",
## TODO check HA status maybe there are somthink STATE_OFF, OPENING CLOSING
"servoMixer1": (lambda x: {0: "Off", 1: "closing", 2: "opening"}.get(x, "unknown")),
"servoMixer1": lambda x: SERVO_MIXER_VALVE_HA_STATE.get(x, STATE_UNKNOWN),
}


ENTITY_CATEGORY = {
"signal": EntityCategory.DIAGNOSTIC,
"quality": EntityCategory.DIAGNOSTIC,
Expand Down
2 changes: 1 addition & 1 deletion custom_components/econet300/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
"issue_tracker": "https://github.com/jontofront/ecoNET-300-Home-Assistant-Integration/issues",
"requirements": [],
"ssdp": [],
"version": "v1.0.2-beta",
"version": "v1.0.3-beta",
"zeroconf": []
}
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[tool.poetry]
name = "ecoNET-300-Home-Assistant-Integration"
version = "v1.0.2-beta"
version = "v1.0.3-beta"
description = "ecoNET300 Home Assistant integration"
authors = ["Jon <jontofront@gmail.com>"]
readme = "README.md"
Expand Down

0 comments on commit 6cea62e

Please sign in to comment.