Skip to content

Commit

Permalink
0.7.0rc10
Browse files Browse the repository at this point in the history
0.7.0rc10
  - updated docs
  - fixed no data download in pyscada.js
  - fixed default pollingt interval in pyscada.device
  • Loading branch information
trombastic committed Aug 31, 2018
1 parent c6d7f33 commit d3a9aff
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 75 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,7 @@
- added traceback to Device.get_device_instance method
- updated Keithley DMM2000 device in visa.devices

0.7.0rc10
- updated docs
- fixed no data download in pyscada.js
- fixed default pollingt interval in pyscada.device
136 changes: 68 additions & 68 deletions docs/django_settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ Open the urls configuration file and add the necessary rewrite rule to the djang

::

nano /var/www/pyscada/PyScadaServer/PyScadaServer/urls.py
nano /var/www/pyscada/PyScadaServer/PyScadaServer/urls.py


::

...
from django.conf.urls import url, include
from django.contrib import admin
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^', include('pyscada.hmi.urls')),
]
...
...
from django.conf.urls import url, include
from django.contrib import admin

urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^', include('pyscada.hmi.urls')),
]
...



settings.py
-----------
Expand All @@ -35,7 +35,7 @@ Open the django settings file and make the following modifications. See also the

::

nano /var/www/pyscada/PyScadaServer/PyScadaServer/settings.py
nano /var/www/pyscada/PyScadaServer/PyScadaServer/settings.py


First deactivate the debugging, if debugging is active django will keep all SQL queries in the ram, the data-acquisition
Expand All @@ -44,101 +44,101 @@ pysada daemons after you change the debugging state.

::

DEBUG = False
DEBUG = False


Add the host/domain of your machine, in this case every url that point to a ip of the machine is allowed.

::

ALLOWED_HOSTS = ['*']
ALLOWED_HOSTS = ['*']


Add PyScada and the PyScada sub-apps to the installed apps list of Django.

::

INSTALLED_APPS = [
...
'pyscada',
'pyscada.modbus',
'pyscada.phant',
'pyscada.visa',
'pyscada.hmi',
'pyscada.systemstat',
'pyscada.export',
'pyscada.onewire',
INSTALLED_APPS = [
...
'pyscada',
'pyscada.modbus',
'pyscada.phant',
'pyscada.visa',
'pyscada.hmi',
'pyscada.systemstat',
'pyscada.export',
'pyscada.onewire',
'pyscada.smbus',
]
]

To use the MySQL Database, fill in the database, the user and password as selected in the *create Database section*.

::

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'PyScada_db',
'USER': 'PyScada-user',
'PASSWORD': 'PyScada-user-password',
'OPTIONS': {
'init_command': "SET sql_mode='STRICT_TRANS_TABLES'",
}
}
}
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'PyScada_db',
'USER': 'PyScada-user',
'PASSWORD': 'PyScada-user-password',
'OPTIONS': {
'init_command': "SET sql_mode='STRICT_TRANS_TABLES'",
}
}
}


Set the static file and media dir as follows.

::

...
STATIC_URL = '/static/'
...
STATIC_URL = '/static/'

STATIC_ROOT = '/var/www/pyscada/http/static/'
STATIC_ROOT = '/var/www/pyscada/http/static/'

MEDIA_URL = '/media/'
MEDIA_URL = '/media/'

MEDIA_ROOT = '/var/www/pyscada/http/media/'
MEDIA_ROOT = '/var/www/pyscada/http/media/'


