def __init__(self, name, inverteraddress='', inverterpincode='0000', timeinverval=10, nodeid=29, packettrace=0):
        """Initialize interfacer"""

        # Initialization
        super(EmonHubSMASolarInterfacer, self).__init__(name)

        self._btSocket = None
        self._inverteraddress=inverteraddress
        self._inverterpincode=inverterpincode
        self._port=1
        self._nodeid=int(nodeid)

        if packettrace==0:
            self._packettrace=False
        else:
            self._packettrace=True

        self.MySerialNumber = bytearray([0x08, 0x00, 0xaa, 0xbb, 0xcc, 0xdd]);

        self._reset_packet_send_counter()
        self._Inverters = None
        #Duration in seconds
        self._time_inverval =  int(timeinverval)
        self._InverterPasswordArray = SMASolar_library.encodeInverterPassword(self._inverterpincode)

        self._reset_duration_timer()
        self._reset_time_to_disconnect_timer();

        self._log.info("Reading from SMASolar every " + str(self._time_inverval) + " seconds")
Example #2
0
    def __init__(self,
                 name,
                 inverteraddress='',
                 inverterpincode='0000',
                 timeinverval=10,
                 nodeid=29,
                 packettrace=0):
        """Initialize interfacer"""

        # Initialization
        super().__init__(name)

        self._btSocket = None
        self._inverteraddress = inverteraddress
        self._inverterpincode = inverterpincode
        self._port = 1
        self._nodeid = int(nodeid)
        self._btRetrySleepTime = 10
        self.no_bluetooth_reported = False

        self._packettrace = bool(packettrace)

        # seems a hack & needs explaining why we need this
        self.MySerialNumber = bytearray([0x08, 0x00, 0xaa, 0xbb, 0xcc, 0xdd])

        self._reset_packet_send_counter()
        self._Inverters = {}
        #Duration in seconds
        self._time_inverval = int(timeinverval)
        self._InverterPasswordArray = SMASolar_library.encodeInverterPassword(
            self._inverterpincode)

        self._reset_duration_timer()
        self._reset_time_to_disconnect_timer()

        self._log.info("Reading from SMASolar every %d seconds",
                       self._time_inverval)