Turn on/off a Lovelace view dynamically

check out this example. should guide you in the right direction