Exemple #1
0
 def get(cls):
     up_time = get_up_time()
     up_min = up_time / 60
     up_min = "{:.2f}".format(up_min)
     up_hour = up_time / 3600
     up_hour = "{:.2f}".format(up_hour)
     from src import AppSetting
     from src.services.histories.sync.influxdb import InfluxDB
     from src.services.histories.sync.postgresql import PostgreSQL
     from src.services.mqtt_client import MqttRegistry
     setting: AppSetting = current_app.config[AppSetting.KEY]
     deployment_mode = 'production' if setting.prod else 'development'
     return {
         'version': get_version(),
         'up_time_date': up_time_date,
         'up_min': up_min,
         'up_hour': up_hour,
         'deployment_mode': deployment_mode,
         'mqtt_client_statuses': [{mqttc.to_string(): mqttc.status()} for mqttc in MqttRegistry().clients()],
         'influx_db_status': InfluxDB().status(),
         'postgre_sql_status': PostgreSQL().status(),
         'settings': {
             setting.services.KEY: setting.services.to_dict()
         }
     }
Exemple #2
0
    def get(cls):
        up_time = get_up_time()
        up_min = up_time / 60
        up_min = "{:.2f}".format(up_min)
        up_hour = up_time / 3600
        up_hour = "{:.2f}".format(up_hour)
        from src import AppSetting
        setting: AppSetting = current_app.config[AppSetting.FLASK_KEY]
        deployment_mode = 'production' if setting.prod else 'development'

        return {
            'version': get_version(),
            'up_time_date': up_time_date,
            'up_min': up_min,
            'up_hour': up_hour,
            'deployment_mode': deployment_mode,
            'bacnet': {
                'enabled': setting.bacnet.enabled,
                'status': BACServer().status(),
                'use_pre_set_ethernet_interface':
                setting.bacnet.enable_ip_by_nic_name,
                'pre_set_ethernet_interface': setting.bacnet.ip_by_nic_name,
                'default_point_cov': setting.bacnet.default_point_cov
            },
            'mqtt': {
                'enabled': setting.mqtt.enabled,
                'status': MqttClient().status()
            }
        }
Exemple #3
0
    def get(cls):
        up_time = get_up_time()
        up_min = up_time / 60
        up_min = "{:.2f}".format(up_min)
        up_hour = up_time / 3600
        up_hour = "{:.2f}".format(up_hour)
        from src import AppSetting
        setting: AppSetting = current_app.config[AppSetting.FLASK_KEY]
        deployment_mode = 'production' if setting.prod else 'development'

        return {
            'version': get_version(),
            'up_time_date': up_time_date,
            'up_min': up_min,
            'up_hour': up_hour,
            'deployment_mode': deployment_mode,
        }
Exemple #4
0
    def connect(self, bacnet_server):
        address = self._ip_address(bacnet_server)
        version = get_version()
        description = "nube-io bacnet server"
        self.ldo = LocalDeviceObject(
            objectName=bacnet_server.local_obj_name,
            objectIdentifier=int(bacnet_server.device_id),
            maxApduLengthAccepted=1024,
            segmentationSupported="segmentedBoth",
            vendorIdentifier=bacnet_server.vendor_id,
            firmwareRevision=CharacterString(version),
            modelName=CharacterString(bacnet_server.model_name),
            vendorName=CharacterString(bacnet_server.vendor_name),
            description=CharacterString(description),
            systemStatus=DeviceStatus(1),
            applicationSoftwareVersion=CharacterString(version),
            databaseRevision=0)

        self.__bacnet = BIPSimpleApplication(self.ldo, address)
        self.__bacnet.add_capability(ReadWritePropertyMultipleServices)
        self.sync_stack()
        FlaskThread(target=bacnet_run).start()  # start bacpypes thread
Exemple #5
0
 def get(cls):
     up_time = get_up_time()
     up_min = up_time / 60
     up_min = round(up_min, 2)
     up_min = str(up_min)
     up_hour = up_time / 3600
     up_hour = round(up_hour, 2)
     up_hour = str(up_hour)
     from src import AppSetting
     setting: AppSetting = current_app.config[AppSetting.FLASK_KEY]
     return {
         'version': get_version(),
         'up_time_date': up_time_date,
         'up_min': up_min,
         'up_hour': up_hour,
         'serial': {
             'enabled': setting.mqtt.enabled,
             'status': SerialConnectionListener().status()
         },
         'mqtt': {
             'enabled': setting.mqtt.enabled,
             'status': MqttClient().status()
         }
     }
Exemple #6
0
 def get(cls):
     up_time = get_up_time()
     up_min = up_time / 60
     up_min = round(up_min, 2)
     up_min = str(up_min)
     up_hour = up_time / 3600
     up_hour = round(up_hour, 2)
     up_hour = str(up_hour)
     # from src import AppSetting
     # setting: AppSetting = current_app.config[AppSetting.FLASK_KEY]
     return {
         'version': get_version(),
         'up_time_date': up_time_date,
         'up_min': up_min,
         'up_hour': up_hour,
         # 'serial': {
         #     'enabled': setting.mqtt.enabled,
         #     'status': "ADD SOMINT HERE"
         # },
         # 'mqtt': {
         #     'enabled': setting.mqtt.enabled,
         #     'status': MqttClient().status()
         # }
     }