Ejemplo n.º 1
0
    def __init__(self, csv_reader: csv.DictReader):
        self.csv_reader = csv_reader
        self.frames = {}
        self.rooms = {}

        rooms_frame = openhab2.Frame('Räume')
        self.add_frame(FRAME_ALL_ROOMS, rooms_frame)
        dynamic_lights_frame = openhab2.Frame(SWITCH_LABEL_DYNAMIC_LIGHTS)
        dynamic_lights_frame.add_sitemap_element(
            openhab2.SitemapSwitchElement(SWITCH_NAME_DYNAMIC_LIGHTS,
                                          SWITCH_LABEL_DYNAMIC_LIGHTS, '[%s]',
                                          openhab2.ICON_LIGHT))
        self.add_frame(FRAME_ACTIVE_LIGHTS, dynamic_lights_frame)
        dynamic_dimmers_frame = openhab2.Frame(SWITCH_LABEL_DYNAMIC_DIMMERS)
        dynamic_dimmers_frame.add_sitemap_element(
            openhab2.SitemapSliderElement(SWITCH_NAME_DYNAMIC_DIMMERS,
                                          SWITCH_LABEL_DYNAMIC_DIMMERS,
                                          '[%d %%]', openhab2.ICON_LIGHT))
        self.add_frame(FRAME_ACTIVE_DIMMERS, dynamic_dimmers_frame)
        dynamic_rollershutters_frame = openhab2.Frame('Offene Rolladen')
        self.add_frame(FRAME_OPEN_ROLLERSHUTTERS, dynamic_rollershutters_frame)
        dynamic_open_windows_frame = openhab2.Frame('Offene Fenster')
        self.add_frame(FRAME_OPEN_WINDOWS, dynamic_open_windows_frame)
        special_functions_frame = openhab2.Frame('Spezialfunktionen')
        self.add_frame(FRAME_SPECIAL_FUNCTIONS, special_functions_frame)
        special_functions_frame.add_sitemap_element(
            openhab2.SitemapSwitchElement(
                SWITCH_NAME_DISABLE_OPEN_BEDROOM_BLINDS,
                SWITCH_LABEL_DISABLE_OPEN_BEDROOM_BLINDS, '[%s]', ''))
        special_functions_frame.add_sitemap_element(
            openhab2.SitemapSwitchElement(
                SWITCH_NAME_DISABLE_OPEN_OFFICE_FF_BLINDS,
                SWITCH_LABEL_DISABLE_OPEN_OFFICE_FF_BLINDS, '[%s]', ''))
Ejemplo n.º 2
0
 def process_poweroutlet(self, row: dict):
     room_sitemap_element = self.get_room_sitemap_element(
         row[COL_ROOM_NAME], row[COL_ROOM_LABEL])
     switch_element = openhab2.SitemapSwitchElement(
         row[COL_NAME], row[COL_LABEL], '[%s]', openhab2.ICON_POWER_OUTLET)
     room_sitemap_element.add_element(switch_element)
     self.get_frame_by_name(FRAME_ACTIVE_LIGHTS)\
         .add_sitemap_element(openhab2.SitemapSwitchElement(row[COL_NAME], row[COL_LABEL], '[%s]',
                                                            openhab2.ICON_POWER_OUTLET, row[COL_NAME] + '==ON'))
Ejemplo n.º 3
0
 def process_stopmoveswitch(self, row: dict):
     room_sitemap_element = self.get_room_sitemap_element(
         row[COL_ROOM_NAME], row[COL_ROOM_LABEL])
     switch_element = openhab2.SitemapSwitchElement(
         row[COL_NAME], row[COL_LABEL], '', openhab2.ICON_GARAGE_DOOR)
     switch_element.mappings['MOVE'] = 'Bewegen'
     room_sitemap_element.add_element(switch_element)
Ejemplo n.º 4
0
 def process_rollershutter(self, row: dict):
     room_sitemap_element = self.get_room_sitemap_element(
         row[COL_ROOM_NAME], row[COL_ROOM_LABEL])
     switch_element = openhab2.SitemapSwitchElement(row[COL_NAME],
                                                    row[COL_LABEL], '[%s]',
                                                    openhab2.ICON_BLINDS)
     room_sitemap_element.add_element(switch_element)
     slider_element = openhab2.SitemapSliderElement(row[COL_NAME],
                                                    row[COL_LABEL],
                                                    '[%d %%]',
                                                    openhab2.ICON_BLINDS)
     room_sitemap_element.add_element(slider_element)
     self.get_frame_by_name(FRAME_OPEN_ROLLERSHUTTERS)\
         .add_sitemap_element(openhab2.SitemapTextElement(row[COL_NAME], row[COL_LABEL], '[%d %%]',
                                                            openhab2.ICON_BLINDS, row[COL_NAME] + '<100'))
Ejemplo n.º 5
0
 def process_dimmer(self, row: dict):
     room_sitemap_element = self.get_room_sitemap_element(
         row[COL_ROOM_NAME], row[COL_ROOM_LABEL])
     switch_element = openhab2.SitemapSwitchElement(row[COL_NAME],
                                                    row[COL_LABEL], '[%s]',
                                                    openhab2.ICON_LIGHT)
     room_sitemap_element.add_element(switch_element)
     slider_element = openhab2.SitemapSliderElement(row[COL_NAME],
                                                    row[COL_LABEL],
                                                    '[%d %%]',
                                                    openhab2.ICON_LIGHT)
     room_sitemap_element.add_element(slider_element)
     self.get_frame_by_name(FRAME_ACTIVE_DIMMERS)\
         .add_sitemap_element(openhab2.SitemapSliderElement(row[COL_NAME], row[COL_LABEL], '[%s]',
                                                            openhab2.ICON_LIGHT, row[COL_NAME] + '>0'))
Ejemplo n.º 6
0
 def process_occupancysensor(self, row: dict):
     room_sitemap_element = self.get_room_sitemap_element(
         row[COL_ROOM_NAME], row[COL_ROOM_LABEL])
     switch_element = openhab2.SitemapSwitchElement(
         row[COL_NAME], row[COL_LABEL], '', openhab2.ICON_MOTIONDETECTOR)
     room_sitemap_element.add_element(switch_element)