from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy.uix.gridlayout import GridLayout


class IoTClient(App):
    title = 'Apollo IoT Client'
    icon = 'assets/icon.png'

    def build(self):
        initial_data = {
            'Guest Room': {'temp': 22.5, 'humidity': 62.2},
            'Work Room': {'temp': 20.8, 'humidity': 55.7},
            'Bedroom': {'temp': 21.1, 'humidity': 57.1},
            'Bathroom': {'temp': 25.1, 'humidity': 94.9},
            '2nd Floor': {'temp': 23.7, 'humidity': 69.3},
        }
        layout = GridLayout(cols=1)
        for room, data in initial_data.items():
            cell = GridLayout(cols=2)
            cell.add_widget(Label(text=room))
            cell.add_widget(Label(text='T: {0:.0f}{1}C, H: {2:.0f}%'.format(data['temp'], chr(176), data['humidity'])))
            layout.add_widget(cell)
        layout.add_widget(Button(text='Refresh'))
        return layout


if __name__ == '__main__':
    IoTClient().run()

@@ -1,16 +1,51 @@
+from urllib.parse import urlparse%0A%0A
 from kivy.app im
@@ -88,16 +88,57 @@
  Button%0A
+from kivy.uix.textinput import TextInput%0A
 from kiv
@@ -209,92 +209,70 @@
 out%0A
-%0A%0Aclass IoTClient(App):%0A    title = 'Apollo IoT Client'%0A    icon = 'assets/icon.png'
+from kivy.uix.modalview import ModalView%0A%0A%0Aclass ApolloLayout:
 %0A%0A  
@@ -281,13 +281,16 @@
 def 
-build
+__init__
 (sel
@@ -301,24 +301,21 @@
         
-initial_
+self.
 data = %7B
@@ -618,16 +618,452 @@
       %7D%0A
+        self.server_url = TextInput(text='http://192.168.0.112')%0A        self.layout = self.build()%0A%0A    def refresh(self, button_instance):%0A        view = ModalView()%0A        result = urlparse(self.server_url.text)%0A        if result.scheme and result.netloc:%0A            text = self.server_url.text%0A        else:%0A            text = 'Url is not valid'%0A        view.add_widget(Label(text=text))%0A        view.open()%0A%0A    def build(self):%0A
         
@@ -1120,16 +1120,13 @@
  in 
-initial_
+self.
 data
@@ -1375,16 +1375,17 @@
 t(cell)%0A
+%0A
         
@@ -1406,47 +1406,301 @@
 get(
-Button(text='Refresh'))%0A        return 
+self.server_url)%0A        button = Button(text='Refresh')%0A        button.bind(on_press=self.refresh)%0A        layout.add_widget(button)%0A        return layout%0A%0A%0Aclass ApolloApp(App):%0A    title = 'Apollo IoT Client'%0A    icon = 'assets/icon.png'%0A%0A    def build(self):%0A        return ApolloLayout().
 layo
@@ -1739,17 +1739,17 @@
     
-IoTClient
+ApolloApp
 ().r

Update client layout