Skip to content

Commit

Permalink
Workflow fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mazocode committed Oct 6, 2023
1 parent 76280c8 commit c373c57
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
1 change: 1 addition & 0 deletions .github/workflows/run-code-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
python -m pip install --upgrade pip
pip install poetry
pip install flake8
pip install pyproject-flake8
pip install -r requirements.txt
- name: Static code analysis
run: |
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export-requirements:
poetry export -f requirements.txt --output requirements.txt

check-code:
poetry run flake8 .
poetry run pflake8 .

show-dependencies:
poetry show
Expand Down
21 changes: 10 additions & 11 deletions modbus2mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,12 @@ def poller_thread(self):
# )
val = rr.registers[0]
if r.signed and int(val) >= 32768:
val = int(val)-65535
val = int(val) - 65535
if r.decimals > 0:
fmt = '{0:.'+str(r.decimals)+'f}'
val = float(fmt.format((int(val)-float(r.substract)) / float(r.divide)))
fmt = '{0:.' + str(r.decimals) + 'f}'
val = float(fmt.format((int(val) - float(r.substract)) / float(r.divide)))
else:
val = int(((int(val)-float(r.substract)) / float(r.divide)))
val = int(((int(val) - float(r.substract)) / float(r.divide)))

log.debug("got %s", val)

Expand Down Expand Up @@ -204,13 +204,12 @@ def main(argv):

log.debug("Configuring mqtt broker %s", config["mqtt"]["host"])
b = MqttBroker(
config["mqtt"]["host"],
int(config["mqtt"]["port"]),
config["mqtt"]["username"],
config["mqtt"]["password"],
config["mqtt"]["topic_prefix"],
bool(config["mqtt"]["tls"])
)
config["mqtt"]["host"],
int(config["mqtt"]["port"]),
config["mqtt"]["username"],
config["mqtt"]["password"],
config["mqtt"]["topic_prefix"],
bool(config["mqtt"]["tls"]))

for source in config["sources"]:
log.debug("Configuring source %s", source["name"])
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ pyyaml = "6.0.1"

[tool.flake8]
max-line-length = 120
ignore = ['E203', 'W503', 'E501', 'W128']
ignore = ['E203', 'W503', 'E501', 'E128']

0 comments on commit c373c57

Please sign in to comment.