Add all PyScada specific settings, keep in mind to set the file right file encoding in the `settings.py` file header (see also https://www.python.org/dev/peps/pep-0263/).

::

#!/usr/bin/python
# -*- coding: <encoding name> -*-
#!/usr/bin/python
# -*- coding: <encoding name> -*-


Append to the end of the `settings.py`:

::

# PyScada settings
# https://github.com/trombastic/PyScada

# email settings
DEFAULT_FROM_EMAIL = '[email protected]'
EMAIL_HOST = 'mail.host.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = '[email protected]'
EMAIL_USE_TLS = True
EMAIL_USE_SSL = False
EMAIL_HOST_PASSWORD = 'password'
EMAIL_PREFIX = 'PREFIX' # Mail subject will be "PREFIX subjecttext"
# meta information's about the plant site
PYSCADA_META = {
'name':'A SHORT NAME',
'description':'A SHORT DESCRIPTION',
}

# export properties
#
PYSCADA_EXPORT = {
'file_prefix':'PREFIX_',
'output_folder':'~/measurement_data_dumps',
}
# PyScada settings
# https://github.com/trombastic/PyScada

# email settings
DEFAULT_FROM_EMAIL = '[email protected]'
EMAIL_HOST = 'mail.host.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = '[email protected]'
EMAIL_USE_TLS = True
EMAIL_USE_SSL = False
EMAIL_HOST_PASSWORD = 'password'
EMAIL_PREFIX = 'PREFIX' # Mail subject will be "PREFIX subjecttext"

# meta information's about the plant site
PYSCADA_META = {
'name':'A SHORT NAME',
'description':'A SHORT DESCRIPTION',
}

# export properties
#
PYSCADA_EXPORT = {
'file_prefix':'PREFIX_',
'output_folder':'~/measurement_data_dumps',
}
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ Add a Admin User To Your Django Project
::

cd /var/www/pyscada/PyScadaServer
python manage.py createsuperuser
sudo -u pyscada python manage.py createsuperuser


Setup the Webserver (nginx, gunicorn)
Expand Down
10 changes: 10 additions & 0 deletions docs/phant.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Installation
============

add the following line to the urls.py:

::

url(r'^', include('pyscada.phant.urls')),


2 changes: 1 addition & 1 deletion pyscada/core/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

__version__ = '0.7.0rc9'
__version__ = '0.7.0rc10'
__author__ = 'Martin Schröder'

default_app_config = 'pyscada.apps.PyScadaConfig'
Expand Down
6 changes: 3 additions & 3 deletions pyscada/hmi/static/pyscada/js/pyscada/pyscada.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/* Javascript library for the PyScada web client based on jquery and flot,
version 0.7.0rc7
version 0.7.0rc10
Copyright (c) 2013-2018 Martin Schröder
Licensed under the GPL.
*/
var version = "0.7.0rc7"
var version = "0.7.0rc10"
var NOTIFICATION_COUNT = 0
var UPDATE_STATUS_COUNT = 0;
var INIT_STATUS_COUNT = 0;
Expand Down Expand Up @@ -161,7 +161,7 @@ function data_handler(){

if(AUTO_UPDATE_ACTIVE){
if(DATA_TO_TIMESTAMP==0){
data_handler_ajax(0,[],Date.now());
data_handler_ajax(0,[],[],Date.now());
}else{
if(FETCH_DATA_PENDING<=0){
// fetch new data
Expand Down
2 changes: 1 addition & 1 deletion pyscada/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ class Device(models.Model):
(1800.0, '30 Minutes'),
(3600.0, '1 Hour'),
)
polling_interval = models.FloatField(default=5, choices=polling_interval_choices)
polling_interval = models.FloatField(default=polling_interval_choices[3][0], choices=polling_interval_choices)

def __str__(self):
return self.short_name
Expand Down
5 changes: 4 additions & 1 deletion pyscada/phant/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ def get_queryset(self, request):
"""Limit Pages to those that belong to the request's user."""
qs = super(PhantDeviceAdmin, self).get_queryset(request)
return qs.filter(protocol_id=PROTOCOL_ID)


inlines = [
PhantDeviceAdminInline
]

class PhantVariableAdmin(VariableAdmin):
def formfield_for_foreignkey(self, db_field, request, **kwargs):
Expand Down

0 comments on commit d3a9aff

Please sign in to comment.