132 """Entity name → the role it plays, for every entity config can name."""
133 labels: dict[str, str] = {}
134 boards = cfg.get(
"boards")
or {}
135 if not isinstance(boards, dict):
140 for key, board
in boards.items():
141 if not isinstance(board, dict):
143 prefix = _ENTITY_PREFIX.get(board.get(
"type"))
144 board_id = board.get(
"board_id")
145 if prefix
is None or not isinstance(board_id, int):
148 roles = cfg.get(f
"sensor_roles_{key}")
or {}
149 if not isinstance(roles, dict):
151 for role, ch
in roles.items():
152 if not isinstance(ch, int):
154 labels[f
"{prefix}{n}.CH{ch}"] = role
155 labels[f
"{prefix}{n}_Cal.CH{ch}"] = role
160 for key, board
in boards.items():
161 if not isinstance(board, dict)
or board.get(
"type") !=
"T7":
163 board_id = board.get(
"board_id")
164 channels = board.get(
"channels")
165 if not isinstance(board_id, int)
or not isinstance(channels, list):
170 if not isinstance(ch, dict)
or not isinstance(ch.get(
"ain"), int):
172 has_tc = has_tc
or ch.get(
"kind") ==
"TC"
173 role = ch.get(
"role")
174 if isinstance(role, str)
and role:
175 labels[f
"T7{n}.AIN{ch['ain']}"] = role
176 labels[f
"T7{n}_Cal.AIN{ch['ain']}"] = role
178 name = display.get(board_id, f
"T7 {board_id}")
179 labels[f
"T7{n}.AIN{T7_CJC_AIN}"] = f
"{name} internal sensor"
180 labels[f
"T7{n}.CJC"] = f
"{name} cold junction"
189 for b
in boards.values()
190 if isinstance(b, dict)
and b.get(
"type") ==
"BALL_VALVE"
192 for role, spec
in (cfg.get(
"actuator_roles")
or {}).items():
193 if not isinstance(spec, list)
or len(spec) < 2
or not isinstance(spec[1], int):
196 board_id = spec[2]
if len(spec) >= 3
and isinstance(spec[2], int)
else 11
198 if board_id
in ball_valve_ids:
199 labels[f
"BV{n}.CH{ch}"] = role
200 labels[f
"BV{n}_Cal.CH{ch}"] = role
201 labels[f
"BV_CMD.B{n}.CH{ch}"] = role
203 labels[f
"ACT{n}.CH{ch}"] = role
204 labels[f
"ACT{n}_Cal.CH{ch}"] = role
205 labels[f
"ACT_CMD.B{n}.CH{ch}"] = role
209 labels[f
"BOARD.HB_{board_id}"] = name
210 labels[f
"SELF_TEST.BOARD_{board_id}"] = name