Skip to content

Commit

Permalink
enocean: fix shift errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Morg42 committed Nov 14, 2024
1 parent 940af3a commit 698064a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions enocean/protocol/eep_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def _parse_eep_A5_07_03(self, payload, status):
self.logger.error(f"Occupancy sensor issued error code: {payload[0]}")
else:
result['SVC'] = payload[0] / 255.0 * 5.0 # supply voltage in volts
result['ILL'] = payload[1] << 2 + (payload[2] & 0xC0) >> 6 # 10 bit illumination in lux
result['ILL'] = (payload[1] << 2) + ((payload[2] & 0xC0) >> 6) # 10 bit illumination in lux
result['PIR'] = (payload[3] & 0x80) == 0x80 # Movement flag, 1:motion detected
self.logger.debug(f"Occupancy: PIR:{result['PIR']} illumination: {result['ILL']}lx, voltage: {result['SVC']}V")
return result
Expand Down Expand Up @@ -240,7 +240,7 @@ def _parse_eep_A5_12_01(self, payload, status):
self.logger.debug("Processing A5_12_01: powermeter: Unit is Watts")
else:
self.logger.debug("Processing A5_12_01: powermeter: Unit is kWh")
value = (payload[0] << 16 + payload[1] << 8 + payload[2]) / divisor
value = ((payload[0] << 16) + (payload[1] << 8) + payload[2]) / divisor
self.logger.debug(f"Processing A5_12_01: powermeter: {value} W")

# It is confirmed by Eltako that with the use of multiple repeaters in an Eltako network, values can be corrupted in random cases.
Expand Down Expand Up @@ -326,7 +326,7 @@ def _parse_eep_A5_38_08(self, payload, status):
def _parse_eep_A5_3F_7F(self, payload, status):
self.logger.debug("Processing A5_3F_7F")
results = {'DI_3': (payload[3] & 1 << 3) == 1 << 3, 'DI_2': (payload[3] & 1 << 2) == 1 << 2, 'DI_1': (payload[3] & 1 << 1) == 1 << 1, 'DI_0': (payload[3] & 1 << 0) == 1 << 0}
results['AD_0'] = ((payload[1] & 0x03) << 8 + payload[2]) * 1.8 / pow(2, 10)
results['AD_0'] = (((payload[1] & 0x03) << 8) + payload[2]) * 1.8 / pow(2, 10)
results['AD_1'] = (payload[1] >> 2) * 1.8 / pow(2, 6)
results['AD_2'] = payload[0] * 1.8 / pow(2, 8)
return results
Expand Down

0 comments on commit 698064a

Please sign in to comment.