YO8RXP radio shack -- Smart home controller

For the love of coding... Xiaomi BLE temperature sensors, Raspberry Pi, Python, HTML , PHP, MariaDB and the cherry on top... the mighty BASH ! ..... work in progress !

This year started to build my own radio shack as a house, a small one but with all necessary needs . This house will respect country traditions, but some hidden high tech also,  like my smart home controller. Will provide basic electric floor heating , A/C , remote control/ supervisory  and will also be capable of remotely control all my hamradio devices.

  • Xiaomi BLE interogated via pure BASH gattool  within bluetooth tools.
  • Values stored in MariaDB database.
  • Python-vlc in charge of headless media player.
  • Python multiprocessing to avoid  touch screen lag.
  • Kivy framework driving all kaboodle.
  • Custom CRUD API to get mobile phone remote access.
  • A lot of new programming skills yet to be learned.
  • New front plate will be CNC build, to be  inserted into wall at a comfortable height.
  • A small custom UPS is yet to be built, to ensure a minimum 3 hours of normal  operation if main power fails. It will assist 4G mobile router also.
  • Half of the roof will be filled with solar panels connected to main grid, about 50 KWh/day will be produced during summer days.

Electric floor heating

Xiaomi BLE temperature sensors will provide inside climate feedback towards Raspberry PI, which via power relays and contactors will start / stop about 20 square meters of Magnum heating foil underneath laminate flooring. Also, hardwired Dallas temperature sensors will be placed beneath heating foil to measure and prevent overheating. Entire shack area will be covered by 5 x Magnum heating foils, thus 5 Dallas sensors will be needed in Daisy Chain configuration, of course with alert and stop if abnormal function detected. Entire radio shack will draw about 2.5 KW/h just for heating, so will have in mind a future photovoltaic system .

A/C room cooling

Same sensors will be used for A/C cooling, also via power relays + contactors. While my A/C unit does not have wifi capabilities, I will try to bitbang the A/C remote control and LED display in order to get A/C feedback towards Raspberry Pi, something like a pseudo CAN bus.

MariaDB CRUD

"Create, read, update, or delete entries " . Will aproach CRUD instead of REST, just to learn something new.

Kivy framework + official 7 inch touch display

Raspberry pi will be running in server mode, no GUI enabled. Also many other packages stripped away just to be as light as possible without being bloated. Max refresh rate at clock schedule 0 will be just about 30 fps, more than enough to playback videostream also, not sure yet if necesary ."Clock.schedule_interval(main_screen.update, 0)"

Sonoff 4CH R3 as failsafe secondary mechanism.

Even if I do not fancy Chinese EweLink app, this device is needed to cut off entire house electricity if for some reason, Raspberry pi fails and that could lead to fire hazard.
For example, If I remotely power ON the heating 4 hours before arriving at country house in winter time and suddenly there is not ping back or response for 5 minutes, I want to have the ability to shut down the entire house, using a different system than Raspberry Pi.

System ready for radio remote operations

Sonoff 4CH R3 having 4 distinct relays, it is as simple as pie (raspberry pi) to remote power ON / OFF just for radio equipement without powering other home appliances.

Hardware

50%

Software

50%

Shack construction

51%

Shack.yo8rxp.com

Click here for live DEMO

  • Until this project is finished and password protected, here is the link. It actually changes values into Raspberry Pi !
  • Web page still looks bad but right now I focus on functionality !
  • Apache proxy is serving data from Rpi via OpenVPN network and exposing it to public yo8rxp.com server. At the end will  have its own SSL certificate !
  • Data is sent as $_GET method to self page and redirecting to self also after MariaDB update in order to prevent F5(refresh) to send same data over and over.
				
					        def db_read(self,dummy):
            mydb = mysql.connector.connect(host="localhost", user="******", password="**********", database="home" )
            mycursor = mydb.cursor()
            mycursor.execute("SELECT img FROM openweather WHERE id = 0")  
            self.myresult2 = str(mycursor.fetchone()[0])
            mycursor.close()    
            mydb.close()
                   
class MyApp(App):
      
    def build(self):
        # Set up the layout:
        layout = FloatLayout()
        #Instantiate  UI objects ):
        main_screen = Main_Screen()
        # Add the UI elements to the layout:
        layout.add_widget(main_screen)
        Clock.schedule_interval(main_screen.update ,1)
        Clock.schedule_interval(main_screen.db_read,1