You don't compensate them, instead you don't charge them rent for the period of time they're not in the property.
Second you send them a 24 hour notice to enter, days before you plan on having the work performed.
I had tenants that reported me to "Housing" and the "County Health Department" that I refused to re-paint their apartment. What happened is I made an appointment for a Monday. When I showed up they refused to allow me to enter, saying I should return another time.
Then I sent them a 24 hour notice that I was coming back on Thursday to do the agreed work. On Thursday I showed up with a painting crew. Again I was refused entry. I sent the tenant a second letter outlining my efforts and out of pocket expense.
I then issued them a 3rd notice to enter, this time showing up with another painting company. Once again I was denied entry.
The tenant stopped paying rent a re-ported me again for not painting. The City and County issued me fines. I turned around and put everyone on notice that I'm suing in small claims court and had the tenants, Housing and the Health Department served. No one wanted to listen as to the steps I took trying to comply. It' is always the landlords fault in the eyes of the law. I won my small claims case, having the two painting contractors showing up and my Hall Security Camera of the events shown in court. I then evicted my tenants.....
All this because my City and County are on the side of tenants and nothing I ever do is good enough.
Now I had another case under my wings to use when I get bulled. --47.156.xx.xx