Skip to content

Commit

Permalink
Add Intercom Model Select
Browse files Browse the repository at this point in the history
  • Loading branch information
AzonInc committed Oct 18, 2024
1 parent 58e6ef1 commit 7806488
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 66 deletions.
22 changes: 11 additions & 11 deletions components/tc_bus/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,17 @@
MODEL = tc_bus_ns.enum("Model")
MODELS = {
"NONE": MODEL.MODEL_NONE,
"ISH_1030": MODEL.MODEL_ISH_1030,
"ISH_3030": MODEL.MODEL_ISH_3030,
"ISH_3230": MODEL.MODEL_ISH_3230,
"ISH_3340": MODEL.MODEL_ISH_3340,
"ISW_3030": MODEL.MODEL_ISW_3030,
"ISW_3230": MODEL.MODEL_ISW_3230,
"ISW_3340": MODEL.MODEL_ISW_3340,
"IVH_3222": MODEL.MODEL_IVH_3222,
"TC50": MODEL.MODEL_TC50,
"TCH50": MODEL.MODEL_TCH50,
"TCH50P": MODEL.MODEL_TCH50P
"TCS_ISH1030": MODEL.MODEL_TCS_ISH1030,
"TCS_ISH3030": MODEL.MODEL_TCS_ISH3030,
"TCS_ISH3230": MODEL.MODEL_TCS_ISH3230,
"TCS_ISH3340": MODEL.MODEL_TCS_ISH3340,
"TCS_ISW3030": MODEL.MODEL_TCS_ISW3030,
"TCS_ISW3230": MODEL.MODEL_TCS_ISW3230,
"TCS_ISW3340": MODEL.MODEL_TCS_ISW3340,
"TCS_IVH3222": MODEL.MODEL_TCS_IVH3222,
"KOCH_TC50": MODEL.MODEL_KOCH_TC50,
"KOCH_TCH50": MODEL.MODEL_KOCH_TCH50,
"KOCH_TCH50P": MODEL.MODEL_KOCH_TCH50P
}

