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:
Morten Trab 2019-11-16 09:45:43 +01:00 committed by Martin Hjelmare
parent 5e20817ea4
commit cd335bd434
2 changed files with 7 additions and 8 deletions

View File

@ -108,7 +108,7 @@ def has_all_unique_names(value):
SENSOR_TYPES = {
# Type, Unit, Icon
# Type, Unit, Icon, post
"bed_temperature": ["temperature", TEMP_CELSIUS, "mdi:thermometer", "_bed_"],
"extruder_temperature": [
"temperature",
@ -248,12 +248,12 @@ class PrinterAPI:
if prop_data is None:
continue
for idx, _ in enumerate(prop_data):
info["temp_id"] = idx
sensor_info.append(info)
prop_info = info.copy()
prop_info["temp_id"] = idx
sensor_info.append(prop_info)
else:
info["temp_id"] = None
sensor_info.append(info)
self._known_entities.add(known)
if not sensor_info:

View File

@ -35,11 +35,10 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
printer_id = info["printer_id"]
sensor_type = info["sensor_type"]
temp_id = info["temp_id"]
name = info["name"]
name = f"{info['name']}{SENSOR_TYPES[sensor_type][3]}"
if temp_id is not None:
name = "{}{}{}".format(name, SENSOR_TYPES[sensor_type][3], temp_id)
else:
name = "{}{}".format(name, SENSOR_TYPES[sensor_type][3])
_LOGGER.debug("%s Temp_id: %s", sensor_type, temp_id)
name = f"{name}{temp_id}"
sensor_class = sensor_map[sensor_type]
entity = sensor_class(api, temp_id, name, printer_id, sensor_type)
entities.append(entity)