Toggle viewport subDs in edit mode with hotkey?

Hey, Im fairly new to blender and Im trying to find a way of creating a shortcut to toggle the viewport subdivisions when in edit mode. Its quite frustrating always having to exit edit mode just to toggle it on and off. I know there is a button in the modifier menu to do this but I want to asset a hotkey to it.

My question is, what RNA do you type to get this hotkey working?

Any help would be greatly appreciated. Cheers!

You could just set the levels with existing hotkeys, Ctrl+(0-5)

But the hotkey


Thanks for the reply,

I am aware you can toggle using Cntrl 0 - 5 however this only works in object mode, I want to quickly toggle it while Im modeling so I dont need to leave edit mode. I just copied what you had there however I get an error when I try execute the hotkey. I should note that I am using 2.8, could it be that the API is different than 2.79?

Yes, you should, in the starting post

Blender doesn’t have a dedicated hotkeyable way of turning off modifier display, but googling reveals addons that add this functionality.

Otherwise you can add a wm.context_toggle hotkey and put scene.render.use_simplify in its data path. Then make sure Render > Simplify > Viewport max subdivision is set to 0.