knx_stack/datapointtypes.py
def make(dpt: str, fields_values: dict) -> "knx_stack.datapointtypes.DPT":
        """
        Build a knx_stack.datapointtypes.DPT from a dpt name and a dictionary of values.

        :param dpt: a DPT name
        :param fields_values: a dictionary of values for the DPT's fields
        :return: a knx_stack.datapointtypes.DPT instance

        >>> import knx_stack
        >>> factory = knx_stack.datapointtypes.DPT_Factory()

        >>> dpt = factory.make("DPT_Control_Dimming", {"step": 7, "direction": "up"})
        >>> dpt.step
        7
        >>> dpt.direction == knx_stack.datapointtypes.DPT_Control_Dimming.Direction.up
        True

        >>> dpt = factory.make("DPT_Value_Temp", {"decoded_value": -1.0})
        >>> dpt.decode()
        -1.0
        """
        from knx_stack import datapointtypes

        dpt = getattr(datapointtypes, dpt)()
        for key, value in fields_values.items():
            if key == "decoded_value":
                dpt.encode(value)
            else:
                setattr(dpt, key, value)

        return dpt

        Build a knx_stack.datapointtypes.DPT from a dpt name and a dictionary of values.

        :param dpt: a DPT name
        :param fields_values: a dictionary of values for the DPT's fields
        :return: a knx_stack.datapointtypes.DPT instance

        >>> import knx_stack
        >>> factory = knx_stack.datapointtypes.DPT_Factory()

        >>> dpt = factory.make("DPT_Control_Dimming", {"step": 7, "direction": "up"})
        >>> dpt.step
        7
        >>> dpt.direction == knx_stack.datapointtypes.DPT_Control_Dimming.Direction.up
        True

        >>> dpt = factory.make("DPT_Value_Temp", {"decoded_value": -1.0})
        >>> dpt.decode()
        -1.0
        
Build a knx_stack.datapointtypes.DPT from a dpt name and a dictionary of values.
Build a knx_stack . datapointtypes . DPT from a dpt name and a dictionary of values .
def make(dpt: str, fields_values: dict) -> "knx_stack.datapointtypes.DPT":
        from knx_stack import datapointtypes
        dpt = getattr(datapointtypes, dpt)()
        for key, value in fields_values.items():
            if key == "decoded_value":
                dpt.encode(value)
            else:
                setattr(dpt, key, value)
        return dpt
def make ( dpt : str , fields_values : dict ) -> "knx_stack.datapointtypes.DPT" : from knx_stack import datapointtypes dpt = getattr ( datapointtypes , dpt ) ( ) for key , value in fields_values . items ( ) : if key == "decoded_value" : dpt . encode ( value ) else : setattr ( dpt , key , value ) return dpt
Build a knx_stack.datapointtypes.DPT from a dpt name and a dictionary of values.
Build a knx_stack . datapointtypes . DPT from a dpt name and a dictionary of values .
"""
        Build a knx_stack.datapointtypes.DPT from a dpt name and a dictionary of values.

        :param dpt: a DPT name
        :param fields_values: a dictionary of values for the DPT's fields
        :return: a knx_stack.datapointtypes.DPT instance

        >>> import knx_stack
        >>> factory = knx_stack.datapointtypes.DPT_Factory()

        >>> dpt = factory.make("DPT_Control_Dimming", {"step": 7, "direction": "up"})
        >>> dpt.step
        7
        >>> dpt.direction == knx_stack.datapointtypes.DPT_Control_Dimming.Direction.up
        True

        >>> dpt = factory.make("DPT_Value_Temp", {"decoded_value": -1.0})
        >>> dpt.decode()
        -1.0
        """
a knx_stack.datapointtypes.DPT instance
>>> import knx_stack
>>> factory = knx_stack.datapointtypes.DPT_Factory()

>>> dpt = factory.make("DPT_Control_Dimming", {"step": 7, "direction": "up"})
>>> dpt.step
7
>>> dpt.direction == knx_stack.datapointtypes.DPT_Control_Dimming.Direction.up
True


a knx_stack . datapointtypes . DPT instance >>> import knx_stack >>> factory = knx_stack . datapointtypes . DPT_Factory () >>> dpt = factory . make ( " DPT_Control_Dimming " { " step " : 7 " direction " : " up " } ) >>> dpt . step 7 >>> dpt . direction == knx_stack . datapointtypes . DPT_Control_Dimming . Direction . up True
dpt
str
a DPT name
a DPT name
fields_values
dict
a dictionary of values for the DPT's fields
a dictionary of values for the DPT ' s fields