In 1.12 and before, I could get the sate of a lever with testforblock, but in 1.13, it seems like minecraft thinks that levers are not block entities and/or don't have states.
Specifically:
/data get block <x> <y> <z> lever.powered
reports "The target block is not a block entity", and
/execute if block <x> <y> <z> lever{powered:1b}
always returns false
Do I have something wrong with my commands?
/datais only used for block entities such as chests, furnaces, command blocks, etc. Block entities and block states are two completely different things. Levers are not block entities.To test for a block state, you can define them in brackets connected to the block argument.
To test for a tag in a block entity, you can define them in curly brackets connected to the block argument.