File tree Expand file tree Collapse file tree 2 files changed +16
-5
lines changed
Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,9 @@ def get_name(self, channel):
7575 """
7676 return self ._channel_names [channel ]
7777
78+ def get_module_type_name (self ):
79+ return self ._model_name
80+
7881 def get_type (self ):
7982 return self ._type
8083
Original file line number Diff line number Diff line change @@ -165,17 +165,25 @@ def get_counter_unit(self, channel):
165165 return None
166166
167167 def get_state (self , channel ):
168- val = None
169- if channel not in self ._unit :
170- return val
168+ val = 0
169+ # if we don't know the delay
170+ # or we don't know the unit
171+ # or the daly is the max value
172+ # we always return 0
173+ if (
174+ channel not in self ._delay
175+ or channel not in self ._unit
176+ or self ._delay [channel ] == 0xFFFF
177+ ):
178+ return round (0 , 2 )
171179 if self ._unit [channel ] == VOLUME_LITERS_HOUR :
172180 val = (1000 * 3600 ) / (self ._delay [channel ] * self ._pulses [channel ])
173181 elif self ._unit [channel ] == VOLUME_CUBIC_METER_HOUR :
174182 val = (1000 * 3600 ) / (self ._delay [channel ] * self ._pulses [channel ])
175183 elif self ._unit [channel ] == ENERGY_WATT_HOUR :
176184 val = (1000 * 1000 * 3600 ) / (self ._delay [channel ] * self ._pulses [channel ])
177- if val < 55 :
178- val = 0
185+ else :
186+ val = 0
179187 return round (val , 2 )
180188
181189 def get_class (self , channel ):
You can’t perform that action at this time.
0 commit comments