Skip to content

Commit 9121225

Browse files
committed
Minor fixes
1 parent fa4f266 commit 9121225

3 files changed

Lines changed: 16 additions & 2 deletions

File tree

.github/scripts/merge_topics.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,27 @@ def main():
2020
translation_key = topic.get('short_id').replace('{', '').replace('}', '') # same as in common.py
2121
topic_name = topic.get('name')
2222
message_type = topic.get('message_type')
23+
is_adjustable_suffix = topic.get('is_adjustable_suffix')
24+
2325
# Extract the part after the dot and make it lower case
2426
if '.' in message_type:
2527
entity_type = message_type.split('.', 1)[1].lower()
2628
else:
2729
# Fallback for old format
2830
entity_type = message_type.lower()
31+
32+
# Add to original entity type
2933
if entity_type not in entity:
3034
entity[entity_type] = {}
3135
entity[entity_type][translation_key] = {"name": topic_name}
32-
count+=1
36+
count += 1
37+
38+
# If is_adjustable_suffix is set, also add to sensor entity type
39+
if is_adjustable_suffix is not None and entity_type != 'sensor':
40+
if 'sensor' not in entity:
41+
entity['sensor'] = {}
42+
entity['sensor'][translation_key] = {"name": topic_name}
43+
count += 1
3344
en['entity'] = entity
3445

3546
with open(en_path, 'w', encoding='utf-8') as f:

custom_components/victron_mqtt/hub.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def add_entities(self, async_add_entities: AddEntitiesCallback, kind: MetricKind
9696
if not sensor_metrics:
9797
continue
9898

99-
_LOGGER.info("Setting up sensors for device: %s. info: %s", device, info)
99+
_LOGGER.info("Setting up entities for device: %s. info: %s", device, info)
100100
for metric in sensor_metrics:
101101
_LOGGER.debug("Setting up entity: %s", repr(metric))
102102
sensor = self.creatre_entity(device, metric, info)

custom_components/victron_mqtt/translations/en.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@
146146
"inverter_output_apparent_power_phase": {
147147
"name": "Inverter output apparent power {phase}"
148148
},
149+
"inverter_current_limit": {
150+
"name": "Inverter current limit"
151+
},
149152
"system_critical_loads_phase": {
150153
"name": "Critical loads on {phase}"
151154
},

0 commit comments

Comments
 (0)