mirror of
https://github.com/lumapu/ahoy.git
synced 2025-04-29 18:26:21 +02:00
Merge branch 'main' of https://github.com/grindylow/ahoy
This commit is contained in:
commit
e7d0e4ae66
3 changed files with 10 additions and 2 deletions
|
@ -268,7 +268,7 @@ if __name__ == '__main__':
|
|||
print('', end='', flush=True)
|
||||
|
||||
if loop_interval > 0 and (time.time() - t_loop_start) < loop_interval:
|
||||
time.sleep(time.time() % loop_interval)
|
||||
time.sleep(loop_interval - (time.time() - t_loop_start))
|
||||
|
||||
except KeyboardInterrupt:
|
||||
sys.exit()
|
||||
|
|
|
@ -46,6 +46,7 @@ class StatusResponse(Response):
|
|||
temperature = None
|
||||
frequency = None
|
||||
powerfactor = None
|
||||
event_count = None
|
||||
|
||||
def unpack(self, fmt, base):
|
||||
"""
|
||||
|
@ -120,6 +121,7 @@ class StatusResponse(Response):
|
|||
data['temperature'] = self.temperature
|
||||
data['frequency'] = self.frequency
|
||||
data['powerfactor'] = self.powerfactor
|
||||
data['event_count'] = self.event_count
|
||||
data['time'] = self.time_rx
|
||||
return data
|
||||
|
||||
|
@ -544,7 +546,7 @@ class Hm600Decode0B(StatusResponse):
|
|||
""" Inverter temperature in °C """
|
||||
return self.unpack('>H', 38)[0]/10
|
||||
@property
|
||||
def alarm_count(self):
|
||||
def event_count(self):
|
||||
""" Event counter """
|
||||
return self.unpack('>H', 40)[0]
|
||||
|
||||
|
@ -667,6 +669,10 @@ class Hm1200Decode0B(StatusResponse):
|
|||
def temperature(self):
|
||||
""" Inverter temperature in °C """
|
||||
return self.unpack('>H', 58)[0]/10
|
||||
@property
|
||||
def event_count(self):
|
||||
""" Event counter """
|
||||
return self.unpack('>H', 60)[0]
|
||||
|
||||
class Hm1200Decode11(EventsResponse):
|
||||
""" Inverter generic events log """
|
||||
|
|
|
@ -114,6 +114,8 @@ class InfluxOutputPlugin(OutputPluginFactory):
|
|||
data_stack.append(f'{measurement},string={string_id},type=current value={string["current"]:3f} {ctime}')
|
||||
string_id = string_id + 1
|
||||
# Global
|
||||
if data['event_count'] is not None:
|
||||
data_stack.append(f'{measurement},type=total_events value={data["event_count"]} {ctime}')
|
||||
if data['powerfactor'] is not None:
|
||||
data_stack.append(f'{measurement},type=pf value={data["powerfactor"]:f} {ctime}')
|
||||
data_stack.append(f'{measurement},type=frequency value={data["frequency"]:.3f} {ctime}')
|
||||
|
|
Loading…
Add table
Reference in a new issue