Skip to content

Commit

Permalink
Bump version to 0.1.0 (#44)
Browse files Browse the repository at this point in the history
* update EntityDescriptions

* add initial tests for config_flow

* Add Sensor Descriptions

* Update changelog
  • Loading branch information
SukramJ authored Dec 19, 2021
1 parent 36922d0 commit 45013be
Show file tree
Hide file tree
Showing 12 changed files with 346 additions and 25 deletions.
4 changes: 3 additions & 1 deletion .idea/custom_homematic.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions custom_components/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Version 0.1.0 (2021-12-XX)
- Bump version to 0.1.0
- Update EntityDescriptions
- Add initial tests for config_flow
- Add Sensor Descriptions

Version 0.0.22.2 (2021-12-16)
- Add DE translation
- Update NL translation
Expand Down
2 changes: 1 addition & 1 deletion custom_components/hahm/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
hahomematic is a Python 3 module for Home Assistant to interact with
HomeMatic and homematic IP devices.
Homematic and Homematic IP devices.
https://github.com/danielperna84/hahomematic
"""
from __future__ import annotations
Expand Down
8 changes: 4 additions & 4 deletions custom_components/hahm/control_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ async def init_hub(self) -> None:
await self._central.init_hub()
if not self._central.hub:
return None
self._hub = HaHub(self._hass, cu=self, hm_hub=self._central.hub)
self._hub = HaHub(self._hass, control_unit=self, hm_hub=self._central.hub)
await self._hub.init()
hm_entities = (
[self._central.hub.hub_entities.values()] if self._central.hub else []
Expand Down Expand Up @@ -377,13 +377,13 @@ class HaHub(Entity):
"""The HomeMatic hub. (CCU2/HomeGear)."""

def __init__(
self, hass: HomeAssistant, cu: ControlUnit, hm_hub: HmHub | HmDummyHub
self, hass: HomeAssistant, control_unit: ControlUnit, hm_hub: HmHub | HmDummyHub
) -> None:
"""Initialize HomeMatic hub."""
self.hass = hass
self._cu: ControlUnit = cu
self._control: ControlUnit = control_unit
self._hm_hub: HmHub | HmDummyHub = hm_hub
self._name: str = self._cu.central.instance_name
self._name: str = self._control.central.instance_name
self.entity_id = f"{DOMAIN}.{slugify(self._name.lower())}"
self._hm_hub.register_update_callback(self._update_hub)

Expand Down
55 changes: 38 additions & 17 deletions custom_components/hahm/entity_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
SIGNAL_STRENGTH_DECIBELS,
SPEED_KILOMETERS_PER_HOUR,
TEMP_CELSIUS,
TIME_MINUTES,
VOLUME_CUBIC_METERS,
)
from homeassistant.helpers.entity import EntityDescription
Expand All @@ -44,22 +45,6 @@

_LOGGER = logging.getLogger(__name__)

HM_STATE_HA_CAST = {
"IPGarage": {0: "closed", 1: "open", 2: "ventilation", 3: None},
"RotaryHandleSensor": {0: "closed", 1: "tilted", 2: "open"},
"RotaryHandleSensorIP": {0: "closed", 1: "tilted", 2: "open"},
"WaterSensor": {0: "dry", 1: "wet", 2: "water"},
"CO2Sensor": {0: "normal", 1: "added", 2: "strong"},
"IPSmoke": {0: "off", 1: "primary", 2: "intrusion", 3: "secondary"},
"RFSiren": {
0: "disarmed",
1: "extsens_armed",
2: "allsens_armed",
3: "alarm_blocked",
},
"IPLockDLD": {0: None, 1: "locked", 2: "unlocked"},
}


_SENSOR_DESCRIPTIONS_BY_PARAM: dict[str, SensorEntityDescription] = {
"HUMIDITY": SensorEntityDescription(
Expand Down Expand Up @@ -180,23 +165,32 @@
"RAIN_COUNTER": SensorEntityDescription(
key="RAIN_COUNTER",
native_unit_of_measurement=LENGTH_MILLIMETERS,
icon="mdi:weather-rainy",
state_class=SensorStateClass.TOTAL_INCREASING,
),
"WIND_SPEED": SensorEntityDescription(
key="WIND_SPEED",
native_unit_of_measurement=SPEED_KILOMETERS_PER_HOUR,
icon="mdi:weather-windy",
state_class=SensorStateClass.MEASUREMENT,
),
"WIND_DIR": SensorEntityDescription(
key="WIND_DIR",
native_unit_of_measurement=DEGREE,
icon="mdi:windsock",
state_class=SensorStateClass.MEASUREMENT,
),
"WIND_DIR_RANGE": SensorEntityDescription(
key="WIND_DIR_RANGE",
native_unit_of_measurement=DEGREE,
icon="mdi:windsock",
state_class=SensorStateClass.MEASUREMENT,
),
"SUNSHINEDURATION": SensorEntityDescription(
key="SUNSHINEDURATION",
native_unit_of_measurement="#",
native_unit_of_measurement=TIME_MINUTES,
icon="mdi:weather-sunny",
state_class=SensorStateClass.TOTAL_INCREASING,
),
"AIR_PRESSURE": SensorEntityDescription(
key="AIR_PRESSURE",
Expand All @@ -207,42 +201,69 @@
"FREQUENCY": SensorEntityDescription(
key="FREQUENCY",
native_unit_of_measurement=FREQUENCY_HERTZ,
device_class=SensorDeviceClass.FREQUENCY,
state_class=SensorStateClass.MEASUREMENT,
),
"LEVEL": SensorEntityDescription(
key="LEVEL",
native_unit_of_measurement="#",
state_class=SensorStateClass.MEASUREMENT,
),
"VALUE": SensorEntityDescription(
key="VALUE",
native_unit_of_measurement="#",
state_class=SensorStateClass.MEASUREMENT,
),
"VALVE_STATE": SensorEntityDescription(
key="VALVE_STATE",
native_unit_of_measurement=PERCENTAGE,
icon="mdi:pipe-valve",
state_class=SensorStateClass.MEASUREMENT,
),
"CARRIER_SENSE_LEVEL": SensorEntityDescription(
key="CARRIER_SENSE_LEVEL",
native_unit_of_measurement=PERCENTAGE,
state_class=SensorStateClass.MEASUREMENT,
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
),
"DUTY_CYCLE_LEVEL": SensorEntityDescription(
key="DUTY_CYCLE_LEVEL",
native_unit_of_measurement=PERCENTAGE,
state_class=SensorStateClass.MEASUREMENT,
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
),
"BRIGHTNESS": SensorEntityDescription(
key="BRIGHTNESS",
native_unit_of_measurement="#",
state_class=SensorStateClass.MEASUREMENT,
icon="mdi:invert-colors",
),
"RSSI_DEVICE": SensorEntityDescription(
key="RSSI_DEVICE",
native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS,
state_class=SensorStateClass.MEASUREMENT,
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
),
"RSSI_PEER": SensorEntityDescription(
key="RSSI_PEER",
native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS,
state_class=SensorStateClass.MEASUREMENT,
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
),
"IP_ADDRESS": SensorEntityDescription(
key="IP_ADDRESS",
entity_category=ENTITY_CATEGORY_DIAGNOSTIC,
),
"SMOKE_DETECTOR_ALARM_STATUS": SensorEntityDescription(
key="SMOKE_DETECTOR_ALARM_STATUS",
icon="mdi:smoke-detector",
device_class="hahm__smoke_detector_alarm_status",
),
"LOCK_STATE": SensorEntityDescription(
key="LOCK_STATE",
icon="mdi:lock",
device_class="hahm__lock_state",
),
}

_SENSOR_DESCRIPTIONS_BY_DEVICE_PARAM: dict[tuple[str, str], SensorEntityDescription] = {
Expand Down
4 changes: 2 additions & 2 deletions custom_components/hahm/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
"config_flow": true,
"documentation": "https://github.com/danielperna84/custom_homematic",
"issue_tracker": "https://github.com/danielperna84/custom_homematic/issues",
"requirements": ["hahomematic==0.0.22"],
"requirements": ["hahomematic==0.1.0"],
"ssdp": [],
"zeroconf": [],
"homekit": {},
"dependencies": [],
"codeowners": ["@danielperna84", "@SukramJ"],
"iot_class": "local_push",
"version": "0.0.22.2"
"version": "0.1.0"
}
11 changes: 11 additions & 0 deletions custom_components/hahm/strings.sensor.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@
"CLOSED": "Closed",
"TILTED": "Tilted",
"OPEN": "Open"
},
"hahm__lock_state": {
"UNKNOWN": "Unknown",
"LOCKED": "Locked",
"UNLOCKED": "Unlocked"
},
"hahm__smoke_detector_alarm_status": {
"IDLE_OFF": "idle off",
"PRIMARY_ALARM": "Primary Alarm",
"INTRUSION_ALARM": "Intrusion Alarm",
"SECONDARY_ALARM": "Secondary Alarm"
}
}
}
11 changes: 11 additions & 0 deletions custom_components/hahm/translations/sensor.de.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@
"CLOSED": "Geschlossen",
"TILTED": "Gekippt",
"OPEN": "Offen"
},
"hahm__lock_state": {
"UNKNOWN": "Unbekannt",
"LOCKED": "Verriegelt",
"UNLOCKED": "Unverriegelt"
},
"hahm__smoke_detector_alarm_status": {
"IDLE_OFF": "untätig",
"PRIMARY_ALARM": "Primär-Alarm",
"INTRUSION_ALARM": "Einbruch-Alarm",
"SECONDARY_ALARM": "Sekundär-Alarm"
}
}
}
11 changes: 11 additions & 0 deletions custom_components/hahm/translations/sensor.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@
"CLOSED": "Closed",
"TILTED": "Tilted",
"OPEN": "Open"
},
"hahm__lock_state": {
"UNKNOWN": "Unknown",
"LOCKED": "Locked",
"UNLOCKED": "Unlocked"
},
"hahm__smoke_detector_alarm_status": {
"IDLE_OFF": "idle off",
"PRIMARY_ALARM": "Primary Alarm",
"INTRUSION_ALARM": "Intrusion Alarm",
"SECONDARY_ALARM": "Secondary Alarm"
}
}
}
11 changes: 11 additions & 0 deletions custom_components/hahm/translations/sensor.nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@
"CLOSED": "Gesloten",
"TILTED": "Gekanteld",
"OPEN": "Geopend"
},
"hahm__lock_state": {
"UNKNOWN": "Unknown",
"LOCKED": "Locked",
"UNLOCKED": "Unlocked"
},
"hahm__smoke_detector_alarm_status": {
"IDLE_OFF": "idle off",
"PRIMARY_ALARM": "Primary Alarm",
"INTRUSION_ALARM": "Intrusion Alarm",
"SECONDARY_ALARM": "Secondary Alarm"
}
}
}
5 changes: 5 additions & 0 deletions tests/hahm/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"""
hahomematic is a Python 3 module for Home Assistant to interact with
Homematic and Homematic IP devices.
https://github.com/danielperna84/hahomematic
"""
Loading

0 comments on commit 45013be

Please sign in to comment.