By default I don’t think user Hass has sudo permissions. If you ssh in you are likely logged in as user pi. Try switching to user hass and it likely won’t work through ssh either.
You can give hass sudo permission but I don’t recall the steps to do it. A bit of Google fu will get you there.