Skip to content

Commit

Permalink
argparse, many fixes, 'desc' field in JSON output for commands with "…
Browse files Browse the repository at this point in the history
…values"
  • Loading branch information
segaura committed Apr 4, 2021
1 parent 5f15994 commit 5ccd0bb
Show file tree
Hide file tree
Showing 4 changed files with 124 additions and 185 deletions.
2 changes: 1 addition & 1 deletion HPSU/HPSU.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def __init__(self, logger=None, driver=None, port=None, cmd=None, lg_code=None):

# read all known commands
command_details_hpsu = '%s/commands_hpsu.json' % self.pathCOMMANDS
self.logger.info("HPSU %s loading command details file: %s" % (cmd, command_details_hpsu))
self.logger.info("HPSU %s, loading command details file: %s" % (cmd, command_details_hpsu))
with open(command_details_hpsu, 'rU',encoding='utf-8') as jsonfile:
self.all_commands = json.load(jsonfile)
self.command_dict=self.all_commands["commands"]
Expand Down
2 changes: 1 addition & 1 deletion HPSU/canpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def sendCommandWithID(self, cmd, setValue=None, priority=1):
command = command+" %02X %02X" % (setValue >> 8, setValue & 0xff)
if cmd["type"] == "value":
setValue = int(setValue)
command = command+" 00 %02X" % (setValue)
command = command+" %02X %02X" % (setValue >> 8, setValue & 0xff)

msg_data = [int(r, 16) for r in command.split(" ")]
notTimeout = True
Expand Down
2 changes: 2 additions & 0 deletions HPSU/plugins/mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ def __init__(self, hpsu=None, logger=None, config_file=None):
else:
self.qos = "0"

# no need to create a different client name every time, because it only publish
logger.info("creating new mqtt client instance: " + self.clientname)
self.client=mqtt.Client(self.clientname)
self.client.on_publish = self.on_publish
if self.username:
Expand Down
Loading

0 comments on commit 5ccd0bb

Please sign in to comment.