Skip to content

Commit

Permalink
Friendly Model Names
Browse files Browse the repository at this point in the history
  • Loading branch information
AzonInc committed Oct 26, 2024
1 parent d587e00 commit 10105dc
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 37 deletions.
24 changes: 12 additions & 12 deletions components/tc_bus/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,18 +80,18 @@

MODEL = tc_bus_ns.enum("Model")
MODELS = {
"NONE": MODEL.MODEL_NONE,
"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
"None": MODEL.MODEL_NONE,
"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
48 changes: 23 additions & 25 deletions components/tc_bus/protocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,19 +478,17 @@ namespace esphome

Model string_to_model(std::string str)
{
std::transform(str.begin(), str.end(), str.begin(), ::toupper);

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;
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 @@ -499,18 +497,18 @@ namespace esphome
{
switch (model)
{
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";
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";
}
}
} // namespace tc_bus
Expand Down

0 comments on commit 10105dc

Please sign in to comment.