def add(self, sensor):
        """Add a sensor, warning if it exists."""
        if isinstance(sensor, (list, tuple)):
            for sss in sensor:
                self.add(sss)
            return

        if not isinstance(sensor, Sensor):
            raise TypeError("pysma.Sensor expected")

        if sensor.name in self:
            old = self[sensor.name]
            self.__s.remove(old)
            _LOGGER.warning("Replacing sensor %s with %s", old, sensor)

        if sensor.key in self:
            _LOGGER.warning("Duplicate SMA sensor key %s", sensor.key)

        self.__s.append(sensor)
def add ( self , sensor ) : if isinstance ( sensor , ( list , tuple ) ) : for sss in sensor : self . add ( sss ) return if not isinstance ( sensor , Sensor ) : raise TypeError ( "pysma.Sensor expected" ) if sensor . name in self : old = self [ sensor . name ] self . __s . remove ( old ) _LOGGER . warning ( "Replacing sensor %s with %s" , old , sensor ) if sensor . key in self : _LOGGER . warning ( "Duplicate SMA sensor key %s" , sensor . key ) self . __s . append ( sensor )
Add a sensor, warning if it exists.