How to get the room from my linked electrical elements?

Tells you right there you have an unexpected indent. Your if/break loop at the end has an extra indent under room.