# Path: mppsolar/protocols/jk485.py
# class jk485(jkAbstractProtocol):
#     def __init__(self, *args, **kwargs) -> None:
#         super().__init__()
#         self._protocol_id = b"JK485"
#         self.COMMANDS = COMMANDS
#         self.STATUS_COMMANDS = [
#             "getBalancerData",
#         ]
#         self.SETTINGS_COMMANDS = [
#             "",
#         ]
#         self.DEFAULT_COMMAND = "getBalancerData"
# 
#     def get_full_command(self, command) -> bytes:
#         """
#         Override the default get_full_command as its different for JK485
#         """
#         log.info(f"Using protocol {self._protocol_id} with {len(self.COMMANDS)} commands")
#         # These need to be set to allow other functions to work`
#         self._command = command
#         self._command_defn = self.get_command_defn(command)
#         # End of required variables setting
#         if self._command_defn is None:
#             # Maybe return a default here?
#             return None
#         if "command_code" in self._command_defn:
#             # full command is 7 bytes long
#             cmd = bytearray(7)
#             # 55 AA 01 FF 00 00 FF
#             # frame header  0x55 0xaa
#             cmd[0:2] = bytes.fromhex("55aa")
#             log.debug(f"cmd with header: {cmd}")
#             # slave address 0x01
#             cmd[2] = 0x01
#             log.debug(f"cmd with header + slave address: {cmd}")
#             # command code  0xff
#             cmd[3] = int(self._command_defn["command_code"], 16)
#             # frame data    0x0000
#             cmd[4:6] = bytes.fromhex("0000")
#             log.debug(f"cmd with command code and frame data: {cmd}")
#             # checksum      0xff
#             cmd[-1] = crc8(cmd)
#             log.debug(f"cmd with crc: {cmd}")
#             return cmd


import unittest
from mppsolar.protocols.jk485 import jk485 as pi


class test_jk04_decode(unittest.TestCase):
    maxDiff = None

    def test_getBalancerData(self):
        """ test the decode of a getBalancerData response"""

# Path: mppsolar/protocols/jk485.py
# class jk485(jkAbstractProtocol):
#     def __init__(self, *args, **kwargs) -> None:
#         super().__init__()
#         self._protocol_id = b"JK485"
#         self.COMMANDS = COMMANDS
#         self.STATUS_COMMANDS = [
#             "getBalancerData",
#         ]
#         self.SETTINGS_COMMANDS = [
#             "",
#         ]
#         self.DEFAULT_COMMAND = "getBalancerData"
# 
#     def get_full_command(self, command) -> bytes:
#         """
#         Override the default get_full_command as its different for JK485
#         """
#         log.info(f"Using protocol {self._protocol_id} with {len(self.COMMANDS)} commands")
#         # These need to be set to allow other functions to work`
#         self._command = command
#         self._command_defn = self.get_command_defn(command)
#         # End of required variables setting
#         if self._command_defn is None:
#             # Maybe return a default here?
#             return None
#         if "command_code" in self._command_defn:
#             # full command is 7 bytes long
#             cmd = bytearray(7)
#             # 55 AA 01 FF 00 00 FF
#             # frame header  0x55 0xaa
#             cmd[0:2] = bytes.fromhex("55aa")
#             log.debug(f"cmd with header: {cmd}")
#             # slave address 0x01
#             cmd[2] = 0x01
#             log.debug(f"cmd with header + slave address: {cmd}")
#             # command code  0xff
#             cmd[3] = int(self._command_defn["command_code"], 16)
#             # frame data    0x0000
#             cmd[4:6] = bytes.fromhex("0000")
#             log.debug(f"cmd with command code and frame data: {cmd}")
#             # checksum      0xff
#             cmd[-1] = crc8(cmd)
#             log.debug(f"cmd with crc: {cmd}")
#             return cmd


# Path: tests/test_protocol_jk485.py
import unittest
from mppsolar.protocols.jk485 import jk485 as pi



class test_jk04_decode(unittest.TestCase):
    maxDiff = None

    def test_getBalancerData(self):
        """ test the decode of a getBalancerData response"""

        protocol = pi()