Skip to content

Commit

Permalink
bump pymodbus to 3.3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
frodef committed Mar 22, 2024
1 parent 8971e90 commit 9520d74
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 1 addition & 3 deletions custom_components/nilan_cts600/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
"documentation": "https://github.com/frodef/nilan-cts600-homeassistant",
"homekit": {},
"iot_class": "local_push",
"requirements": [
"pymodbus==3.3.1"
],
"requirements": ["pymodbus==3.3.6"],
"version": "2023.08.08"
}
6 changes: 3 additions & 3 deletions custom_components/nilan_cts600/nilan_cts600.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import codecs, struct, time, os, re
from enum import Enum
from pymodbus.client import ModbusSerialClient
from pymodbus.utilities import computeCRC
from pymodbus.message.rtu import MessageRTU

class NilanCTS600Exception (Exception):
pass
Expand Down Expand Up @@ -140,7 +140,7 @@ def nilanCelsiusToAD (celsius, x=56.25):
return round ((x - celsius) / ((34 - 12) / (328 - 168)))

def appendCRC (frame):
crc = computeCRC (frame)
crc = MessageRTU.compute_CRC (frame)
return frame + [(crc>>0)&0xff, (crc>>8)&0xff]

default_slave_id_format = (
Expand Down Expand Up @@ -214,7 +214,7 @@ def recv (n):
raise Exception(f"Unknown response op {op}")

data = recv(data_size)
computedCRC = computeCRC(bytes(frame))
computedCRC = MessageRTU.compute_CRC(bytes(frame))
gotCRC = word16b(recv)
# print(f'ACK: {op} : {parameters} : {data} : {gotCRC:04x} : {computedCRC:04x}')
return op.name, parameters, data, gotCRC == computedCRC
Expand Down

0 comments on commit 9520d74

Please sign in to comment.