USB hub in external display works intermittently
I'm running an NEC EA271U external display with a MBP 2018 using the USB-C connection. I bought a separate cable that supports charging, 4K@60 Hz plus USB 2.0.
I've connected a mouse and a keyboard to the display's inbuilt USB hub. Now sometimes the hub doesn't work so that I only have an image but no input from mouse or keyboard. I haven't found a pattern so far, it can happen that I open the MacBook's lid while the USB-C cable is connected, the image works at the correct resolution but mouse and keyboard doesn't work.
Other times it works, I boot up and everything works fine. Most of the time it doesn't work to connect the display in clamshell mode, the mouse might respond but then the screen turns dark. So I connect the screen while the lid is open, everything works and then I close the lid and it's fine.
Anybody got any idea what it could be?
MacBook Pro 15”, macOS 10.15