The top floor of the house was built without the permission of a government authority. They live in it and use electricity generated from solar panels. Isn't it forbidden to live in it and use electricity?
It should be clear that the government agency (Building Control Authority) determines a certain height for construction for ordinary citizens and those living in housing societies. Building above this is considered illegal. Therefore, in the case of the questioner, since he has constructed the upper floor without the permission and knowledge of the government agency (Building Control Authority), it was not right to construct it. Therefore, he should obtain formal permission from the government agency and maintain the validity of this construction and this is preferable and much better. Whereas the matter of using electricity obtained from solar panels while living in the said house, it is correct and there is no problem in that.
کما فی احکام القرآن للجصاص: قال الله تعالى يا أيها الذين آمنوا أطيعوا الله وأطيعوا الرسول وأولي الأمر منكم ( الی قولہ ) ومن الناس من يقول إن الأظهر من أولى الأمر هاهنا أنهم الأمراء لأنه قدم ذكر الأمر بالعدل وهذا خطاب لمن يملك تنفيذ الأحكام وهم الأمراء والقضاة ثم عطف عليه الأمر بطاعة أولي الأمر وهم ولاة الأمر الذين يحكمون عليهم ماداموا عدولا مرضيين وليس يمتنع أن يكون ذلك أمرا بطاعة الفريقين من أولي الأمر وهم أمراء السرايا والعلماء إذ ليس في تقدم الأمر بالحكم بالعدل ما يوجب الاقتصار بالأمر بطاعة أولي الأمر على الأمراء دون غيرهم الخ ( باب فی طاعۃ اولی الامر ج 2 ص 210 ط: سہیل اکیڈمی )۔
وفی صحیح مسلم: عن ابن عمر، عن النبي صلى الله عليه وسلم، أنه قال: «على المرء المسلم السمع والطاعة فيما أحب وكره، إلا أن يؤمر بمعصية، فإن أمر بمعصية، فلا سمع ولا طاعة» اھ ( ج 3 ص 1469 ط: بیروت)۔