Skip to content

Commit

Permalink
Add Naema 2 Micro 25 and map more entities
Browse files Browse the repository at this point in the history
  • Loading branch information
guizmo authored and guizmo committed Feb 12, 2024
1 parent d9f4757 commit 6cd3a2f
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 25 deletions.
11 changes: 10 additions & 1 deletion custom_components/cozytouch/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
"""The Atlantic Cozytouch integration."""
from __future__ import annotations

import voluptuous as vol

from homeassistant.config_entries import ConfigEntry
from homeassistant.const import Platform
from homeassistant.core import HomeAssistant
import homeassistant.helpers.config_validation as cv

from . import hub
from .const import DOMAIN
from .const import CONF_DUMPJSON, DOMAIN

PLATFORMS: list[Platform] = [
Platform.BINARY_SENSOR,
Expand All @@ -16,6 +19,12 @@
Platform.CLIMATE,
]

CONFIG_SCHEMA = vol.Schema(
{DOMAIN: vol.Schema({vol.Optional(CONF_DUMPJSON): cv.boolean})},
extra=vol.ALLOW_EXTRA,
)


async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
"""Set up Atlantic Cozytouch from a config entry."""
theHub = hub.Hub(hass, entry.data["username"], entry.data["password"])
Expand Down
82 changes: 64 additions & 18 deletions custom_components/cozytouch/capability.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,6 @@

def get_capability_infos(modelId: int, capabilityId: int) -> {}:
"""Get capabilities for a device."""
if modelId == 235:
return get_capability_infos_navilink(capabilityId)

return None


def get_capability_infos_navilink(capabilityId: int) -> {}:
"""Get capabilities for a Navilink device."""
modelId = 235

if capabilityId == 7:
return {
"modelId": modelId,
Expand All @@ -30,6 +20,38 @@ def get_capability_infos_navilink(capabilityId: int) -> {}:
"type": "temperature",
"category": "sensor",
}
elif capabilityId == 25:
return {
"modelId": modelId,
"name": "Number of starts CH pump",
"type": "int",
"category": "diag",
"icon": "mdi:water-pump",
}
elif capabilityId == 26:
return {
"modelId": modelId,
"name": "Number of starts DHW pump",
"type": "int",
"category": "diag",
"icon": "mdi:water-pump",
}
elif capabilityId == 28:
return {
"modelId": modelId,
"name": "Number of hours CH pump",
"type": "int",
"category": "diag",
"icon": "mdi:water-pump",
}
elif capabilityId == 29:
return {
"modelId": modelId,
"name": "Number of hours DHW pump",
"type": "int",
"category": "diag",
"icon": "mdi:water-pump",
}
elif capabilityId == 40:
return {
"modelId": modelId,
Expand Down Expand Up @@ -95,6 +117,14 @@ def get_capability_infos_navilink(capabilityId: int) -> {}:
"value_off": "0",
"value_on": "2",
}
elif capabilityId == 153:
return {
"modelId": modelId,
"name": "Flame",
"type": "binary",
"category": "sensor",
"icon": "mdi:fire",
}
elif capabilityId == 154:
return {
"modelId": modelId,
Expand All @@ -106,14 +136,6 @@ def get_capability_infos_navilink(capabilityId: int) -> {}:
elif capabilityId in (160, 161):
# Target temperature adjustment limits
return {}
elif capabilityId == 184:
return {
"modelId": modelId,
"name": "Time Control",
"type": "switch",
"category": "sensor",
"icon": "mdi:clock-outline",
}
elif capabilityId == 172:
return {
"modelId": modelId,
Expand All @@ -123,6 +145,14 @@ def get_capability_infos_navilink(capabilityId: int) -> {}:
"lowestValueCapabilityId": 160,
"highestValueCapabilityId": 161,
}
elif capabilityId == 184:
return {
"modelId": modelId,
"name": "Time Control",
"type": "switch",
"category": "sensor",
"icon": "mdi:clock-outline",
}
elif capabilityId == 219:
return {
"modelId": modelId,
Expand Down Expand Up @@ -150,5 +180,21 @@ def get_capability_infos_navilink(capabilityId: int) -> {}:
"category": "diag",
"icon": "mdi:tag",
}
elif capabilityId == 100402:
return {
"modelId": modelId,
"name": "Number of hours burner",
"type": "int",
"category": "diag",
"icon": "mdi:fire",
}
elif capabilityId == 100406:
return {
"modelId": modelId,
"name": "Number of starts burner",
"type": "int",
"category": "diag",
"icon": "mdi:fire",
}

return None
2 changes: 2 additions & 0 deletions custom_components/cozytouch/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@
COZYTOUCH_CLIENT_ID = (
"Q3RfMUpWeVRtSUxYOEllZkE3YVVOQmpGblpVYToyRWNORHpfZHkzNDJVSnFvMlo3cFNKTnZVdjBh"
)

CONF_DUMPJSON = "dumpJSON"
3 changes: 1 addition & 2 deletions custom_components/cozytouch/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@
"config_flow": true,
"documentation": "https://github.com/gduteil/cozytouch",
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/gduteil/cozytouch/issues",
"version": "0.1.0"
}
}
6 changes: 4 additions & 2 deletions custom_components/cozytouch/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

def get_model_name_from_id(modelId: int) -> str:
"""Return name from model ID."""
if modelId == 235:
return "Navilink 128 Radio-Connect"
if modelId == 56:
return "Naema 2 Micro 25"
elif modelId == 235:
return "Thermostat Navilink Connect"

return "Unknown product (" + str(modelId) + ")"
5 changes: 3 additions & 2 deletions custom_components/cozytouch/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ async def async_setup_entry(
if "icon" in capability:
icon = capability["icon"]

if capability["type"] == "string":
if capability["type"] in ("string", "int"):
# Use a RegularStrSensor for integers
sensors.append(
RegularStrSensor(
deviceId=capability["deviceId"],
Expand Down Expand Up @@ -134,7 +135,7 @@ async def async_setup_entry(
timestamp_index=1,
)
)
elif capability["type"] == "switch":
elif capability["type"] in ("switch", "binary"):
value_off = "0"
if "value_off" in capability:
value_off = capability["value_off"]
Expand Down

0 comments on commit 6cd3a2f

Please sign in to comment.