def nuki_states_decode(message): #cmd_id = 0x000C n_stat = message[2:3] l_stat = message[3:4] trigger = message[4:5] time = message[5:12] time_z = message[12:14] bat = message[14:15] n_stat = utils.u8_unpack(n_stat) l_stat = utils.u8_unpack(l_stat) trigger = utils.u8_unpack(trigger) time = utils.decode_time(time) time_z = utils.s16_unpack(time_z) bat = utils.u8_unpack(bat) return n_stat, l_stat, trigger, time, time_z, bat
def error_bridge_decode(message): #cmd_id = 0x8012 error_code = message[2:3] command = message[3:5] error_code = utils.u8_unpack(error_code) command = utils.u16_unpack(command) return error_code, command
def battery_report_decode(message): #cmd_id = 0x0011 bat_drain = message[2:4] bat_voltage = message[4:6] bat_state = message[6:7] bat_drain = utils.u16_unpack(bat_drain) bat_voltage = utils.u16_unpack(bat_voltage) bat_state = utils.u8_unpack(bat_state) return bat_drain, bat_voltage, bat_state
def _format_tx(self, message): data = [] for byte in message: data.append(utils.u8_unpack(byte)) return data
def status_decode(message): #cmd_id = 0x000E status = message[2:3] status = utils.u8_unpack(status) return status