@JimT’s solution will work but note that not all states held by all Item types are both a State and a Command.
Other options that will work with most Items:
ABSchlaf.getState() as Command
ABSchlaf.getState().toString()
But only the toString() approach will work in those cases where the state of the Item is not a Command (ImageType is one, not sure if there are others).