async def _async_service_set_device_value(hass: HomeAssistant, service: ServiceCall) -> None:
    """Service to call setValue method for Homematic(IP) Local devices."""
    channel_no = service.data[CONF_CHANNEL]
    parameter = service.data[CONF_PARAMETER]
    value = service.data[CONF_VALUE]
    value_type = service.data.get(CONF_VALUE_TYPE)
    wait_for_callback = service.data.get(CONF_WAIT_FOR_CALLBACK)
    rx_mode = service.data.get(CONF_RX_MODE)
    if value_type:
        # Convert value into correct XML-RPC Type.
        # https://docs.python.org/3/library/xmlrpc.client.html#xmlrpc.client.ServerProxy
        if value_type == "int":
            value = int(value)
        elif value_type == "double":
            value = float(value)
        elif value_type == "boolean":
            value = to_bool(value)
        elif value_type == "dateTime.iso8601":
            value = datetime.strptime(value, "%Y%m%dT%H:%M:%S")
        else:
            # Default is 'string'
            value = str(value)

    if hm_device := _async_get_hm_device_by_service_data(hass=hass, service=service):
        try:
            await hm_device.client.set_value(
                channel_address=f"{hm_device.address}:{channel_no}",
                paramset_key=ParamsetKey.VALUES,
                parameter=parameter,
                value=value,
                wait_for_callback=wait_for_callback,
                rx_mode=rx_mode,
                check_against_pd=True,
            )
        except BaseHomematicException as ex:
            raise HomeAssistantError(ex) from ex
Service to call setValue method for Homematic(IP) Local devices.
custom_components/homematicip_local/services.py