CONF_TC_ID = "tc_bus"
Expand Down
44 changes: 22 additions & 22 deletions components/tc_bus/protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,17 +452,17 @@ namespace esphome
{
std::transform(str.begin(), str.end(), str.begin(), ::toupper);

if (str == "ISH_1030") return MODEL_ISH_1030;
if (str == "ISH_3030") return MODEL_ISH_3030;
if (str == "ISH_3230") return MODEL_ISH_3230;
if (str == "ISH_3340") return MODEL_ISH_3340;
if (str == "ISW_3030") return MODEL_ISW_3030;
if (str == "ISW_3230") return MODEL_ISW_3230;
if (str == "ISW_3340") return MODEL_ISW_3340;
if (str == "IVH_3222") return MODEL_IVH_3222;
if (str == "TC_50") return MODEL_TC_50;
if (str == "TCH_50") return MODEL_TCH_50;
if (str == "TCH_50_P") return MODEL_TCH_50_P;
if (str == "TCS_ISH1030") return MODEL_TCS_ISH1030;
if (str == "TCS_ISH3030") return MODEL_TCS_ISH3030;
if (str == "TCS_ISH3230") return MODEL_TCS_ISH3230;
if (str == "TCS_ISH3340") return MODEL_TCS_ISH3340;
if (str == "TCS_ISW3030") return MODEL_TCS_ISW3030;
if (str == "TCS_ISW3230") return MODEL_TCS_ISW3230;
if (str == "TCS_ISW3340") return MODEL_TCS_ISW3340;
if (str == "TCS_IVH3222") return MODEL_TCS_IVH3222;
if (str == "KOCH_TC50") return MODEL_KOCH_TC50;
if (str == "KOCH_TCH50") return MODEL_KOCH_TCH50;
if (str == "KOCH_TCH50P") return MODEL_KOCH_TCH50P;

return MODEL_NONE;
}
Expand All @@ -471,17 +471,17 @@ namespace esphome
{
switch (model)
{
case MODEL_ISH_1030: return "ISH_1030";
case MODEL_ISH_3030: return "ISH_3030";
case MODEL_ISH_3230: return "ISH_3230";
case MODEL_ISH_3340: return "ISH_3340";
case MODEL_ISW_3030: return "ISW_3030";
case MODEL_ISW_3230: return "ISW_3230";
case MODEL_ISW_3340: return "ISW_3340";
case MODEL_IVH_3222: return "IVH_3222";
case MODEL_TC_50: return "TC_50";
case MODEL_TCH_50: return "TCH_50";
case MODEL_TCH_50_P: return "TCH_50_P";
case MODEL_TCS_ISH1030: return "TCS_ISH1030";
case MODEL_TCS_ISH3030: return "TCS_ISH3030";
case MODEL_TCS_ISH3230: return "TCS_ISH3230";
case MODEL_TCS_ISH3340: return "TCS_ISH3340";
case MODEL_TCS_ISW3030: return "TCS_ISW3030";
case MODEL_TCS_ISW3230: return "TCS_ISW3230";
case MODEL_TCS_ISW3340: return "TCS_ISW3340";
case MODEL_TCS_IVH3222: return "TCS_IVH3222";
case MODEL_KOCH_TC50: return "KOCH_TC50";
case MODEL_KOCH_TCH50: return "KOCH_TCH50";
case MODEL_KOCH_TCH50P: return "KOCH_TCH50P";
default: return "NONE";
}
}
Expand Down
22 changes: 11 additions & 11 deletions components/tc_bus/protocol.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ namespace esphome
{
enum Model {
MODEL_NONE,
MODEL_ISH_1030,
MODEL_ISH_3030,
MODEL_ISH_3230,
MODEL_ISH_3340,
MODEL_ISW_3030,
MODEL_ISW_3230,
MODEL_ISW_3340,
MODEL_IVH_3222,
MODEL_TC_50,
MODEL_TCH_50,
MODEL_TCH_50_P
MODEL_TCS_ISH1030,
MODEL_TCS_ISH3030,
MODEL_TCS_ISH3230,
MODEL_TCS_ISH3340,
MODEL_TCS_ISW3030,
MODEL_TCS_ISW3230,
MODEL_TCS_ISW3340,
MODEL_TCS_IVH3222,
MODEL_KOCH_TC50,
MODEL_KOCH_TCH50,
MODEL_KOCH_TCH50P
};

enum SettingType {
Expand Down
22 changes: 11 additions & 11 deletions components/tc_bus/tc_bus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -712,15 +712,15 @@ namespace esphome

switch (model_)
{
case MODEL_ISH_3030:
case MODEL_ISH_3230:
case MODEL_ISH_3340:
case MODEL_ISW_3030:
case MODEL_ISW_3230:
case MODEL_ISW_3340:
case MODEL_TC_50:
case MODEL_TCH_50:
case MODEL_TCH_50P:
case MODEL_TCS_ISH3030:
case MODEL_TCS_ISH3230:
case MODEL_TCS_ISH3340:
case MODEL_TCS_ISW3030:
case MODEL_TCS_ISW3230:
case MODEL_TCS_ISW3340:
case MODEL_KOCH_TC50:
case MODEL_KOCH_TCH50:
case MODEL_KOCH_TCH50P:
switch (setting)
{
case SETTING_RINGTONE_DOOR_CALL:
Expand Down Expand Up @@ -752,7 +752,7 @@ namespace esphome
}
break;

case MODEL_ISH_1030:
case MODEL_TCS_ISH1030:
switch (setting)
{
case SETTING_RINGTONE_DOOR_CALL:
Expand All @@ -774,7 +774,7 @@ namespace esphome
}
break;

case MODEL_ISV_3222:
case MODEL_TCS_ISV3222:
switch (setting)
{
case SETTING_RINGTONE_DOOR_CALL:
Expand Down
22 changes: 11 additions & 11 deletions docs/en/reference/esphome-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -372,14 +372,14 @@ Here are the available settings for specific intercom phone models:

| Model | Available settings |
|------------------|------------------------------------------------------------------------------------------------------------|
| `ISH_1030` | `ringtone_floor_call`, `ringtone_door_call`, `ringtone_internal_call` |
| `ISH_3030` | `ringtone_floor_call`, `ringtone_door_call`, `ringtone_internal_call`, `volume_ringtone`, `volume_handset` |
| `ISH_3230` | `ringtone_floor_call`, `ringtone_door_call`, `ringtone_internal_call`, `volume_ringtone`, `volume_handset` |
| `ISH_3340` | `ringtone_floor_call`, `ringtone_door_call`, `ringtone_internal_call`, `volume_ringtone`, `volume_handset` |
| `ISW_3030` | `ringtone_floor_call`, `ringtone_door_call`, `ringtone_internal_call`, `volume_ringtone`, `volume_handset` |
| `ISW_3230` | `ringtone_floor_call`, `ringtone_door_call`, `ringtone_internal_call`, `volume_ringtone`, `volume_handset` |
| `ISW_3340` | `ringtone_floor_call`, `ringtone_door_call`, `ringtone_internal_call`, `volume_ringtone`, `volume_handset` |
| `IVH_3222` | `ringtone_floor_call`, `ringtone_door_call`, `ringtone_internal_call` |
| `TC_50` | `ringtone_floor_call`, `ringtone_door_call`, `ringtone_internal_call`, `volume_ringtone`, `volume_handset` |
| `TCH_50` | `ringtone_floor_call`, `ringtone_door_call`, `ringtone_internal_call`, `volume_ringtone`, `volume_handset` |
| `TCH_50_P` | `ringtone_floor_call`, `ringtone_door_call`, `ringtone_internal_call`, `volume_ringtone`, `volume_handset` |
| `TCS_ISH1030` | `ringtone_floor_call`, `ringtone_door_call`, `ringtone_internal_call` |
| `TCS_ISH3030` | `ringtone_floor_call`, `ringtone_door_call`, `ringtone_internal_call`, `volume_ringtone`, `volume_handset` |
| `TCS_ISH3230` | `ringtone_floor_call`, `ringtone_door_call`, `ringtone_internal_call`, `volume_ringtone`, `volume_handset` |
| `TCS_ISH3340` | `ringtone_floor_call`, `ringtone_door_call`, `ringtone_internal_call`, `volume_ringtone`, `volume_handset` |
| `TCS_ISW3030` | `ringtone_floor_call`, `ringtone_door_call`, `ringtone_internal_call`, `volume_ringtone`, `volume_handset` |
| `TCS_ISW3230` | `ringtone_floor_call`, `ringtone_door_call`, `ringtone_internal_call`, `volume_ringtone`, `volume_handset` |
| `TCS_ISW3340` | `ringtone_floor_call`, `ringtone_door_call`, `ringtone_internal_call`, `volume_ringtone`, `volume_handset` |
| `TCS_IVH3222` | `ringtone_floor_call`, `ringtone_door_call`, `ringtone_internal_call` |
| `KOCH_TC50` | `ringtone_floor_call`, `ringtone_door_call`, `ringtone_internal_call`, `volume_ringtone`, `volume_handset` |
| `KOCH_TCH50` | `ringtone_floor_call`, `ringtone_door_call`, `ringtone_internal_call`, `volume_ringtone`, `volume_handset` |
| `KOCH_TCH50P` | `ringtone_floor_call`, `ringtone_door_call`, `ringtone_internal_call`, `volume_ringtone`, `volume_handset` |
27 changes: 27 additions & 0 deletions firmware/addons/memory-utils.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,33 @@ number:
sorting_group_id: sorting_group_intercom_settings

select:
- platform: template
id: intercom_model
name: "Intercom Model"
icon: "mdi:cog"
options:
- "NONE"
- "TCS_ISH1030"
- "TCS_ISH3030"
- "TCS_ISH3230"
- "TCS_ISH3340"
- "TCS_ISW3030"
- "TCS_ISW3230"
- "TCS_ISW3340"
- "TCS_IVH3222"
- "KOCH_TC50"
- "KOCH_TCH50"
- "KOCH_TCH50P"
initial_option: "NONE"
on_value:
- lambda: "id(tc_bus_intercom)->set_model(string_to_model(x));"
optimistic: true
restore_value: true
entity_category: CONFIG
disabled_by_default: true
web_server:
sorting_group_id: sorting_group_intercom_settings

- platform: template
id: intercom_ringtone_door_call
name: "Ringtone: Door Call"
Expand Down

0 comments on commit 7806488

Please sign in to comment.