mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 02:37:08 +00:00
Fix Repetier integration entity indexing (#28766)
* Fixed multi extruder/beds/chambers index issue, #28130 * Switched from .format to f style name formatting * Fixed incorrect indexing * Removed VS files * Removed not need temp_id subtraction * Removed VS files * Fixed access mode * Fixed access mode * Fixing access mode - again
This commit is contained in:
parent
5e20817ea4
commit
cd335bd434
@ -108,7 +108,7 @@ def has_all_unique_names(value):
|
|||||||
|
|
||||||
|
|
||||||
SENSOR_TYPES = {
|
SENSOR_TYPES = {
|
||||||
# Type, Unit, Icon
|
# Type, Unit, Icon, post
|
||||||
"bed_temperature": ["temperature", TEMP_CELSIUS, "mdi:thermometer", "_bed_"],
|
"bed_temperature": ["temperature", TEMP_CELSIUS, "mdi:thermometer", "_bed_"],
|
||||||
"extruder_temperature": [
|
"extruder_temperature": [
|
||||||
"temperature",
|
"temperature",
|
||||||
@ -248,12 +248,12 @@ class PrinterAPI:
|
|||||||
if prop_data is None:
|
if prop_data is None:
|
||||||
continue
|
continue
|
||||||
for idx, _ in enumerate(prop_data):
|
for idx, _ in enumerate(prop_data):
|
||||||
info["temp_id"] = idx
|
prop_info = info.copy()
|
||||||
sensor_info.append(info)
|
prop_info["temp_id"] = idx
|
||||||
|
sensor_info.append(prop_info)
|
||||||
else:
|
else:
|
||||||
info["temp_id"] = None
|
info["temp_id"] = None
|
||||||
sensor_info.append(info)
|
sensor_info.append(info)
|
||||||
|
|
||||||
self._known_entities.add(known)
|
self._known_entities.add(known)
|
||||||
|
|
||||||
if not sensor_info:
|
if not sensor_info:
|
||||||
|
@ -35,11 +35,10 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||||||
printer_id = info["printer_id"]
|
printer_id = info["printer_id"]
|
||||||
sensor_type = info["sensor_type"]
|
sensor_type = info["sensor_type"]
|
||||||
temp_id = info["temp_id"]
|
temp_id = info["temp_id"]
|
||||||
name = info["name"]
|
name = f"{info['name']}{SENSOR_TYPES[sensor_type][3]}"
|
||||||
if temp_id is not None:
|
if temp_id is not None:
|
||||||
name = "{}{}{}".format(name, SENSOR_TYPES[sensor_type][3], temp_id)
|
_LOGGER.debug("%s Temp_id: %s", sensor_type, temp_id)
|
||||||
else:
|
name = f"{name}{temp_id}"
|
||||||
name = "{}{}".format(name, SENSOR_TYPES[sensor_type][3])
|
|
||||||
sensor_class = sensor_map[sensor_type]
|
sensor_class = sensor_map[sensor_type]
|
||||||
entity = sensor_class(api, temp_id, name, printer_id, sensor_type)
|
entity = sensor_class(api, temp_id, name, printer_id, sensor_type)
|
||||||
entities.append(entity)
|
entities.append(entity)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user