How to see if a chest been emptied by the player

Solution 1:

When you test for an empty list (e.g. Items:[]), it will only match if the target had an empty list as well.

The following only outputs if the chest had no items:

/testforblock ~ ~1 ~ minecraft:chest -1 {Items:[]}

Solution 2:

A comparator will emit a redstone signal of strength directly proportional to how much "stuff" there is in an inventory it is facing away from. Simply put a camparator coming from the chest and send it into a NOT gate and use that to trigger the command block. When the chest is empty it will trigger the command but if there is at least 1 item in the chest it will output the signal and so not trigger the command block.

One thing to note is that the /setblock command may not trigger the block update so you could have your output also go to a piston after a delay to move a block top trigger the update.