Exemplo n.º 1
0
 def put(self, n, _ts, key, values):
     if key[0] is None or command.IsCustom(key):
         return
     name = command.StringifyCommand(key)
     # print("@@@IN", name, values)
     self._mqtt_client.publish(
         "zwave_in/%d/%d/%s" % (self._home_id, n, name),
         json.dumps(values, cls=PythonObjectEncoder))
Exemplo n.º 2
0
    def SendMultiCommand(self, nodes: List[int], key, values, priority: tuple, xmit: int):
        try:
            raw_cmd = command.AssembleCommand(key, values)
        except Exception as e:
            logging.error("cannot assemble command for %s %s %s",
                          command.StringifyCommand(key),
                          z.SUBCMD_TO_PARSE_TABLE[key[0] * 256 + key[1]],
                          values)
            print("-" * 60)
            traceback.print_exc(file=sys.stdout)
            print("-" * 60)
            return

        def handler(_):
            logging.debug("@@handler invoked")

        m = zmessage.MakeRawCommandMultiWithId(nodes, raw_cmd, xmit)
        self._SendMessageMulti(nodes, m, priority, handler)
Exemplo n.º 3
0
    def SendCommand(self, n: int, key: tuple, values: dict, priority: tuple, xmit: int):
        try:
            raw_cmd = command.AssembleCommand(key, values)
        except Exception as _e:
            logging.error("cannot assemble command for %s %s %s",
                          command.StringifyCommand(key),
                          z.SUBCMD_TO_PARSE_TABLE[key[0] * 256 + key[1]],
                          values)
            print("-" * 60)
            traceback.print_exc(file=sys.stdout)
            print("-" * 60)
            return

        def handler(_):
            logging.debug("@@handler invoked")

        if IsMultichannelNode(n):
            n, c = SplitMultiChannelNode(n)
            raw_cmd = list(z.MultiChannel_CmdEncap) + [0, c] + raw_cmd
        m = zmessage.MakeRawCommandWithId(n, raw_cmd, xmit)
        self._SendMessage(n, m, priority, handler)
Exemplo n.º 4
0
 def put(self, n, ts, key, values):
     name = "@NONE@"
     if key[0] is not None:
         name = command.StringifyCommand(key)
     logging.warning("RECEIVED [%s]: %s - %s", _NodeName(n), name, values)
Exemplo n.º 5
0
 def Values(self):
     return [(key, command.StringifyCommand(key), val)
             for key, (_, val) in self._values.items()]