From 24739534d47385b049ade062b936d04a9cd51512 Mon Sep 17 00:00:00 2001 From: Eduard Carreras Date: Wed, 25 Oct 2023 14:32:02 +0200 Subject: [PATCH] Utilitzar tipus element per saber interruptor --- libcnmc/cir_8_2021/FB2_2.py | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/libcnmc/cir_8_2021/FB2_2.py b/libcnmc/cir_8_2021/FB2_2.py index a1c15b45..728381d3 100644 --- a/libcnmc/cir_8_2021/FB2_2.py +++ b/libcnmc/cir_8_2021/FB2_2.py @@ -11,17 +11,6 @@ from libcnmc.utils import format_f from libcnmc.core import StopMultiprocessBased -TIPUS_INST = { - 'TI-174': 1, - 'TI-187': 1, - 'TI-182': 1, - 'TI-183': 1, - 'TI-187A': 1, - 'TI-179': 0, - 'TI-177': 0, - 'TI-181': 2, - 'TI-102V': 0, -} class FB2_2(StopMultiprocessBased): """ @@ -115,7 +104,7 @@ def get_tipus_inst(self, ti_cnmc_id): def consumer(self): o = self.connection fields_to_read = [ - 'installacio', 'name', 'propietari', 'data_pm', 'cini', 'tipus_instalacio_cnmc_id' + 'installacio', 'name', 'propietari', 'data_pm', 'cini', 'tipus_element' ] while True: try: @@ -138,8 +127,9 @@ def consumer(self): o_propietari = int(celles['propietari']) if o_propietari == 0: o_maquina = '' - o_interruptor = self.get_tipus_inst(celles['tipus_instalacio_cnmc_id']) - o_interruptor_val = TIPUS_INST[o_interruptor] + o_interruptor_val = o.model('giscedata.celles.tipus.element').read( + celles['tipus_element'][0], ['interruptor'] + )['interruptor'] o_data = '' if celles['data_pm']: