PyAutomationIO 1.1.13__tar.gz → 2.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/PKG-INFO +3 -5
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/PyAutomationIO.egg-info/PKG-INFO +3 -5
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/PyAutomationIO.egg-info/SOURCES.txt +10 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/PyAutomationIO.egg-info/requires.txt +2 -4
- pyautomationio-2.0.0/automation/__init__.py +96 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/core.py +485 -44
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/dbmodels/alarms.py +83 -18
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/dbmodels/events.py +77 -6
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/dbmodels/logs.py +109 -12
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/dbmodels/users.py +28 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/logger/alarms.py +10 -7
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/logger/logs.py +27 -8
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/logger/users.py +27 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/managers/db.py +7 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/managers/opcua_client.py +6 -4
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/modules/__init__.py +9 -1
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/modules/alarms/resources/alarms.py +228 -3
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/modules/alarms/resources/summary.py +39 -6
- pyautomationio-2.0.0/automation/modules/database/resources/__init__.py +9 -0
- pyautomationio-2.0.0/automation/modules/database/resources/database.py +150 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/modules/events/resources/events.py +40 -7
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/modules/events/resources/logs.py +74 -8
- pyautomationio-2.0.0/automation/modules/machines/__init__.py +2 -0
- pyautomationio-2.0.0/automation/modules/machines/resources/__init__.py +9 -0
- pyautomationio-2.0.0/automation/modules/machines/resources/machines.py +290 -0
- pyautomationio-2.0.0/automation/modules/opcua/resources/__init__.py +11 -0
- pyautomationio-2.0.0/automation/modules/opcua/resources/clients.py +425 -0
- pyautomationio-2.0.0/automation/modules/opcua/resources/server.py +116 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/modules/settings/resources/settings.py +19 -22
- pyautomationio-2.0.0/automation/modules/tags/__init__.py +0 -0
- pyautomationio-2.0.0/automation/modules/tags/resources/tags.py +603 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/modules/users/resources/models/users.py +4 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/modules/users/resources/users.py +116 -5
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/modules/users/users.py +26 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/opcua/models.py +1 -1
- pyautomationio-2.0.0/automation/pages/__init__.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/requirements.txt +3 -7
- pyautomationio-2.0.0/version.py +2 -0
- pyautomationio-1.1.13/automation/__init__.py +0 -50
- pyautomationio-1.1.13/automation/modules/tags/resources/tags.py +0 -290
- pyautomationio-1.1.13/version.py +0 -2
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/LICENSE +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/MANIFEST.in +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/PyAutomationIO.egg-info/dependency_links.txt +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/PyAutomationIO.egg-info/top_level.txt +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/README.md +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/alarms/__init__.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/alarms/states.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/alarms/trigger.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/buffer.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/dbmodels/__init__.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/dbmodels/core.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/dbmodels/machines.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/dbmodels/opcua.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/dbmodels/opcua_server.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/dbmodels/tags.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/extensions/__init__.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/extensions/api.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/extensions/cors.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/filter/__init__.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/iad/__init__.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/iad/frozen_data.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/iad/out_of_range.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/iad/outliers.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/logger/__init__.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/logger/core.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/logger/datalogger.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/logger/events.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/logger/logdict.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/logger/machines.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/logger/opcua_server.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/managers/__init__.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/managers/alarms.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/managers/state_machine.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/models.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/modules/alarms/__init__.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/modules/alarms/resources/__init__.py +0 -0
- {pyautomationio-1.1.13/automation/modules/events → pyautomationio-2.0.0/automation/modules/database}/__init__.py +0 -0
- {pyautomationio-1.1.13/automation/modules/tags → pyautomationio-2.0.0/automation/modules/events}/__init__.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/modules/events/resources/__init__.py +0 -0
- {pyautomationio-1.1.13/automation/pages → pyautomationio-2.0.0/automation/modules/opcua}/__init__.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/modules/settings/__init__.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/modules/settings/resources/__init__.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/modules/tags/resources/__init__.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/modules/users/__init__.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/modules/users/resources/__init__.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/modules/users/resources/models/__init__.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/modules/users/resources/models/roles.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/modules/users/resources/roles.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/modules/users/roles.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/opcua/__init__.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/opcua/subscription.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/pages/alarms.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/pages/alarms_history.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/pages/assets/styles.css +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/pages/callbacks/__init__.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/pages/callbacks/alarms.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/pages/callbacks/alarms_summary.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/pages/callbacks/db.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/pages/callbacks/filter.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/pages/callbacks/machines.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/pages/callbacks/machines_detailed.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/pages/callbacks/opcua.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/pages/callbacks/opcua_server.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/pages/callbacks/tags.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/pages/callbacks/trends.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/pages/communications.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/pages/components/__init__.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/pages/components/alarms.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/pages/components/alarms_summary.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/pages/components/database.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/pages/components/gaussian_filter.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/pages/components/machines.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/pages/components/opcua.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/pages/components/opcua_server.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/pages/components/tags.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/pages/components/trends.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/pages/database.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/pages/filter.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/pages/machines.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/pages/machines_detailed.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/pages/main.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/pages/opcua_server.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/pages/tags.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/pages/trends.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/singleton.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/state_machine.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/tags/__init__.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/tags/cvt.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/tags/filter.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/tags/tag.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/tests/__init__.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/tests/test_alarms.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/tests/test_core.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/tests/test_unit.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/tests/test_user.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/utils/__init__.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/utils/decorators.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/utils/observer.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/utils/units.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/variables/__init__.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/variables/adimentional.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/variables/current.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/variables/density.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/variables/eng_time.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/variables/force.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/variables/length.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/variables/mass.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/variables/mass_flow.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/variables/percentage.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/variables/power.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/variables/pressure.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/variables/temperature.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/variables/volume.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/variables/volumetric_flow.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/workers/__init__.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/workers/logger.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/workers/state_machine.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/automation/workers/worker.py +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/setup.cfg +0 -0
- {pyautomationio-1.1.13 → pyautomationio-2.0.0}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyAutomationIO
|
|
3
|
-
Version:
|
|
3
|
+
Version: 2.0.0
|
|
4
4
|
Summary: A python framework to develop automation industrial processes applications and Artificial Intelligence applications for the industrial field
|
|
5
5
|
Home-page: https://github.com/know-ai/PyAutomation
|
|
6
6
|
Author: KnowAI
|
|
@@ -30,13 +30,11 @@ Requires-Dist: numpy==2.1.0; python_version >= "3.14"
|
|
|
30
30
|
Requires-Dist: PyWavelets==1.6.0; python_version == "3.9"
|
|
31
31
|
Requires-Dist: PyWavelets==1.7.0; python_version >= "3.10" and python_version <= "3.11"
|
|
32
32
|
Requires-Dist: PyWavelets==1.9.0; python_version >= "3.12" and python_version <= "3.14"
|
|
33
|
-
Requires-Dist: dash==3.3.0
|
|
34
|
-
Requires-Dist: dash-bootstrap-components==2.0.4
|
|
35
|
-
Requires-Dist: dash-mantine-components==2.4.0
|
|
36
|
-
Requires-Dist: dash-iconify==0.1.2
|
|
37
33
|
Requires-Dist: opcua==0.98.13
|
|
38
34
|
Requires-Dist: python-dotenv==1.2.1
|
|
39
35
|
Requires-Dist: cryptography==43.0.3
|
|
36
|
+
Requires-Dist: Flask==3.1.2
|
|
37
|
+
Requires-Dist: requests==2.32.5
|
|
40
38
|
Requires-Dist: Flask-Cors==6.0.1
|
|
41
39
|
Requires-Dist: flask-restx==1.3.2
|
|
42
40
|
Requires-Dist: Flask-SocketIO==5.5.1
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PyAutomationIO
|
|
3
|
-
Version:
|
|
3
|
+
Version: 2.0.0
|
|
4
4
|
Summary: A python framework to develop automation industrial processes applications and Artificial Intelligence applications for the industrial field
|
|
5
5
|
Home-page: https://github.com/know-ai/PyAutomation
|
|
6
6
|
Author: KnowAI
|
|
@@ -30,13 +30,11 @@ Requires-Dist: numpy==2.1.0; python_version >= "3.14"
|
|
|
30
30
|
Requires-Dist: PyWavelets==1.6.0; python_version == "3.9"
|
|
31
31
|
Requires-Dist: PyWavelets==1.7.0; python_version >= "3.10" and python_version <= "3.11"
|
|
32
32
|
Requires-Dist: PyWavelets==1.9.0; python_version >= "3.12" and python_version <= "3.14"
|
|
33
|
-
Requires-Dist: dash==3.3.0
|
|
34
|
-
Requires-Dist: dash-bootstrap-components==2.0.4
|
|
35
|
-
Requires-Dist: dash-mantine-components==2.4.0
|
|
36
|
-
Requires-Dist: dash-iconify==0.1.2
|
|
37
33
|
Requires-Dist: opcua==0.98.13
|
|
38
34
|
Requires-Dist: python-dotenv==1.2.1
|
|
39
35
|
Requires-Dist: cryptography==43.0.3
|
|
36
|
+
Requires-Dist: Flask==3.1.2
|
|
37
|
+
Requires-Dist: requests==2.32.5
|
|
40
38
|
Requires-Dist: Flask-Cors==6.0.1
|
|
41
39
|
Requires-Dist: flask-restx==1.3.2
|
|
42
40
|
Requires-Dist: Flask-SocketIO==5.5.1
|
|
@@ -56,10 +56,20 @@ automation/modules/alarms/__init__.py
|
|
|
56
56
|
automation/modules/alarms/resources/__init__.py
|
|
57
57
|
automation/modules/alarms/resources/alarms.py
|
|
58
58
|
automation/modules/alarms/resources/summary.py
|
|
59
|
+
automation/modules/database/__init__.py
|
|
60
|
+
automation/modules/database/resources/__init__.py
|
|
61
|
+
automation/modules/database/resources/database.py
|
|
59
62
|
automation/modules/events/__init__.py
|
|
60
63
|
automation/modules/events/resources/__init__.py
|
|
61
64
|
automation/modules/events/resources/events.py
|
|
62
65
|
automation/modules/events/resources/logs.py
|
|
66
|
+
automation/modules/machines/__init__.py
|
|
67
|
+
automation/modules/machines/resources/__init__.py
|
|
68
|
+
automation/modules/machines/resources/machines.py
|
|
69
|
+
automation/modules/opcua/__init__.py
|
|
70
|
+
automation/modules/opcua/resources/__init__.py
|
|
71
|
+
automation/modules/opcua/resources/clients.py
|
|
72
|
+
automation/modules/opcua/resources/server.py
|
|
63
73
|
automation/modules/settings/__init__.py
|
|
64
74
|
automation/modules/settings/resources/__init__.py
|
|
65
75
|
automation/modules/settings/resources/settings.py
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
python-statemachine==2.4.0
|
|
2
2
|
python-statemachine[diagrams]
|
|
3
3
|
peewee==3.18.3
|
|
4
|
-
dash==3.3.0
|
|
5
|
-
dash-bootstrap-components==2.0.4
|
|
6
|
-
dash-mantine-components==2.4.0
|
|
7
|
-
dash-iconify==0.1.2
|
|
8
4
|
opcua==0.98.13
|
|
9
5
|
python-dotenv==1.2.1
|
|
10
6
|
cryptography==43.0.3
|
|
7
|
+
Flask==3.1.2
|
|
8
|
+
requests==2.32.5
|
|
11
9
|
Flask-Cors==6.0.1
|
|
12
10
|
flask-restx==1.3.2
|
|
13
11
|
Flask-SocketIO==5.5.1
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import os, pytz
|
|
2
|
+
from flask import Flask, send_from_directory, send_file
|
|
3
|
+
from .core import PyAutomation
|
|
4
|
+
from .state_machine import OPCUAServer
|
|
5
|
+
|
|
6
|
+
app = Flask(__name__, instance_relative_config=False)
|
|
7
|
+
|
|
8
|
+
MANUFACTURER = os.environ.get('AUTOMATION_MANUFACTURER')
|
|
9
|
+
SEGMENT = os.environ.get('AUTOMATION_SEGMENT')
|
|
10
|
+
_TIMEZONE = os.environ.get('AUTOMATION_TIMEZONE') or "America/Caracas"
|
|
11
|
+
TIMEZONE = pytz.timezone(_TIMEZONE)
|
|
12
|
+
CERT_FILE = os.path.join(".", "ssl", os.environ.get('AUTOMATION_CERT_FILE') or "")
|
|
13
|
+
KEY_FILE = os.path.join(".", "ssl", os.environ.get('AUTOMATION_KEY_FILE') or "")
|
|
14
|
+
if not os.path.isfile(CERT_FILE):
|
|
15
|
+
CERT_FILE = None
|
|
16
|
+
|
|
17
|
+
if not os.path.isfile(KEY_FILE):
|
|
18
|
+
KEY_FILE = None
|
|
19
|
+
AUTOMATION_OPCUA_SERVER_PORT = os.environ.get('AUTOMATION_OPCUA_SERVER_PORT') or "53530"
|
|
20
|
+
AUTOMATION_LOGGER_PERIOD = os.environ.get('AUTOMATION_LOGGER_PERIOD') or 10.0
|
|
21
|
+
AUTOMATION_APP_SECRET_KEY = os.environ.get('AUTOMATION_APP_SECRET_KEY') or "073821603fcc483f9afee3f1500782a4"
|
|
22
|
+
AUTOMATION_SUPERUSER_PASSWORD = os.environ.get('AUTOMATION_SUPERUSER_PASSWORD') or "super_ultra_secret_password"
|
|
23
|
+
|
|
24
|
+
# Ruta del frontend React construido
|
|
25
|
+
HMI_DIST_PATH = os.path.join(".", "hmi", "dist")
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class CreateApp():
|
|
29
|
+
"""Initialize the core application."""
|
|
30
|
+
|
|
31
|
+
def __call__(self):
|
|
32
|
+
"""
|
|
33
|
+
Documentation here
|
|
34
|
+
"""
|
|
35
|
+
app.client = None
|
|
36
|
+
self.application = app
|
|
37
|
+
|
|
38
|
+
with app.app_context():
|
|
39
|
+
|
|
40
|
+
from . import extensions
|
|
41
|
+
extensions.init_app(app)
|
|
42
|
+
|
|
43
|
+
from . import modules
|
|
44
|
+
modules.init_app(app)
|
|
45
|
+
|
|
46
|
+
# Configurar rutas para servir el frontend React
|
|
47
|
+
self._setup_frontend_routes(app)
|
|
48
|
+
|
|
49
|
+
return app
|
|
50
|
+
|
|
51
|
+
def _setup_frontend_routes(self, app):
|
|
52
|
+
"""
|
|
53
|
+
Configura las rutas para servir el frontend React construido en /hmi.
|
|
54
|
+
Sirve archivos estáticos y redirige todas las rutas bajo /hmi al index.html (SPA routing).
|
|
55
|
+
Estas rutas se registran con baja prioridad para no interferir con Dash y la API.
|
|
56
|
+
"""
|
|
57
|
+
# Verificar si existe el directorio del frontend construido
|
|
58
|
+
if not os.path.exists(HMI_DIST_PATH):
|
|
59
|
+
return # Si no existe, no configuramos las rutas (modo desarrollo o sin frontend)
|
|
60
|
+
|
|
61
|
+
# Servir archivos estáticos del frontend (JS, CSS, assets, etc.) bajo /hmi
|
|
62
|
+
@app.route('/hmi/assets/<path:filename>')
|
|
63
|
+
def serve_frontend_assets(filename):
|
|
64
|
+
"""Sirve archivos estáticos del frontend (JS, CSS, imágenes, etc.)"""
|
|
65
|
+
assets_dir = os.path.join(HMI_DIST_PATH, 'assets')
|
|
66
|
+
if os.path.exists(assets_dir):
|
|
67
|
+
return send_from_directory(assets_dir, filename)
|
|
68
|
+
return None
|
|
69
|
+
|
|
70
|
+
# Ruta catch-all para SPA bajo /hmi: todas las rutas /hmi/* sirven el index.html
|
|
71
|
+
@app.route('/hmi/', defaults={'path': ''})
|
|
72
|
+
@app.route('/hmi/<path:path>')
|
|
73
|
+
def serve_frontend_hmi(path):
|
|
74
|
+
"""
|
|
75
|
+
Sirve el frontend React bajo /hmi.
|
|
76
|
+
Para rutas que no sean archivos estáticos, sirve index.html (SPA routing).
|
|
77
|
+
"""
|
|
78
|
+
# Intentar servir el archivo estático si existe
|
|
79
|
+
if path:
|
|
80
|
+
file_path = os.path.join(HMI_DIST_PATH, path)
|
|
81
|
+
if os.path.exists(file_path) and os.path.isfile(file_path):
|
|
82
|
+
return send_from_directory(HMI_DIST_PATH, path)
|
|
83
|
+
|
|
84
|
+
# Para todas las demás rutas bajo /hmi, servir index.html (SPA routing)
|
|
85
|
+
index_path = os.path.join(HMI_DIST_PATH, 'index.html')
|
|
86
|
+
if os.path.exists(index_path):
|
|
87
|
+
return send_file(index_path)
|
|
88
|
+
|
|
89
|
+
return None
|
|
90
|
+
|
|
91
|
+
__application = CreateApp()
|
|
92
|
+
server = __application()
|
|
93
|
+
server.config['AUTOMATION_APP_SECRET_KEY'] = AUTOMATION_APP_SECRET_KEY
|
|
94
|
+
server.config['AUTOMATION_SUPERUSER_PASSWORD'] = AUTOMATION_SUPERUSER_PASSWORD
|
|
95
|
+
server.config['BUNDLE_ERRORS'] = True
|
|
96
|
+
opcua_server = OPCUAServer()
|