Example #1
0
    def reloadConfig(self, bootup=False):
        #load known sensors from file
        for k, v in self.config.items("childIds"):
            value = v.split(';')
            self.childIdLookupTable[value[0] + ";" + value[1]] = k
            self.availableIds[int(value[0])] = False

        #load unit M/I from file (A good programmer should check input values)
        self.unit = self.config.get('config', 'unit')

        #load InclutionMode from file and send it to gateway(A good programmer should check input values...)
        self.InclutionMode = self.config.get('config', 'inclusion-mode')

        #at bootup this is executed from init
        if bootup is False:
            self.setInclutionMode(self.InclutionMode)

        #initiate integrations
        #Openhab
        if self.config.get('config', 'openhab') == 'true':
            if self.oh is None:
                self.oh = Openhab(self.config, self.log)
            else:
                self.oh.reloadConfig()
        else:
            self.oh = None

        #Domoticz
        if self.config.get('config', 'domoticz') == 'true':
            if self.dom is None:
                self.dom = Domoticz(self.config, self.log)
            else:
                self.dom.reloadConfig()
        else:
            self.dom = None

        #RRD
        if self.config.get('config', 'rrd') == 'true':
            if self.rrd is None:
                self.rrd = Rrd(self.config, self.log)
            else:
                self.rrd.reloadConfig()
        else:
            self.rrd = None

        self.log.info("reloadConfig: Configuration reloaded.")
Example #2
0
#------------------------------------------------------
# DOMOTICZ INTERFACE EXAMPLE
#
# Python interface to domoticz
#
# https://github.com/Tristan79/???
#
# 2016 Copyright © 2016 Tristan (@monkeycat.nl)
#
# CRAP WRAP v0.01
#------------------------------------------------------


# EXAMPLE

domoticz = Domoticz("localhost:8080")



    print "Hardware IDX: " + str(domoticz.hardware_idx)
    
    # BUG IN DOMOTICZ v3.5 NEVER PUT TWO OF THE SAME SENSOR TYPE AT THE BEGINNING
    
    temp_name = "Temperature Sensor TEST"
    temp_type = domoticz.SensorTemperature
    
    temp_idx = domoticz.use_virtual_sensor(temp_name,temp_type)
    if temp_idx == "None":
        print "Failed to get [" + temp_name + "]"
        sys.exit()