Valve assembly with magnet valve