How to use discrete events with an affect

I am trying to add an affect function to a discrete event. Not working:

function bb_affect!(integ, u, p, ctx)
    println(integ.u)
end

discrete_events = [[1.0, 4.0] => bb_affect!]            
@named sys = ODESystem(eqs, t; discrete_events = discrete_events)

Error message:

ERROR: MethodError: no method matching compile_affect(::var"#bb_affect!#17", ::ODESystem, ::Vector{SymbolicUtils.BasicSymbolic{Real}}, ::Vector{SymbolicUtils.BasicSymbolic{Real}}; expression::DataType, postprocess_affect_expr!::Nothing)

Closest candidates are:
  compile_affect(::ModelingToolkit.FunctionalAffect, ::Any, ::Any, ::Any; kwargs...)
   @ ModelingToolkit ~/.julia/packages/ModelingToolkit/Gpzyo/src/systems/callbacks.jl:452
  compile_affect(::Vector{Equation}, ::Any, ::Any, ::Any; outputidxs, expression, checkvars, postprocess_affect_expr!, kwargs...)
   @ ModelingToolkit ~/.julia/packages/ModelingToolkit/Gpzyo/src/systems/callbacks.jl:303
  compile_affect(::ModelingToolkit.SymbolicContinuousCallback, ::Any...; kwargs...)
   @ ModelingToolkit ~/.julia/packages/ModelingToolkit/Gpzyo/src/systems/callbacks.jl:282

Stacktrace:
  [1] generate_timed_callback(cb::ModelingToolkit.SymbolicDiscreteCallback, sys::ODESystem, dvs::Vector{SymbolicUtils.BasicSymbolic{…}}, ps::Vector{SymbolicUtils.BasicSymbolic{…}}; postprocess_affect_expr!::Nothing, kwargs::@Kwargs{})
    @ ModelingToolkit ~/.julia/packages/ModelingToolkit/Gpzyo/src/systems/callbacks.jl:459
  [2] generate_timed_callback
    @ ~/.julia/packages/ModelingToolkit/Gpzyo/src/systems/callbacks.jl:456 [inlined]
  [3] generate_discrete_callback(cb::ModelingToolkit.SymbolicDiscreteCallback, sys::ODESystem, dvs::Vector{SymbolicUtils.BasicSymbolic{…}}, ps::Vector{SymbolicUtils.BasicSymbolic{…}}; postprocess_affect_expr!::Nothing, kwargs::@Kwargs{})
    @ ModelingToolkit ~/.julia/packages/ModelingToolkit/Gpzyo/src/systems/callbacks.jl:473
  [4] generate_discrete_callback
    @ ~/.julia/packages/ModelingToolkit/Gpzyo/src/systems/callbacks.jl:470 [inlined]
  [5] #331

What do I miss?

See: Event Handling and Callback Functions · ModelingToolkit.jl

OK, this works:

function bb_affect!(integ, u, p, ctx)
    println(integ.u)
end

discrete_events = [[1.0, 4.0] => (bb_affect!, [], [], nothing)]            
@named sys = ODESystem(eqs, t; discrete_events = discrete_events)

But in this tuple:

(bb_affect!, [], [], nothing)

what is the purpose of the second, third and forth element?

EDIT: Ok, the second element is a vector of symbolic state variables and the third a vector of the symbolic parameters. Which leaves two questions:

  1. how can I access state variables that are part of the system, but not of the simplified system?
  2. what is the forth element?

To answer my own questions:

  1. This is not possible, but what IS possible is to keep variables of the system in the simplified system by using the following notation:
@variables Pr(t)=0 [irreducible = true]

Important is that the variable IS initialized, the value does not matter.

  1. this is a free parameter for passing a context to the callback function which can be used if required.