updates 2024-07-31
This commit is contained in:
BIN
IG502 Edge Compute/device_supervisor-V3.1.5.tar.gz
Normal file
BIN
IG502 Edge Compute/device_supervisor-V3.1.5.tar.gz
Normal file
Binary file not shown.
BIN
IG502 Firmware/IG502-V2.1.10.bin
Normal file
BIN
IG502 Firmware/IG502-V2.1.10.bin
Normal file
Binary file not shown.
325
InHand IG502 configs/ACU302_WIFI_No_Internet_Verizon.cnf
Normal file
325
InHand IG502 configs/ACU302_WIFI_No_Internet_Verizon.cnf
Normal file
@@ -0,0 +1,325 @@
|
|||||||
|
!
|
||||||
|
#system config
|
||||||
|
language English
|
||||||
|
hostname EdgeGateway
|
||||||
|
ip domain-name edgegateway.com.cn
|
||||||
|
clock timezone CST6CDT,M3.2.0/2,M11.1.0/2
|
||||||
|
service password-encryption
|
||||||
|
!
|
||||||
|
#log config
|
||||||
|
log persistent severity 7
|
||||||
|
!
|
||||||
|
#user config
|
||||||
|
username ASS privilege 15 password $1$EmiUWl8i$lO4gaFNPRI3xC9tJXSl7/0
|
||||||
|
!
|
||||||
|
enable password $1$kvwao0Sc$zzKGmDaqupdkXYaaObwJx/
|
||||||
|
!
|
||||||
|
#aaa config
|
||||||
|
!
|
||||||
|
#cron config
|
||||||
|
chronos reboot every day 3 5
|
||||||
|
remote-login retry 20
|
||||||
|
!
|
||||||
|
#alarm config
|
||||||
|
!
|
||||||
|
#loopback config
|
||||||
|
interface loopback 1
|
||||||
|
ip address 127.0.0.1 255.0.0.0
|
||||||
|
!
|
||||||
|
!
|
||||||
|
#ethernet interface config
|
||||||
|
interface fastethernet 0/1
|
||||||
|
track l2-state
|
||||||
|
!
|
||||||
|
interface fastethernet 0/2
|
||||||
|
!
|
||||||
|
!
|
||||||
|
#Ethernet sub interface config
|
||||||
|
!
|
||||||
|
#cellular config
|
||||||
|
cellular 1 gsm profile 1 so01.vzwstatic use-blank-dialno auto
|
||||||
|
cellular 1 gsm profile 2 ss01.vzwstatic use-blank-dialno auto
|
||||||
|
cellular 1 dial interval 10
|
||||||
|
cellular 1 signal interval 120
|
||||||
|
cellular 1 network auto
|
||||||
|
cellular 1 dual-sim enable
|
||||||
|
cellular 1 dual-sim main 1
|
||||||
|
cellular 1 dual-sim policy redial 5
|
||||||
|
cellular 1 sms mode text
|
||||||
|
cellular 1 sms interval 30
|
||||||
|
!
|
||||||
|
interface cellular 1
|
||||||
|
dialer profile 1
|
||||||
|
dialer profile 1 secondary
|
||||||
|
dialer timeout 120
|
||||||
|
dialer activate auto
|
||||||
|
ip address negotiated
|
||||||
|
ip mru 1500
|
||||||
|
ip mtu 1500
|
||||||
|
ppp ipcp dns request
|
||||||
|
ppp keepalive 55 5
|
||||||
|
!
|
||||||
|
!
|
||||||
|
#dot11 config
|
||||||
|
dot11 ssid 0x416D657275735F43616D6572615F547261696C65725F333032
|
||||||
|
authentication key-management wpa 2
|
||||||
|
guest-mode
|
||||||
|
wpa-psk ascii $AES$141379B1941FC8B4F060D86C067FEA7D
|
||||||
|
!
|
||||||
|
interface dot11radio 1
|
||||||
|
ip address 192.168.2.1 255.255.255.0
|
||||||
|
ssid 0x416D657275735F43616D6572615F547261696C65725F333032
|
||||||
|
encryption mode ciphers aes-ccm
|
||||||
|
802.11n bandwidth 20
|
||||||
|
!
|
||||||
|
!
|
||||||
|
#bridge config
|
||||||
|
!
|
||||||
|
bridge 1
|
||||||
|
!
|
||||||
|
interface bridge 1
|
||||||
|
ip address 192.168.1.1 255.255.255.0
|
||||||
|
!
|
||||||
|
interface fastethernet 0/2
|
||||||
|
bridge-group 1
|
||||||
|
!
|
||||||
|
interface fastethernet 0/1
|
||||||
|
bridge-group 1
|
||||||
|
!
|
||||||
|
!
|
||||||
|
!
|
||||||
|
#dialer config
|
||||||
|
!
|
||||||
|
#ipsec config
|
||||||
|
crypto ipsec-daemon stop
|
||||||
|
!
|
||||||
|
#l2tp config
|
||||||
|
!
|
||||||
|
#openvpn config
|
||||||
|
!
|
||||||
|
#openvpn server config
|
||||||
|
!
|
||||||
|
#web config
|
||||||
|
ip web-access timeout 300
|
||||||
|
ip https server port 9191
|
||||||
|
ip https access enable
|
||||||
|
!
|
||||||
|
#device-manager config
|
||||||
|
device-manager enable
|
||||||
|
device-manager server iot.inhandnetworks.com
|
||||||
|
device-manager tls
|
||||||
|
device-manager account nmelone@henry-pump.com
|
||||||
|
device-manager location gps
|
||||||
|
!
|
||||||
|
#InConnect config
|
||||||
|
!
|
||||||
|
#Erlang config
|
||||||
|
erlang mode off
|
||||||
|
!
|
||||||
|
#telnet server config
|
||||||
|
no ip telnet server
|
||||||
|
no ip telnet access enable
|
||||||
|
!
|
||||||
|
#ssh server config
|
||||||
|
ip ssh server port 22
|
||||||
|
crypto ssh-key generate rsa modulus 1024
|
||||||
|
ip ssh access enable
|
||||||
|
!
|
||||||
|
#dhcp-relay config
|
||||||
|
!
|
||||||
|
#dns-relay config
|
||||||
|
ip dns-relay server
|
||||||
|
!
|
||||||
|
#dhcp server config
|
||||||
|
interface bridge 1
|
||||||
|
ip dhcp-server enable
|
||||||
|
ip dhcp-server range 192.168.1.2 192.168.1.254
|
||||||
|
ip dhcp-server lease 1440
|
||||||
|
!
|
||||||
|
interface dot11radio 1
|
||||||
|
ip dhcp-server enable
|
||||||
|
ip dhcp-server range 192.168.2.2 192.168.2.254
|
||||||
|
ip dhcp-server lease 1440
|
||||||
|
!
|
||||||
|
!
|
||||||
|
#dns config
|
||||||
|
!
|
||||||
|
#ip host config
|
||||||
|
!
|
||||||
|
#ddns config
|
||||||
|
!
|
||||||
|
#snmp config
|
||||||
|
|
||||||
|
#ovdp config
|
||||||
|
!
|
||||||
|
!
|
||||||
|
|
||||||
|
#dockerd config
|
||||||
|
!
|
||||||
|
|
||||||
|
#portainer config
|
||||||
|
!
|
||||||
|
|
||||||
|
#Azure IoT Edge config
|
||||||
|
!
|
||||||
|
|
||||||
|
#AWS IoT Greengrass config
|
||||||
|
!
|
||||||
|
#ntp server config
|
||||||
|
ntp master 2
|
||||||
|
ntp server 0.pool.ntp.org
|
||||||
|
ntp server 1.pool.ntp.org
|
||||||
|
ntp server 2.pool.ntp.org
|
||||||
|
ntp server 3.pool.ntp.org
|
||||||
|
!
|
||||||
|
!
|
||||||
|
|
||||||
|
#Telegraf config
|
||||||
|
!
|
||||||
|
#email config
|
||||||
|
!
|
||||||
|
#sntp client config
|
||||||
|
sntp-client
|
||||||
|
sntp-client server 0.pool.ntp.org port 123
|
||||||
|
sntp-client server 1.pool.ntp.org port 123
|
||||||
|
sntp-client server 2.pool.ntp.org port 123
|
||||||
|
sntp-client server 3.pool.ntp.org port 123
|
||||||
|
!
|
||||||
|
#gre config
|
||||||
|
!
|
||||||
|
#static route config
|
||||||
|
ip route 0.0.0.0 0.0.0.0 cellular 1 253
|
||||||
|
!
|
||||||
|
#rip config
|
||||||
|
!
|
||||||
|
!
|
||||||
|
#ospf config
|
||||||
|
!
|
||||||
|
!
|
||||||
|
#filtering config
|
||||||
|
!
|
||||||
|
#bgp config
|
||||||
|
!
|
||||||
|
!
|
||||||
|
#firewall config
|
||||||
|
!
|
||||||
|
!
|
||||||
|
interface cellular 1
|
||||||
|
ip access-group 192 admin
|
||||||
|
!
|
||||||
|
interface dot11radio 1
|
||||||
|
ip access-group 150 in
|
||||||
|
ip access-group 150 out
|
||||||
|
!
|
||||||
|
access-list 100 10 permit ip any any
|
||||||
|
access-list 101 10 permit ip any any
|
||||||
|
access-list 102 10 permit ip any any
|
||||||
|
access-list 150 9 permit tcp any 192.168.1.0 0.0.0.255 eq 8000
|
||||||
|
access-list 150 9 remark Allow to NVR
|
||||||
|
access-list 150 10 deny tcp 192.168.2.0 0.0.0.255 any
|
||||||
|
access-list 150 10 remark Block Internet
|
||||||
|
access-list 192 10 permit tcp any any eq 443 log
|
||||||
|
access-list 192 20 deny tcp any any eq 80
|
||||||
|
access-list 192 30 deny tcp any any eq 23
|
||||||
|
access-list 192 50 deny tcp any any eq 53
|
||||||
|
access-list 192 60 deny udp any any eq 53
|
||||||
|
access-list 192 70 permit tcp 216.82.205.207 0.0.0.0 any eq 22 log
|
||||||
|
access-list 192 80 permit tcp 172.85.171.82 0.0.0.0 any eq 22 log
|
||||||
|
access-list 192 90 deny tcp any any eq 22 log
|
||||||
|
interface fastethernet 0/1
|
||||||
|
ip nat outside
|
||||||
|
!
|
||||||
|
interface bridge 1
|
||||||
|
ip nat inside
|
||||||
|
!
|
||||||
|
interface cellular 1
|
||||||
|
ip nat outside
|
||||||
|
!
|
||||||
|
!
|
||||||
|
ip snat inside list 101 interface fastethernet 0/1
|
||||||
|
ip snat inside list 100 interface cellular 1
|
||||||
|
ip dnat outside static tcp interface cellular 1 3327 192.168.1.27 3327 description Ubiquiti
|
||||||
|
ip dnat outside static tcp interface cellular 1 8000 192.168.1.22 8000 description NVR_IVMS
|
||||||
|
ip dnat outside static udp interface cellular 1 554 192.168.1.22 554 description RTSP
|
||||||
|
ip dnat outside static tcp interface cellular 1 554 192.168.1.22 554 description NVR
|
||||||
|
ip dnat outside static tcp interface cellular 1 559 192.168.1.22 559 description NVR
|
||||||
|
ip dnat outside static tcp interface cellular 1 22 192.168.1.22 22 description NVR
|
||||||
|
ip dnat outside static tcp interface cellular 1 3200 192.168.1.22 80 description NVR
|
||||||
|
ip dnat outside static tcp interface cellular 1 3322 192.168.1.22 3322 description NVR
|
||||||
|
!
|
||||||
|
!
|
||||||
|
!
|
||||||
|
!
|
||||||
|
!
|
||||||
|
#tcp mss config
|
||||||
|
ip tcp adjust-mss 1360
|
||||||
|
!
|
||||||
|
!
|
||||||
|
!
|
||||||
|
#netwatcher config
|
||||||
|
!
|
||||||
|
!
|
||||||
|
#sla config
|
||||||
|
!
|
||||||
|
#track config
|
||||||
|
!
|
||||||
|
#vrrpd config
|
||||||
|
!
|
||||||
|
#backup config
|
||||||
|
!
|
||||||
|
#mroute config
|
||||||
|
!
|
||||||
|
#cert config
|
||||||
|
!
|
||||||
|
!
|
||||||
|
#cert enroll config
|
||||||
|
crypto key generate rsa general-keys modulus 1024
|
||||||
|
!
|
||||||
|
!
|
||||||
|
#dls config
|
||||||
|
!
|
||||||
|
#gps config
|
||||||
|
gps enable
|
||||||
|
!
|
||||||
|
#gps serial config
|
||||||
|
!
|
||||||
|
#gps server config
|
||||||
|
!
|
||||||
|
#gps client config
|
||||||
|
!
|
||||||
|
#Serial Configuration
|
||||||
|
serial 1
|
||||||
|
!
|
||||||
|
serial 2
|
||||||
|
!
|
||||||
|
!
|
||||||
|
#python config
|
||||||
|
python enable
|
||||||
|
python log username adm password $AES$BFA541FA10FA3B041CBA4412D12C52B8
|
||||||
|
python app 1 on
|
||||||
|
python appcmd 1 logsize 1 2
|
||||||
|
device_supervisor
|
||||||
|
quit
|
||||||
|
!
|
||||||
|
!
|
||||||
|
#Modbus IO Configuration
|
||||||
|
!
|
||||||
|
#traffic-stated config
|
||||||
|
interface cellular 1
|
||||||
|
traffic-stated statistic
|
||||||
|
!
|
||||||
|
!
|
||||||
|
#data-usage config
|
||||||
|
data-usage sim1
|
||||||
|
daily units MB
|
||||||
|
daily limit 35
|
||||||
|
monthly units GB
|
||||||
|
monthly limit 1
|
||||||
|
!
|
||||||
|
interface cellular 1
|
||||||
|
traffic-stated sim 1 data-usage sim1
|
||||||
|
traffic-stated sim 1 daily-action only-report
|
||||||
|
traffic-stated sim 1 monthly-action only-report
|
||||||
|
traffic-stated sim 1 monitoring
|
||||||
|
!
|
||||||
|
#end of configuration
|
||||||
BIN
Pub_Sub/.DS_Store
vendored
BIN
Pub_Sub/.DS_Store
vendored
Binary file not shown.
BIN
Pub_Sub/advvfdipp/.DS_Store
vendored
BIN
Pub_Sub/advvfdipp/.DS_Store
vendored
Binary file not shown.
51
Pub_Sub/advvfdipp/mistaway/advvfdipp_tags.csv
Normal file
51
Pub_Sub/advvfdipp/mistaway/advvfdipp_tags.csv
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
MeasuringPointName,ControllerName,GroupName,UploadType,DeadZonePercent,DataType,ArrayIndex,EnableBit,BitIndex,reverseBit,Address,Decimal,Len,ReadWrite,Unit,Description,Transform Type,MaxValue,MinValue,MaxScale,MinScale,Gain,Offset,startBit,endBit,Pt,Ct,Mapping_table,TransDecimal,bitMap,msecSample,storageLwTSDB,DataEndianReverse,ReadOffset,ReadLength,WriteOffset,WriteLength,DataParseMethod,BitId
|
||||||
|
flowrate,advvfdipp,default,periodic,,FLOAT,,,,,val_Flowmeter,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
fluidlevel,advvfdipp,default,periodic,,FLOAT,,,,,val_FluidLevel,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
intakepressure,advvfdipp,default,periodic,,FLOAT,,,,,val_IntakePressure,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
intaketemperature,advvfdipp,default,periodic,,FLOAT,,,,,val_IntakeTemperature,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
tubingpressure,advvfdipp,default,periodic,,FLOAT,,,,,val_TubingPressure,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
pidcontrolmode,advvfdipp,default,periodic,,BIT,,,,0,sts_PID_Control,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
wellstatus,advvfdipp,default,periodic,,INT,,0,,,Device_Status_INT,,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
vfdfrequency,advvfdipp,default,periodic,,FLOAT,,,,,VFD_SpeedFdbk,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
flowtotal,advvfdipp,default,periodic,,FLOAT,,,,,Flow_Total[0],2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
energytotal,advvfdipp,default,periodic,,FLOAT,,,,,Energy_Total[0],2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
vfdcurrent,advvfdipp,default,periodic,,FLOAT,,,,,VFD_OutCurrent,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
downholesensorstatus,advvfdipp,default,periodic,,INT,,0,,,Downhole_Sensor_Status_INT,,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
fluidspecificgravity,advvfdipp,default,periodic,,FLOAT,,,,,cfg_FluidSpecificGravity,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
flowtotalyesterday,advvfdipp,default,periodic,,FLOAT,,,,,Flow_Total[1],2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
energytotalyesterday,advvfdipp,default,periodic,,FLOAT,,,,,Energy_Total[1],2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
alarmflowrate,advvfdipp,default,periodic,,BIT,,,,0,alarm_Flowmeter,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
alarmintakepressure,advvfdipp,default,periodic,,BIT,,,,0,alarm_IntakePressure,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
alarmintaketemperature,advvfdipp,default,periodic,,BIT,,,,0,alarm_IntakeTemperature,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
alarmtubingpressure,advvfdipp,default,periodic,,BIT,,,,0,alarm_TubingPressure,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
alarmvfd,advvfdipp,default,periodic,,BIT,,,,0,alarm_VFD,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
alarmlockout,advvfdipp,default,periodic,,BIT,,,,0,alarm_Lockout,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
runpermissive,advvfdipp,default,periodic,,INT,,0,,,Run_Permissive_INT,,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
startpermissive,advvfdipp,default,periodic,,INT,,0,,,Start_Permissive_INT,,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
startcommand,advvfdipp,default,periodic,,BIT,,,,0,cmd_Start,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
stopcommand,advvfdipp,default,periodic,,BIT,,,,0,cmd_Stop,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
flowsetpoint,advvfdipp,default,periodic,,FLOAT,,,,,cfg_PID_FlowSP,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
fluidlevelsetpoint,advvfdipp,default,periodic,,FLOAT,,,,,cfg_PID_FluidLevelSP,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
manualfrequencysetpoint,advvfdipp,default,periodic,,FLOAT,,,,,cfg_PID_ManualSP,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
tubingpressuresetpoint,advvfdipp,default,periodic,,FLOAT,,,,,cfg_PID_TubingPressureSP,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
alarmfluidlevel,advvfdipp,default,periodic,,BIT,,,,0,alarm_FluidLevel,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
pressureshutdownlimit,advvfdipp,default,periodic,,FLOAT,,,,,AIn_IntakePressure.Val_LoLim,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
pressurestartuplimit,advvfdipp,default,periodic,,FLOAT,,,,,AIn_IntakePressure.Val_HiLim,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
temperatureshutdownlimit,advvfdipp,default,periodic,,FLOAT,,,,,AIn_IntakeTemperature.Val_HiLim,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
temperaturestartuplimit,advvfdipp,default,periodic,,FLOAT,,,,,AIn_IntakeTemperature.Val_LoLim,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
sensorheight,advvfdipp,default,periodic,,FLOAT,,,,,cfg_DHSensorDistToIntake,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
last_vfd_fault_code,advvfdipp,default,periodic,,INT,,0,,,PowerFlex755.Val_LastFaultCode,,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
vfd_fault,advvfdipp,default,periodic,,INT,,0,,,sts_CurrentVFDFaultCode,,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
controllerfault_io,advvfdipp,default,periodic,,BIT,,,,0,ControllerFault_IO,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
controllerfault_program,advvfdipp,default,periodic,,BIT,,,,0,ControllerFault_Program,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
minvfdfrequency,advvfdipp,default,periodic,,FLOAT,,,,,PowerFlex755.Cfg_MinSpdRef,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
maxvfdfrequency,advvfdipp,default,periodic,,FLOAT,,,,,PowerFlex755.Cfg_MaxSpdRef,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
hartnettotal,advvfdipp,default,periodic,,FLOAT,,,,,in_HART_Flowmeter_Net,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
hartfwdtotal,advvfdipp,default,periodic,,FLOAT,,,,,in_HART_Flowmeter_Fwd,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
hartrevtotal,advvfdipp,default,periodic,,FLOAT,,,,,in_HART_Flowmeter_Rev,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
cmd_Start,advvfdipp,default,periodic,,BIT,,,,0,cmd_Start,,,rw,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
cmd_Stop,advvfdipp,default,periodic,,BIT,,,,0,cmd_Stop,,,rw,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
flow_total_lifetime,advvfdipp,default,periodic,,FLOAT,,,,,Flow_Total_Lifetime,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
totalizer_1_volume,advvfdipp,default,periodic,,FLOAT,,,,,Totalizer_A_MBS,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
totalizer_2_volume,advvfdipp,default,periodic,,FLOAT,,,,,Totalizer_B_MBS,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
totalizer_3_volume,advvfdipp,default,periodic,,FLOAT,,,,,Totalizer_C_MBS,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
98555
Pub_Sub/advvfdipp/mistaway/advvfdipp_tags.json
Normal file
98555
Pub_Sub/advvfdipp/mistaway/advvfdipp_tags.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,3 @@
|
|||||||
# Enter your python code.
|
|
||||||
import json, os, time
|
import json, os, time
|
||||||
from datetime import datetime as dt
|
from datetime import datetime as dt
|
||||||
from common.Logger import logger
|
from common.Logger import logger
|
||||||
|
|||||||
1182
Pub_Sub/ek_chemical/thingsboard/ek_chemical.cfg
Normal file
1182
Pub_Sub/ek_chemical/thingsboard/ek_chemical.cfg
Normal file
File diff suppressed because one or more lines are too long
73
Pub_Sub/ek_chemical/thingsboard/ek_chemical.csv
Normal file
73
Pub_Sub/ek_chemical/thingsboard/ek_chemical.csv
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
MeasuringPointName,ControllerName,GroupName,UploadType,DeadZonePercent,DataType,ArrayIndex,EnableBit,BitIndex,reverseBit,Address,Decimal,Len,CodeType,ReadWrite,Unit,Description,Transform Type,MaxValue,MinValue,MaxScale,MinScale,Gain,Offset,startBit,endBit,Pt,Ct,Mapping_table,TransDecimal,bitMap,msecSample,storageLwTSDB,DataEndianReverse,ReadOffset,ReadLength,WriteOffset,WriteLength,DataParseMethod,BitId,pollCycle
|
||||||
|
chemical_ratio_spt,ek_chemical,default,periodic,,FLOAT,,,,,SPT_Chemical_Ratio,2,,,rw,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
discharge_pressure,ek_chemical,default,periodic,,FLOAT,,,,,Val_Discharge_PSI_Scaled,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
discharge_pressure_hi_alm,ek_chemical,default,periodic,,BIT,,,,0,AL0_Discharge_PSI_Hi,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
dosage_rate,ek_chemical,default,periodic,,FLOAT,,,,,Val_Dosage_Rate_In_PPM,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
flow_meter_01_flow_rate,ek_chemical,default,periodic,,FLOAT,,,,,Val_FlowMeter_FR_1,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
flow_meter_02_flow_rate,ek_chemical,default,periodic,,FLOAT,,,,,Val_FlowMeter_FR_2,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
flow_meter_03_flow_rate,ek_chemical,default,periodic,,FLOAT,,,,,Val_FlowMeter_FR_3,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
manual_chemical_rate_spt,ek_chemical,default,periodic,,FLOAT,,,,,SPT_Manual_Chemical_Rate,2,,,rw,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
pid_auto_cmd,ek_chemical,default,periodic,,BIT,,,,0,CMD_PID_Auto,,,,rw,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
plains_bp1_discharge_pressure,ek_chemical,default,periodic,,FLOAT,,,,,Val_Plains_BP1_Disch_PSI,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
plains_bp2_discharge_pressure,ek_chemical,default,periodic,,FLOAT,,,,,Val_Plains_BP2_Disch_PSI,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
plains_inlet_flow_rate,ek_chemical,default,periodic,,FLOAT,,,,,VaL_Plains_Inlet_FR,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
plains_inlet_h2s,ek_chemical,default,periodic,,FLOAT,,,,,Val_Plains_Inlet_H2S_Reading,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
plains_inlet_h2s_5m_average,ek_chemical,default,periodic,,FLOAT,,,,,Val_Plains_Inlet_H2S_5m_AVG,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
plains_inlet_h2s_average,ek_chemical,default,periodic,,FLOAT,,,,,Val_Plains_Inlet_H2S_AVG,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
plains_outlet_flow_rate,ek_chemical,default,periodic,,FLOAT,,,,,Val_Plains_Outlet_FR,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
plains_outlet_h2s,ek_chemical,default,periodic,,FLOAT,,,,,Val_Plains_Outlet_H2S_Reading,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
plains_outlet_h2s_average,ek_chemical,default,periodic,,INT,,0,,,Val_Plains_Outlet_H2S_AVG,,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
plains_tank_01_level,ek_chemical,default,periodic,,FLOAT,,,,,Val_Plains_Tank_1_Level,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
plains_tank_02_level,ek_chemical,default,periodic,,FLOAT,,,,,Val_Plains_Tank_2_Level,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
plains_total_flow_rate,ek_chemical,default,periodic,,FLOAT,,,,,Val_Plains_Total_FlowMeter_FR,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tank_01_level,ek_chemical,default,periodic,,FLOAT,,,,,Val_Tank_Level_1,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vfd_01_auto,ek_chemical,default,periodic,,BIT,,,,0,FBK_VFD_1_Auto_Mode,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_01_config_mode,ek_chemical,default,periodic,,BIT,,,,0,FBK_VFD_1_Configuration_Mode,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_01_direction_cmd,ek_chemical,default,periodic,,BIT,,,,0,CMD_VFD_1_Direction,,,,rw,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_01_enable_cmd,ek_chemical,default,periodic,,BIT,,,,0,CMD_VFD_1_Enable,,,,rw,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_01_fault_reset_cmd,ek_chemical,default,periodic,,BIT,,,,0,CMD_VFD_1_Fault_Reset,,,,rw,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_01_faulted_alm,ek_chemical,default,periodic,,BIT,,,,0,AL0_VFD_1_Faulted,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_01_general_enable,ek_chemical,default,periodic,,BIT,,,,0,FBK_VFD_1_General_Enable,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_01_hand_cmd,ek_chemical,default,periodic,,BIT,,,,0,CMD_VFD_1_Hand,,,,rw,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_01_job,ek_chemical,default,periodic,,BIT,,,,0,FBK_VFD_1_Jog,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_01_jog_cmd,ek_chemical,default,periodic,,BIT,,,,0,CMD_VFD_1_Jog,,,,rw,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_01_quick_stop,ek_chemical,default,periodic,,BIT,,,,0,FBK_VFD_1_Quick_Stop,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_01_quick_stop_cmd,ek_chemical,default,periodic,,BIT,,,,0,CMD_VFD_1_QuickStop,,,,rw,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_01_remote_cmd,ek_chemical,default,periodic,,BIT,,,,0,CMD_VFD_1_Remote,,,,rw,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_01_remote_control,ek_chemical,default,periodic,,BIT,,,,0,FBK_VFD_1_Remote_Control,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_01_run,ek_chemical,default,periodic,,BIT,,,,0,FBK_VFD_1_Run_Command,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_01_run_cmd,ek_chemical,default,periodic,,BIT,,,,0,CMD_VFD_1_Run,,,,rw,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_01_run_status,ek_chemical,default,periodic,,BIT,,,,0,FBK_VFD_1_Run_Status,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_01_second_ramp,ek_chemical,default,periodic,,BIT,,,,0,FBK_VFD_1_Second_Ramp,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_01_second_ramp_cmd,ek_chemical,default,periodic,,BIT,,,,0,CMD_VFD_1_Second_Ramp,,,,rw,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_01_speed,ek_chemical,default,periodic,,FLOAT,,,,,Val_VFD_1_Speed_FBK_Real,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vfd_01_speed_direction,ek_chemical,default,periodic,,BIT,,,,0,FBK_VFD_1_Speed_Direction,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_01_status,ek_chemical,default,periodic,,BIT,,,,0,FBK_VFD_1_Status,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_01_status_alm,ek_chemical,default,periodic,,BIT,,,,0,AL0_VFD_1_Alarm_Status,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_01_undervoltage_alm,ek_chemical,default,periodic,,BIT,,,,0,AL0_VFD_1_Undervoltage,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_02_auto,ek_chemical,default,periodic,,BIT,,,,0,FBK_VFD_2_Auto_Mode,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_02_config_mode,ek_chemical,default,periodic,,BIT,,,,0,FBK_VFD_2_Configuration_Mode,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_02_direction_cmd,ek_chemical,default,periodic,,BIT,,,,0,CMD_VFD_2_Direction,,,,rw,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_02_enable_cmd,ek_chemical,default,periodic,,BIT,,,,0,CMD_VFD_2_Enable,,,,rw,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_02_fault_reset_cmd,ek_chemical,default,periodic,,BIT,,,,0,CMD_VFD_2_Fault_Reset,,,,rw,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_02_faulted_alm,ek_chemical,default,periodic,,BIT,,,,0,AL0_VFD_2_Faulted,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_02_general_enable,ek_chemical,default,periodic,,BIT,,,,0,FBK_VFD_2_General_Enable,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_02_hand_cmd,ek_chemical,default,periodic,,BIT,,,,0,CMD_VFD_2_Hand,,,,rw,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_02_job,ek_chemical,default,periodic,,BIT,,,,0,FBK_VFD_2_Jog,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_02_jog_cmd,ek_chemical,default,periodic,,BIT,,,,0,CMD_VFD_2_Jog,,,,rw,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_02_quick_stop,ek_chemical,default,periodic,,BIT,,,,0,FBK_VFD_2_Quick_Stop,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_02_quick_stop_cmd,ek_chemical,default,periodic,,BIT,,,,0,CMD_VFD_2_QuickStop,,,,rw,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_02_remote_cmd,ek_chemical,default,periodic,,BIT,,,,0,CMD_VFD_2_Remote,,,,rw,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_02_remote_control,ek_chemical,default,periodic,,BIT,,,,0,FBK_VFD_2_Remote_Control,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_02_run,ek_chemical,default,periodic,,BIT,,,,0,FBK_VFD_2_Run_Command,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_02_run_cmd,ek_chemical,default,periodic,,BIT,,,,0,CMD_VFD_2_Run,,,,rw,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_02_run_status,ek_chemical,default,periodic,,BIT,,,,0,FBK_VFD_2_Run_Status,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_02_second_ramp,ek_chemical,default,periodic,,BIT,,,,0,FBK_VFD_2_Second_Ramp,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_02_second_ramp_cmd,ek_chemical,default,periodic,,BIT,,,,0,CMD_VFD_2_Second_Ramp,,,,rw,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_02_speed,ek_chemical,default,periodic,,FLOAT,,,,,Val_VFD_2_Speed_FBK_Real,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vfd_02_speed_direction,ek_chemical,default,periodic,,BIT,,,,0,FBK_VFD_2_Speed_Direction,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_02_start_spt,ek_chemical,default,periodic,,FLOAT,,,,,SPT_VFD_2_Start_Real,2,,,rw,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vfd_02_status,ek_chemical,default,periodic,,BIT,,,,0,FBK_VFD_2_Status,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_02_status_alm,ek_chemical,default,periodic,,BIT,,,,0,AL0_VFD_2_Alarm_Status,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vfd_02_stop_spt,ek_chemical,default,periodic,,FLOAT,,,,,SPT_VFD_2_Stop_Real,2,,,rw,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vfd_02_undervoltage_alm,ek_chemical,default,periodic,,BIT,,,,0,AL0_VFD_2_Undervoltage,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
2593
Pub_Sub/ek_chemical/thingsboard/ek_chemical_tags.json
Normal file
2593
Pub_Sub/ek_chemical/thingsboard/ek_chemical_tags.json
Normal file
File diff suppressed because it is too large
Load Diff
59
Pub_Sub/ek_chemical/thingsboard/pub/sendData.py
Normal file
59
Pub_Sub/ek_chemical/thingsboard/pub/sendData.py
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
# Enter your python code.
|
||||||
|
import json, os, time
|
||||||
|
from datetime import datetime as dt
|
||||||
|
from common.Logger import logger
|
||||||
|
from quickfaas.remotebus import publish
|
||||||
|
from quickfaas.global_dict import get as get_params
|
||||||
|
from quickfaas.global_dict import _set_global_args
|
||||||
|
from mobiuspi_lib.gps import GPS
|
||||||
|
|
||||||
|
def reboot(reason="Rebooting for config file update"):
|
||||||
|
#basic = Basic()
|
||||||
|
logger.info("!" * 10 + "REBOOTING DEVICE" + "!"*10)
|
||||||
|
logger.info(reason)
|
||||||
|
r = os.popen("kill -s SIGHUP `cat /var/run/python/supervisord.pid`").read()
|
||||||
|
logger.info(f"REBOOT : {r}")
|
||||||
|
|
||||||
|
def chunk_payload(payload, chunk_size=20):
|
||||||
|
if "values" in payload:
|
||||||
|
# Original format: {"ts": ..., "values": {...}}
|
||||||
|
chunked_values = list(payload["values"].items())
|
||||||
|
for i in range(0, len(chunked_values), chunk_size):
|
||||||
|
yield {
|
||||||
|
"ts": payload["ts"],
|
||||||
|
"values": dict(chunked_values[i:i+chunk_size])
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
# New format: {"key1": "value1", "key2": "value2"}
|
||||||
|
chunked_keys = list(payload.keys())
|
||||||
|
for i in range(0, len(chunked_keys), chunk_size):
|
||||||
|
yield {k: payload[k] for k in chunked_keys[i:i+chunk_size]}
|
||||||
|
|
||||||
|
def sendData(message):
|
||||||
|
#logger.debug(message)
|
||||||
|
payload = {"ts": (round(dt.timestamp(dt.now())/60)*60)*1000, "values": {}}
|
||||||
|
attributes_payload = {}
|
||||||
|
for measure in message["measures"]:
|
||||||
|
try:
|
||||||
|
logger.debug(measure)
|
||||||
|
if measure["health"] == 1:
|
||||||
|
if "_spt" in measure["name"]:
|
||||||
|
attributes_payload[measure["name"]] = measure["value"]
|
||||||
|
payload["values"][measure["name"]] = measure["value"]
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
|
||||||
|
for chunk in chunk_payload(payload=payload):
|
||||||
|
publish(__topic__, json.dumps(chunk), __qos__)
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
|
attributes_payload["latestReportTime"] = (round(dt.timestamp(dt.now())/600)*600)*1000
|
||||||
|
for chunk in chunk_payload(payload=attributes_payload):
|
||||||
|
publish("v1/devices/me/attributes", json.dumps(chunk), __qos__)
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
|
if not payload["values"]:
|
||||||
|
publish(__topic__, json.dumps({"rebooted": dt.now()}), __qos__)
|
||||||
|
reboot(reason="PLC not connected")
|
||||||
|
|
||||||
75
Pub_Sub/ek_chemical/thingsboard/sub/receiveCommands.py
Normal file
75
Pub_Sub/ek_chemical/thingsboard/sub/receiveCommands.py
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
import json, time
|
||||||
|
from datetime import datetime as dt
|
||||||
|
from quickfaas.measure import recall, write
|
||||||
|
from quickfaas.remotebus import publish
|
||||||
|
from common.Logger import logger
|
||||||
|
|
||||||
|
# Helper function to split the payload into chunks
|
||||||
|
def chunk_payload(payload, chunk_size=20):
|
||||||
|
chunked_values = list(payload["values"].items())
|
||||||
|
for i in range(0, len(chunked_values), chunk_size):
|
||||||
|
yield {
|
||||||
|
"ts": payload["ts"],
|
||||||
|
"values": dict(chunked_values[i:i+chunk_size])
|
||||||
|
}
|
||||||
|
|
||||||
|
def sync():
|
||||||
|
#get new values and send
|
||||||
|
payload = {"ts": round(dt.timestamp(dt.now()))*1000, "values": {}}
|
||||||
|
topic = "v1/devices/me/telemetry"
|
||||||
|
try:
|
||||||
|
data = recall()#json.loads(recall().decode("utf-8"))
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
logger.debug(data)
|
||||||
|
for controller in data:
|
||||||
|
for measure in controller["measures"]:
|
||||||
|
#publish measure
|
||||||
|
payload["values"][measure["name"]] = measure["value"]
|
||||||
|
logger.debug("Sending on topic: {}".format(topic))
|
||||||
|
logger.debug("Sending value: {}".format(payload))
|
||||||
|
for chunk in chunk_payload(payload=payload):
|
||||||
|
publish(topic, json.dumps(chunk), 1)
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
|
def writeplctag(value):
|
||||||
|
#value in the form {"measurement": <measurement_name>, "value": <value to write>}
|
||||||
|
try:
|
||||||
|
#value = json.loads(value.replace("'",'"'))
|
||||||
|
logger.info(value)
|
||||||
|
#payload format: [{"name": "advvfdipp", "measures": [{"name": "manualfrequencysetpoint", "value": 49}]}]
|
||||||
|
message = [{"name": "ek_chemical", "measures":[{"name":value["measurement"], "value": value["value"]}]}]
|
||||||
|
resp = write(message)
|
||||||
|
logger.info("RETURN FROM WRITE: {}".format(resp))
|
||||||
|
return True
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
return False
|
||||||
|
|
||||||
|
def receiveCommand(topic, payload, wizard_api):
|
||||||
|
try:
|
||||||
|
logger.debug(topic)
|
||||||
|
logger.info(json.loads(payload))
|
||||||
|
p = json.loads(payload)
|
||||||
|
command = p["method"]
|
||||||
|
commands = {
|
||||||
|
"sync": sync,
|
||||||
|
"writeplctag": writeplctag,
|
||||||
|
}
|
||||||
|
if command == "setPLCTag":
|
||||||
|
result = commands["writeplctag"](p["params"])
|
||||||
|
if result:
|
||||||
|
sync()
|
||||||
|
#commands[command](p["mac"].lower(),p["payload"]["value"], wizard_api)
|
||||||
|
#logger.debug(command)
|
||||||
|
ack(topic.split("/")[-1], wizard_api)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
|
||||||
|
|
||||||
|
def ack(msgid, wizard_api):
|
||||||
|
#logger.debug(msgid)
|
||||||
|
#logger.debug(mac)
|
||||||
|
#logger.debug(name)
|
||||||
|
#logger.debug(value)
|
||||||
|
wizard_api.mqtt_publish("v1/devices/me/rpc/response/" + str(msgid), json.dumps({"msg": {"time": time.time()}, "metadata": "", "msgType": ""}))
|
||||||
190
Pub_Sub/ek_facility/thingsboard/ek_facility_measures.csv
Normal file
190
Pub_Sub/ek_facility/thingsboard/ek_facility_measures.csv
Normal file
@@ -0,0 +1,190 @@
|
|||||||
|
MeasuringPointName,ControllerName,GroupName,UploadType,DeadZonePercent,DataType,ArrayIndex,EnableBit,BitIndex,reverseBit,Address,Decimal,Len,ReadWrite,Unit,Description,Transform Type,MaxValue,MinValue,MaxScale,MinScale,Gain,Offset,startBit,endBit,Pt,Ct,Mapping_table,TransDecimal,bitMap,msecSample,storageLwTSDB,DataEndianReverse,ReadOffset,ReadLength,WriteOffset,WriteLength,DataParseMethod,BitId
|
||||||
|
a_current,ek_facility,default,periodic,,FLOAT,,,,,Val_A_Current,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
ab_volt,ek_facility,default,periodic,,FLOAT,,,,,Val_AB_Volt,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
ac_volt,ek_facility,default,periodic,,FLOAT,,,,,Val_AC_Volt,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
ait_102a_turbitity,ek_facility,default,periodic,,FLOAT,,,,,AI_102A.Scaled_Out,2,,ro,,Inlet Turbitity Value,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
ait_102b_h2s,ek_facility,default,periodic,,FLOAT,,,,,AI_102B.Scaled_Out,2,,ro,,Inlet H2S Value,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
ait_102c_ph,ek_facility,default,periodic,,FLOAT,,,,,AI_102C.Scaled_Out,2,,ro,,Inlet pH Value,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
ait_102d_oil_in_water,ek_facility,default,periodic,,FLOAT,,,,,AI_102D.Scaled_Out,2,,ro,,Inlet Oil In Water,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
ait_114a_hihi_alm,ek_facility,default,periodic,,BIT,,,,0,AIT_114A.AHH,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
ait_114b_hihi_alm,ek_facility,default,periodic,,BIT,,,,0,AIT_114B.AHH,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
ait_114c_hihi_alm,ek_facility,default,periodic,,BIT,,,,0,AIT_114C.AHH,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
ait_114d_hihi_alm,ek_facility,default,periodic,,BIT,,,,0,AIT_114D.AHH,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
ait_114e_hihi_alm,ek_facility,default,periodic,,BIT,,,,0,AIT_114E.AHH,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
at_109a_turbidity,ek_facility,default,periodic,,FLOAT,,,,,AI_109A.Scaled_Out,2,,ro,,Outlet Turbidity Value,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
at_109b_h2s,ek_facility,default,periodic,,FLOAT,,,,,AI_109B.Scaled_Out,2,,ro,,Outlet H2S Value,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
at_109c_oil_in_water,ek_facility,default,periodic,,FLOAT,,,,,AI_109C.Scaled_Out,2,,ro,,Outlet Oil In Water Value,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
at_109d_o2_in_water,ek_facility,default,periodic,,FLOAT,,,,,AI_109D.Scaled_Out,2,,ro,,Outlet O2 In Water Value,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
at_109e_orp,ek_facility,default,periodic,,FLOAT,,,,,AI_109E.Scaled_Out,2,,ro,,Outlet ORP Value,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
b_current,ek_facility,default,periodic,,FLOAT,,,,,Val_B_Current,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
bc_volt,ek_facility,default,periodic,,FLOAT,,,,,Val_BC_Volt,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
bp_3a_auto,ek_facility,default,periodic,,BIT,,,,0,BP_3A_Auto,,,ro,,M107A HOA Hand Feedback,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
bp_3a_fault,ek_facility,default,periodic,,BIT,,,,0,BP_3A_Fault_FBK,,,ro,,M107A Fault Feedback,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
bp_3a_hand,ek_facility,default,periodic,,BIT,,,,0,BP_3A_Hand,,,ro,,M107A HOA Auto Feedback,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
bp_3a_run,ek_facility,default,periodic,,BIT,,,,0,BP_3A_RUN_FDBK,,,ro,,M107A Run Status,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
bp_3a_run_cmd,ek_facility,default,periodic,,BIT,,,,0,BP_3A,,,ro,,M107A Run Command,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
bp_3a_run_fail_alm,ek_facility,default,periodic,,BIT,,,,0,BP_3A_RUN_FAIL,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
bp_3b_auto,ek_facility,default,periodic,,BIT,,,,0,BP_3B_Auto,,,ro,,M107B HOA Hand Feedback,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
bp_3b_fault,ek_facility,default,periodic,,BIT,,,,0,BP_3B_Fault_FBK,,,ro,,M107B Fault Feedback,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
bp_3b_hand,ek_facility,default,periodic,,BIT,,,,0,BP_3B_Hand,,,ro,,M107B HOA Auto Feedback,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
bp_3b_run,ek_facility,default,periodic,,BIT,,,,0,BP_3B_RUN_FDBK,,,ro,,M107B Run Status,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
bp_3b_run_cmd,ek_facility,default,periodic,,BIT,,,,0,BP_3B,,,ro,,M107B Run Command,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
bp_3b_run_fail_alm,ek_facility,default,periodic,,BIT,,,,0,BP_3B_RUN_FAIL,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
c_current,ek_facility,default,periodic,,FLOAT,,,,,Val_C_Current,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
chemical_pump_01_rate_offset,ek_facility,default,periodic,,FLOAT,,,,,SPT_Chemical_Pump_1_Rate_Offset,2,,ro,%,Operator Adjustment,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
chemical_pump_01_run_status,ek_facility,default,periodic,,BIT,,,,0,FBK_Chemical_Pump_1_Running,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
chemical_pump_auto,ek_facility,default,periodic,,BIT,,,,0,CMD_Chemical_Pump_Auto,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
compressor_ambient_temp,ek_facility,default,periodic,,FLOAT,,,,,Val_Air_Compressor_Ambient_Temp,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
compressor_controller_temp,ek_facility,default,periodic,,FLOAT,,,,,Val_Air_Compressor_Controller_Temp,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
compressor_outlet_pressure,ek_facility,default,periodic,,FLOAT,,,,,Val_Air_Compressor_Outlet_PSI,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
compressor_outlet_temp,ek_facility,default,periodic,,FLOAT,,,,,Val_Air_Compressor_Outlet_Element_Temp,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
ct_200_current,ek_facility,default,periodic,,FLOAT,,,,,CT_200.Scaled_Out,2,,ro,,M-105 Motor Amperage,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
dpi_108a_pressure,ek_facility,default,periodic,,FLOAT,,,,,DPI_108A,2,,ro,,Differential PSI Across Sock Filter,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
dpi_108b_pressure,ek_facility,default,periodic,,FLOAT,,,,,DPI_108B,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
esd_exists,ek_facility,default,periodic,,BIT,,,,0,ESD_Exists,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
fcv_001_valve,ek_facility,default,periodic,,FLOAT,,,,,FCV_001_PRESCALE,2,,ro,,M107A Control Valve Setpoint,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
fcv_002_valve,ek_facility,default,periodic,,FLOAT,,,,,FCV_002_PRESCALE,2,,ro,,M107B Control Valve Setpoint,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
fcv_101a_valve,ek_facility,default,periodic,,FLOAT,,,,,FCV_101A.Scaled_Out,2,,ro,,Reject Stream Throttling Valve Position Feedback,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
fcv_101b_valve,ek_facility,default,periodic,,FLOAT,,,,,FCV_101B.Scaled_Out,2,,ro,,Inlet Stream Throttling Valve Position Feedback,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
fi_101b_popoff,ek_facility,default,periodic,,BIT,,,,0,FI_101B.Discrete_Input,,,ro,,Reject Stream Popoff Flow Switch,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
fis_112_h2o2_popoff,ek_facility,default,periodic,,BIT,,,,0,FIS_112_FBK,,,ro,,H2O2 Popoff Flow Switch,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
fit_004_hihi_alm,ek_facility,default,periodic,,BIT,,,,0,FIT_004.AHH,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
fit_100_flow_rate,ek_facility,default,periodic,,FLOAT,,,,,FIT_100.Scaled_Out,2,,ro,,Inlet Flow Rate To ACW,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
fit_100_hi_alm,ek_facility,default,periodic,,BIT,,,,0,FIT_100.AH,,,ro,,Inlet Flow Rate To ACW Hi,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
fit_100_hihi_alm,ek_facility,default,periodic,,BIT,,,,0,FIT_100.AHH,,,ro,,Inlet Flow Rate To ACW HiHi,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
fit_100_lo_alm,ek_facility,default,periodic,,BIT,,,,0,FIT_100.AL,,,ro,,Inlet Flow Rate To ACW Lo,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
fit_100_water_job,ek_facility,default,periodic,,FLOAT,,,,,Val_FIT_100_Job_Total,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
fit_100_water_last_month,ek_facility,default,periodic,,FLOAT,,,,,Val_FIT_100_Water_LastMonth,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
fit_100_water_lifetime,ek_facility,default,periodic,,FLOAT,,,,,Val_FIT_100_Water_T1,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
fit_100_water_month,ek_facility,default,periodic,,FLOAT,,,,,Val_FIT_100_Water_Month,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
fit_100_water_today,ek_facility,default,periodic,,FLOAT,,,,,Val_FIT_100_Water_Todays,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
fit_100_water_yesterday,ek_facility,default,periodic,,FLOAT,,,,,Val_FIT_100_Water_Yest,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
fit_101_flow_rate,ek_facility,default,periodic,,FLOAT,,,,,FIT_101.Scaled_Out,2,,ro,bbls,Reject Stream Flow Rate,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
fit_102_flow_rate,ek_facility,default,periodic,,FLOAT,,,,,FIT_102.Scaled_Out,2,,ro,,Inlet Slip Stream Flow Rate,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
fit_104_n2_rate,ek_facility,default,periodic,,FLOAT,,,,,FIT_004.Scaled_Out,2,,ro,,M-104 Onyx Pump N2 Injection Rate,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
fit_106a_flow_rate,ek_facility,default,periodic,,FLOAT,,,,,FIT_106A.Scaled_Out,2,,ro,,M-106A Flow Rate,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
fit_106a_hihi_alm,ek_facility,default,periodic,,BIT,,,,0,FIT_106A.AHH,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
fit_106b_flow_rate,ek_facility,default,periodic,,FLOAT,,,,,FIT_106B.Scaled_Out,2,,ro,,M-106B Flow Rate,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
fit_106b_hihi_alm,ek_facility,default,periodic,,BIT,,,,0,FIT_106B.AHH,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
fit_107a_flow_rate,ek_facility,default,periodic,,FLOAT,,,,,FIT_107A.Scaled_Out,2,,ro,,M107A Flow Rate,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
fit_107a_lolo_alm,ek_facility,default,periodic,,BIT,,,,0,FIT_107A.ALL,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
fit_107b_flow_rate,ek_facility,default,periodic,,FLOAT,,,,,FIT_107B.Scaled_Out,2,,ro,,M107B Flow Rate,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
fit_107b_lolo_alm,ek_facility,default,periodic,,BIT,,,,0,FIT_107B.ALL,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
fit_109a_flow_rate,ek_facility,default,periodic,,FLOAT,,,,,FIT_109A.Scaled_Out,2,,ro,,Outlet Slip Stream Flow Rate,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
fit_109b_flow_rate,ek_facility,default,periodic,,FLOAT,,,,,FIT_109B.Scaled_Out,2,,ro,,Outlet Sales Meter,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
fit_109b_water_job,ek_facility,default,periodic,,FLOAT,,,,,Val_FIT_109B_Job_Total,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
fit_109b_water_last_month,ek_facility,default,periodic,,FLOAT,,,,,Val_FIT_109B_Water_LastMonth,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
fit_109b_water_lifetime,ek_facility,default,periodic,,FLOAT,,,,,Val_FIT_109B_Water_T1,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
fit_109b_water_month,ek_facility,default,periodic,,FLOAT,,,,,Val_FIT_109B_Water_Month,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
fit_109b_water_today,ek_facility,default,periodic,,FLOAT,,,,,Val_FIT_109B_Water_Todays,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
fit_109b_water_yesterday,ek_facility,default,periodic,,FLOAT,,,,,Val_FIT_109B_Water_Yest,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
fit_111_flow_rate,ek_facility,default,periodic,,FLOAT,,,,,FIT_111.Scaled_Out,2,,ro,,FIT_111 Inlet Gas Flow Rate To ACW,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
fit_112a_h2o2_flow_rate,ek_facility,default,periodic,,FLOAT,,,,,FIT_112A.Scaled_Out,2,,ro,,H2O2 Flow Rate,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
fit_112b_nahso3_flow_rate,ek_facility,default,periodic,,FLOAT,,,,,FIT_112B.Scaled_Out,2,,ro,,NaHSO3 Flow Rate,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
h2o2_chemical_rate,ek_facility,default,periodic,,INT,,0,,,Chemical_Pump_1_Rate,,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
li_103D_level_alm,ek_facility,default,periodic,,BIT,,,,0,LI_103D_FBK,,,ro,,ACW Containment Level Tripped (Red When Tripped Please),none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
lit_101_level,ek_facility,default,periodic,,FLOAT,,,,,LIT_101.Scaled_Out,2,,ro,,Chamber 5 Skim Level In Weir,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
lit_112a_h2o2_level,ek_facility,default,periodic,,FLOAT,,,,,LIT_112A.Scaled_Out,2,,ro,,H2O2 Chemical Level,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
lit_112b_nahso3_level,ek_facility,default,periodic,,FLOAT,,,,,LIT_112B.Scaled_Out,2,,ro,,NaHSO3 Chemical Level,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
lit_170_hihi_alm,ek_facility,default,periodic,,BIT,,,,0,LIT_170.AHH,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
lit_170_level,ek_facility,default,periodic,,FLOAT,,,,,LIT_170.Scaled_Out,2,,ro,,Chamber 5 Level GWR,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
lit_200_hihi_alm,ek_facility,default,periodic,,BIT,,,,0,LIT_200.AHH,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
lit_200_level,ek_facility,default,periodic,,FLOAT,,,,,LIT_200.Scaled_Out,2,,ro,,Chamber 5 Level DP,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
lsh_114_alm,ek_facility,default,periodic,,BIT,,,,0,LSH_114.ALARM,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
lsh_120_alm,ek_facility,default,periodic,,BIT,,,,0,LSH-120.ALARM,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
lsh_120_hihi_alm,ek_facility,default,periodic,,BIT,,,,0,LSH_120,,,ro,,ACW Chamber 5 Level HiHi Switch Tripped (Red When Tripped Please),none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
m106a_vfd_active,ek_facility,default,periodic,,BIT,,,,0,M106A_VFD:I.Active,,,ro,,M-106A Run Status,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
m106a_vfd_faulted_alm,ek_facility,default,periodic,,BIT,,,,0,M106A_VFD:I.Faulted,,,ro,,M-106A Fault Status,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
m106a_vfd_frequency,ek_facility,default,periodic,,INT,,0,,,M106A_VFD:I.OutputFreq,,,ro,,M-106A Current Output Frequency,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
m106a_vfd_start,ek_facility,default,periodic,,BIT,,,,0,M106A_VFD:O.Start,,,ro,,M-106A Start Command,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
m106a_vfd_stop,ek_facility,default,periodic,,BIT,,,,0,M106A_VFD:O.Stop,,,ro,,M-106A Stop Command,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
m106b_vfd_active,ek_facility,default,periodic,,BIT,,,,0,M106B_VFD:I.Active,,,ro,,M-106B Run Status,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
m106b_vfd_faulted_alm,ek_facility,default,periodic,,BIT,,,,0,M106B_VFD:I.Faulted,,,ro,,M-106B Fault Status,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
m106b_vfd_frequency,ek_facility,default,periodic,,INT,,0,,,M106B_VFD:I.OutputFreq,,,ro,,M-106B Current Output Frequency,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
m106b_vfd_start,ek_facility,default,periodic,,BIT,,,,0,M106B_VFD:O.Start,,,ro,,M-106B Start Command,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
m106b_vfd_stop,ek_facility,default,periodic,,BIT,,,,0,M106B_VFD:O.Stop,,,ro,,M-106B Stop Command,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
n2_inlet_pressure,ek_facility,default,periodic,,FLOAT,,,,,Val_N2_Inlet_PSI,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
n2_outlet_flow_rate,ek_facility,default,periodic,,FLOAT,,,,,Val_N2_Outlet_Flow_Rate,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
n2_outlet_pressure,ek_facility,default,periodic,,FLOAT,,,,,Val_ N2_Outlet_ PSI,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
n2_outlet_temp,ek_facility,default,periodic,,FLOAT,,,,,Val_N2_Outlet_Temp,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
n2_purity,ek_facility,default,periodic,,FLOAT,,,,,Val_N2_N2_Purity,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
p100_auto,ek_facility,default,periodic,,BIT,,,,0,P100_Auto,,,ro,,M-104 Onyx Pump HOA Auto Status,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
p100_hand,ek_facility,default,periodic,,BIT,,,,0,P100_Hand,,,ro,,M-104 Onyx Pump HOA Hand Status,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
p200_auto,ek_facility,default,periodic,,BIT,,,,0,P200_Auto,,,ro,,M-105 Skim Pump HOA Hand Status,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
p200_hand,ek_facility,default,periodic,,BIT,,,,0,P200_Hand,,,ro,,M-105 Skim Pump HOA Auto Status,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
pdi_065_hihi_alm,ek_facility,default,periodic,,BIT,,,,0,PDI_065.AHH,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
pdi_065_lo_alm,ek_facility,default,periodic,,BIT,,,,0,PDI_065.AL,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
pdi_065_lolo_alm,ek_facility,default,periodic,,BIT,,,,0,PDI_065.ALL,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
pdi_065_pressure,ek_facility,default,periodic,,FLOAT,,,,,PDI_065.AI_Scaled,2,,ro,,M-104 Onyx Pump Discharge PSI,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
pdt_108a_hi_alm,ek_facility,default,periodic,,BIT,,,,0,PDT_108A.AH,,,ro,,Sock Filter High Differential PSI,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
pdt_108a_hihi_alm,ek_facility,default,periodic,,BIT,,,,0,PDT_108A.AHH,,,ro,,Sock Filter High High Differential PSI,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
pdt_108b_hi_alm,ek_facility,default,periodic,,BIT,,,,0,PDT_108B.AH,,,ro,,Cartrige Filter #1 High Differential PSI,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
pdt_108b_hihi_alm,ek_facility,default,periodic,,BIT,,,,0,PDT_108B.AHH,,,ro,,Cartrige Filter #1 High High Differential PSI,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
pdt_108b_pressure,ek_facility,default,periodic,,FLOAT,,,,,PDT_108B.AI_Scaled,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
pdt_108c_hi_alm,ek_facility,default,periodic,,BIT,,,,0,PDT_108C.AH,,,ro,,Cartrige Filter #2 High Differential PSI,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
pdt_108c_hihi_alm,ek_facility,default,periodic,,BIT,,,,0,PDT_108C.AHH,,,ro,,Cartrige Filter #2 High High Differential PSI,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
pdt_108c_pressure,ek_facility,default,periodic,,FLOAT,,,,,PDT_108C.AI_Scaled,2,,ro,,Differential PSI Across Cartrige Filter #2,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
pit_050_hihi_alm,ek_facility,default,periodic,,BIT,,,,0,PIT_050.AHH,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
pit_050_pressure,ek_facility,default,periodic,,FLOAT,,,,,PIT_050.Scaled_Out,2,,ro,,PIT-104A Onyx Pump Suction PSI,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
pit_065_hihi_alm,ek_facility,default,periodic,,BIT,,,,0,PIT_065.AHH,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
pit_065_pressure,ek_facility,default,periodic,,FLOAT,,,,,PIT_065.Scaled_Out,2,,ro,,PIT_104D Onyx Pump Discharge PSI,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
pit_100_hihi_alm,ek_facility,default,periodic,,BIT,,,,0,PIT_100.AHH,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
pit_100_pressure,ek_facility,default,periodic,,FLOAT,,,,,PIT_100.Scaled_Out,2,,ro,,M-105 Skim Pump Discharge PSI,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
pit_100a_pressure,ek_facility,default,periodic,,FLOAT,,,,,PIT_100A.Scaled_Out,2,,ro,psi,Inlet PSI External To ACW,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
pit_101a_hi_alm,ek_facility,default,periodic,,BIT,,,,0,PIT_101A.AH,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
pit_101a_hihi_alm,ek_facility,default,periodic,,BIT,,,,0,PIT_101A.AHH,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
pit_101a_pressure,ek_facility,default,periodic,,FLOAT,,,,,PIT_101A.Scaled_Out,2,,ro,psi,"Inlet PSI Internal To ACW, Before SDV-101A",none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
pit_101a_transmitter_alm,ek_facility,default,periodic,,BIT,,,,0,PIT_101A.XFail,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
pit_101b_hi_alm,ek_facility,default,periodic,,BIT,,,,0,PIT_P101B.AH,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
pit_101b_hihi_alm,ek_facility,default,periodic,,BIT,,,,0,PIT_101B.AHH,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
pit_101b_pressure,ek_facility,default,periodic,,FLOAT,,,,,PIT_101B.Scaled_Out,2,,ro,psi,"Inlet PSI Internal To ACW, After SDV-101A",none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
pit_101b_transmitter_alm,ek_facility,default,periodic,,BIT,,,,0,PIT_101B.XFail,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
pit_101c_pressure,ek_facility,default,periodic,,FLOAT,,,,,PIT_101C.Scaled_Out,2,,ro,psi,Reject Stream PSI,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
pit_102_hi_alm,ek_facility,default,periodic,,BIT,,,,0,PIT_102.AH,,,ro,,Indicated if PIT102 is in Hi alarm state,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
pit_102_hi_spt,ek_facility,default,periodic,,BIT,,,,0,PIT_102.AH_SP,,,ro,,"PIT_102 Hi Alarm Setpoint, If needed",none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
pit_102_hihi_alm,ek_facility,default,periodic,,BIT,,,,0,PIT_102.AHH,,,ro,,Indicates if PIT102 is in HiHi alarm state,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
pit_102_hihi_spt,ek_facility,default,periodic,,BIT,,,,0,PIT_102.AHH_SP,,,ro,,PIT_102 HiHi Alarm Setpoint If Needed,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
pit_102_pressure,ek_facility,default,periodic,,FLOAT,,,,,PIT_102.Scaled_Out,2,,ro,,Inlet PSI To Reaction Tank,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
pit_106a_hihi_alm,ek_facility,default,periodic,,BIT,,,,0,PIT_106A.AHH,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
pit_106a_pressure,ek_facility,default,periodic,,FLOAT,,,,,PIT_106A.Scaled_Out,2,,ro,,M-106A Discharge PSI,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
pit_106b_hihi_alm,ek_facility,default,periodic,,BIT,,,,0,PIT_106B.AHH,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
pit_106b_pressure,ek_facility,default,periodic,,FLOAT,,,,,PIT_106B.Scaled_Out,2,,ro,,M-106B Discharge PSI,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
pit_106c_pressure,ek_facility,default,periodic,,FLOAT,,,,,PIT_106C.Scaled_Out,2,,ro,,"Reject Stream Discharge Header PSI, Pre SDV 106",none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
pit_106d_pressure,ek_facility,default,periodic,,FLOAT,,,,,PIT_106D.Scaled_Out,2,,ro,,"Reject Stream Discharge Header PSI, Post SDV106",none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
pit_107a_lolo_alm,ek_facility,default,periodic,,BIT,,,,0,PIT_107A.ALL,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
pit_107a_pressure,ek_facility,default,periodic,,FLOAT,,,,,PIT_107A.Scaled_Out,2,,ro,,M107A & M107B Suction Header PSI,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
pit_107b_lolo_alm,ek_facility,default,periodic,,BIT,,,,0,PIT_107B.ALL,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
pit_107b_pressure,ek_facility,default,periodic,,FLOAT,,,,,PIT_107B.Scaled_Out,2,,ro,,M107A Discharge PSI,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
pit_107c_pressure,ek_facility,default,periodic,,FLOAT,,,,,PIT_107C.Scaled_Out,2,,ro,,M107A and M107B Discharge Flow Line PSI,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
pit_107d_pressure,ek_facility,default,periodic,,FLOAT,,,,,PIT_107D.Scaled_Out,2,,ro,,M107B Discharge PSI,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
pit_108_pressure,ek_facility,default,periodic,,FLOAT,,,,,PIT_108G.Scaled_Out,2,,ro,,Post Filter Flow Line PSI,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
pit_108a_hihi_alm,ek_facility,default,periodic,,BIT,,,,0,PIT_108A.AHH,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
pit_108a_pressure,ek_facility,default,periodic,,FLOAT,,,,,PIT_108A.Scaled_Out,2,,ro,,Pre Sock Filter PSI,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
pit_108b_hihi_alm,ek_facility,default,periodic,,BIT,,,,0,PIT_108B.AHH,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
pit_108b_pressure,ek_facility,default,periodic,,FLOAT,,,,,PIT_108B.Scaled_Out,2,,ro,,Post Sock Filter PSI,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
pit_108c_hihi_alm,ek_facility,default,periodic,,BIT,,,,0,PIT_108C.AHH,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
pit_108c_pressure,ek_facility,default,periodic,,FLOAT,,,,,PIT_108C.Scaled_Out,2,,ro,,Pre Cartrige Filter #1 PSI,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
pit_108d_pressure,ek_facility,default,periodic,,FLOAT,,,,,PIT_108D.Scaled_Out,2,,ro,,Post Cartrige Filter #1 PSI,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
pit_108e_pressure,ek_facility,default,periodic,,FLOAT,,,,,PIT_108E.Scaled_Out,2,,ro,,Pre Cartrige Filter #2 PSI,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
pit_108f_pressure,ek_facility,default,periodic,,FLOAT,,,,,PIT_108F.Scaled_Out,2,,ro,,Post Cartrige Filter #2 PSI,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
pit_108g_hihi_alm,ek_facility,default,periodic,,BIT,,,,0,PIT_108G.AHH,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
pit_110_hihi_alm,ek_facility,default,periodic,,BIT,,,,0,PIT_110.AHH,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
pit_110_pressure,ek_facility,default,periodic,,FLOAT,,,,,PIT_110.Scaled_Out,2,,ro,,PIT_103 ACW Vapor Space Pressure,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
pit_111a_hihi_alm,ek_facility,default,periodic,,BIT,,,,0,PIT_111A.AHH,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
pit_111a_n2,ek_facility,default,periodic,,FLOAT,,,,,PIT_111A.Scaled_Out,2,,ro,,N2 System PSI,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
pit_111b_hihi_alm,ek_facility,default,periodic,,BIT,,,,0,PIT_111B.AHH,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
pit_111b_n2,ek_facility,default,periodic,,FLOAT,,,,,PIT_111B.Scaled_Out,2,,ro,,Inlet Skid N2 PSI,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
pit_111c_hihi_alm,ek_facility,default,periodic,,BIT,,,,0,PIT_111C.AHH,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
pit_111c_n2,ek_facility,default,periodic,,FLOAT,,,,,PIT_111C.Scaled_Out,2,,ro,,N2 Outlet Skid PSI,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
pnl_esd_alm,ek_facility,default,periodic,,BIT,,,,0,PNL_ESD.ALARM,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
rmt_sd_alm,ek_facility,default,periodic,,BIT,,,,0,RMT_SD.ALARM,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
scada_stop_cmd,ek_facility,default,periodic,,BIT,,,,0,CMD_Scada_Stop,,,rw,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
sdv_101a,ek_facility,default,periodic,,INT,,1,7,0,Local:12:I.Data,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
sdv106_closed,ek_facility,default,periodic,,BIT,,,,0,SDV106_Closed_FBK,,,ro,,SDV106 Closed Feedback Status,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
sdv106_open,ek_facility,default,periodic,,BIT,,,,0,SDV106_Open_FBK,,,ro,,SDV106 Open Feedback Status,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
skim_total_barrels,ek_facility,default,periodic,,FLOAT,,,,,SKIM_TOTAL_BARRELS,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
spt_chemical_manual_rate,ek_facility,default,periodic,,FLOAT,,,,,SPT_Chemical_Manual_Rate,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
xy_100_run,ek_facility,default,periodic,,BIT,,,,0,XY_100,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
xy_200_run,ek_facility,default,periodic,,BIT,,,,0,XY_200,,,ro,,M-105 Run Command,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
zae_111a_hihi_alm,ek_facility,default,periodic,,BIT,,,,0,ZAE_111A.AHH,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
zae_111b_hihi_alm,ek_facility,default,periodic,,BIT,,,,0,ZAE_111B.AHH,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
1813
Pub_Sub/ek_facility/thingsboard/ek_facility_tb_v1_ekko_1.cfg
Normal file
1813
Pub_Sub/ek_facility/thingsboard/ek_facility_tb_v1_ekko_1.cfg
Normal file
File diff suppressed because one or more lines are too long
3096
Pub_Sub/ek_facility/thingsboard/ek_facility_v3.cfg
Normal file
3096
Pub_Sub/ek_facility/thingsboard/ek_facility_v3.cfg
Normal file
File diff suppressed because one or more lines are too long
190
Pub_Sub/ek_facility/thingsboard/pub/sendData.py
Normal file
190
Pub_Sub/ek_facility/thingsboard/pub/sendData.py
Normal file
@@ -0,0 +1,190 @@
|
|||||||
|
# Enter your python code.
|
||||||
|
import json, os, time
|
||||||
|
from datetime import datetime as dt
|
||||||
|
from common.Logger import logger
|
||||||
|
from quickfaas.remotebus import publish
|
||||||
|
from quickfaas.global_dict import get as get_params
|
||||||
|
from quickfaas.global_dict import _set_global_args
|
||||||
|
from mobiuspi_lib.gps import GPS
|
||||||
|
|
||||||
|
def reboot():
|
||||||
|
#basic = Basic()
|
||||||
|
logger.info("!" * 10 + "REBOOTING DEVICE" + "!"*10)
|
||||||
|
r = os.popen("kill -s SIGHUP `cat /var/run/python/supervisord.pid`").read()
|
||||||
|
logger.info(f"REBOOT : {r}")
|
||||||
|
|
||||||
|
def checkFileExist(filename):
|
||||||
|
path = "/var/user/files"
|
||||||
|
if not os.path.exists(path):
|
||||||
|
logger.info("no folder making files folder in var/user")
|
||||||
|
os.makedirs(path)
|
||||||
|
with open(path + "/" + filename, "a") as f:
|
||||||
|
json.dump({}, f)
|
||||||
|
if not os.path.exists(path + "/" + filename):
|
||||||
|
logger.info("no creds file making creds file")
|
||||||
|
with open(path + "/" + filename, "a") as f:
|
||||||
|
json.dump({}, f)
|
||||||
|
|
||||||
|
def convertDStoJSON(ds):
|
||||||
|
j = dict()
|
||||||
|
for x in ds:
|
||||||
|
j[x["key"]] = x["value"]
|
||||||
|
return j
|
||||||
|
|
||||||
|
def convertJSONtoDS(j):
|
||||||
|
d = []
|
||||||
|
for key in j.keys():
|
||||||
|
d.append({"key": key, "value": j[key]})
|
||||||
|
return d
|
||||||
|
|
||||||
|
def checkCredentialConfig():
|
||||||
|
logger.info("CHECKING CONFIG")
|
||||||
|
cfgpath = "/var/user/cfg/device_supervisor/device_supervisor.cfg"
|
||||||
|
credspath = "/var/user/files/creds.json"
|
||||||
|
cfg = dict()
|
||||||
|
with open(cfgpath, "r") as f:
|
||||||
|
cfg = json.load(f)
|
||||||
|
clouds = cfg.get("clouds")
|
||||||
|
logger.info(clouds)
|
||||||
|
#if not configured then try to configure from stored values
|
||||||
|
if clouds[0]["args"]["clientId"] == "unknown" or clouds[0]["args"]["username"] == "unknown" or not clouds[0]["args"]["passwd"] or clouds[0]["args"]["passwd"] == "unknown":
|
||||||
|
checkFileExist("creds.json")
|
||||||
|
with open(credspath, "r") as c:
|
||||||
|
creds = json.load(c)
|
||||||
|
if creds:
|
||||||
|
logger.info("updating config with stored data")
|
||||||
|
clouds[0]["args"]["clientId"] = creds["clientId"]
|
||||||
|
clouds[0]["args"]["username"] = creds["userName"]
|
||||||
|
clouds[0]["args"]["passwd"] = creds["password"]
|
||||||
|
cfg["clouds"] = clouds
|
||||||
|
cfg = checkParameterConfig(cfg)
|
||||||
|
with open(cfgpath, "w", encoding='utf-8') as n:
|
||||||
|
json.dump(cfg, n, indent=1, ensure_ascii=False)
|
||||||
|
reboot()
|
||||||
|
else:
|
||||||
|
#assuming clouds is filled out, if data is different then assume someone typed in something new and store it, if creds is empty fill with clouds' data
|
||||||
|
checkFileExist("creds.json")
|
||||||
|
with open(credspath, "r") as c:
|
||||||
|
logger.info("updating stored file with new data")
|
||||||
|
cfg = checkParameterConfig(cfg)
|
||||||
|
with open(cfgpath, "w", encoding='utf-8') as n:
|
||||||
|
json.dump(cfg, n, indent=1, ensure_ascii=False)
|
||||||
|
creds = json.load(c)
|
||||||
|
if creds:
|
||||||
|
if creds["clientId"] != clouds[0]["args"]["clientId"]:
|
||||||
|
creds["clientId"] = clouds[0]["args"]["clientId"]
|
||||||
|
if creds["userName"] != clouds[0]["args"]["username"]:
|
||||||
|
creds["userName"] = clouds[0]["args"]["username"]
|
||||||
|
if creds["password"] != clouds[0]["args"]["passwd"]:
|
||||||
|
creds["password"] = clouds[0]["args"]["passwd"]
|
||||||
|
else:
|
||||||
|
creds["clientId"] = clouds[0]["args"]["clientId"]
|
||||||
|
creds["userName"] = clouds[0]["args"]["username"]
|
||||||
|
creds["password"] = clouds[0]["args"]["passwd"]
|
||||||
|
with open(credspath, "w") as cw:
|
||||||
|
json.dump(creds,cw)
|
||||||
|
|
||||||
|
def checkParameterConfig(cfg):
|
||||||
|
logger.info("Checking Parameters!!!!")
|
||||||
|
paramspath = "/var/user/files/params.json"
|
||||||
|
cfgparams = convertDStoJSON(cfg.get("labels"))
|
||||||
|
#check stored values
|
||||||
|
checkFileExist("params.json")
|
||||||
|
with open(paramspath, "r") as f:
|
||||||
|
logger.info("Opened param storage file")
|
||||||
|
params = json.load(f)
|
||||||
|
if params:
|
||||||
|
if cfgparams != params:
|
||||||
|
#go through each param
|
||||||
|
#if not "unknown" and cfg and params aren't the same take from cfg likely updated manually
|
||||||
|
#if key in cfg but not in params copy to params
|
||||||
|
logger.info("equalizing params between cfg and stored")
|
||||||
|
for key in cfgparams.keys():
|
||||||
|
try:
|
||||||
|
if cfgparams[key] != params[key] and cfgparams[key] != "unknown":
|
||||||
|
params[key] = cfgparams[key]
|
||||||
|
except:
|
||||||
|
params[key] = cfgparams[key]
|
||||||
|
cfg["labels"] = convertJSONtoDS(params)
|
||||||
|
_set_global_args(convertJSONtoDS(params))
|
||||||
|
with open(paramspath, "w") as p:
|
||||||
|
json.dump(params, p)
|
||||||
|
else:
|
||||||
|
with open(paramspath, "w") as p:
|
||||||
|
logger.info("initializing param file with params in memory")
|
||||||
|
json.dump(convertDStoJSON(get_params()), p)
|
||||||
|
cfg["labels"] = get_params()
|
||||||
|
|
||||||
|
return cfg
|
||||||
|
|
||||||
|
def getGPS():
|
||||||
|
# Create a gps instance
|
||||||
|
gps = GPS()
|
||||||
|
|
||||||
|
# Retrieve GPS information
|
||||||
|
position_status = gps.get_position_status()
|
||||||
|
logger.debug("position_status: ")
|
||||||
|
logger.debug(position_status)
|
||||||
|
latitude = position_status["latitude"].split(" ")
|
||||||
|
longitude = position_status["longitude"].split(" ")
|
||||||
|
lat_dec = int(latitude[0][:-1]) + (float(latitude[1][:-1])/60)
|
||||||
|
lon_dec = int(longitude[0][:-1]) + (float(longitude[1][:-1])/60)
|
||||||
|
if latitude[2] == "S":
|
||||||
|
lat_dec = lat_dec * -1
|
||||||
|
if longitude[2] == "W":
|
||||||
|
lon_dec = lon_dec * -1
|
||||||
|
#lat_dec = round(lat_dec, 7)
|
||||||
|
#lon_dec = round(lon_dec, 7)
|
||||||
|
logger.info("HERE IS THE GPS COORDS")
|
||||||
|
logger.info(f"LATITUDE: {lat_dec}, LONGITUDE: {lon_dec}")
|
||||||
|
speedKnots = position_status["speed"].split(" ")
|
||||||
|
speedMPH = float(speedKnots[0]) * 1.151
|
||||||
|
return (f"{lat_dec:.8f}",f"{lon_dec:.8f}",f"{speedMPH:.2f}")
|
||||||
|
|
||||||
|
def chunk_payload(payload, chunk_size=20):
|
||||||
|
if "values" in payload:
|
||||||
|
# Original format: {"ts": ..., "values": {...}}
|
||||||
|
chunked_values = list(payload["values"].items())
|
||||||
|
for i in range(0, len(chunked_values), chunk_size):
|
||||||
|
yield {
|
||||||
|
"ts": payload["ts"],
|
||||||
|
"values": dict(chunked_values[i:i+chunk_size])
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
# New format: {"key1": "value1", "key2": "value2"}
|
||||||
|
chunked_keys = list(payload.keys())
|
||||||
|
for i in range(0, len(chunked_keys), chunk_size):
|
||||||
|
yield {k: payload[k] for k in chunked_keys[i:i+chunk_size]}
|
||||||
|
|
||||||
|
def sendData(message):
|
||||||
|
#logger.debug(message)
|
||||||
|
try:
|
||||||
|
checkCredentialConfig()
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
payload = {"ts": (round(dt.timestamp(dt.now())/600)*600)*1000, "values": {}}
|
||||||
|
attributes_payload = {}
|
||||||
|
for measure in message["measures"]:
|
||||||
|
try:
|
||||||
|
logger.debug(measure)
|
||||||
|
if measure["health"] == 1:
|
||||||
|
if "_spt" in measure["name"]:
|
||||||
|
attributes_payload[measure["name"]] = measure["value"]
|
||||||
|
payload["values"][measure["name"]] = measure["value"]
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
|
||||||
|
try:
|
||||||
|
payload["values"]["latitude"], payload["values"]["longitude"], payload["values"]["speed"] = getGPS()
|
||||||
|
except:
|
||||||
|
logger.error("Could not get GPS coordinates")
|
||||||
|
|
||||||
|
for chunk in chunk_payload(payload=payload):
|
||||||
|
publish(__topic__, json.dumps(chunk), __qos__)
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
|
attributes_payload["latestReportTime"] = (round(dt.timestamp(dt.now())/600)*600)*1000
|
||||||
|
for chunk in chunk_payload(payload=attributes_payload):
|
||||||
|
publish("v1/devices/me/attributes", json.dumps(chunk), __qos__)
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
75
Pub_Sub/ek_facility/thingsboard/sub/receiveCommands.py
Normal file
75
Pub_Sub/ek_facility/thingsboard/sub/receiveCommands.py
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
import json, time
|
||||||
|
from datetime import datetime as dt
|
||||||
|
from quickfaas.measure import recall, write
|
||||||
|
from quickfaas.remotebus import publish
|
||||||
|
from common.Logger import logger
|
||||||
|
|
||||||
|
# Helper function to split the payload into chunks
|
||||||
|
def chunk_payload(payload, chunk_size=20):
|
||||||
|
chunked_values = list(payload["values"].items())
|
||||||
|
for i in range(0, len(chunked_values), chunk_size):
|
||||||
|
yield {
|
||||||
|
"ts": payload["ts"],
|
||||||
|
"values": dict(chunked_values[i:i+chunk_size])
|
||||||
|
}
|
||||||
|
|
||||||
|
def sync():
|
||||||
|
#get new values and send
|
||||||
|
payload = {"ts": round(dt.timestamp(dt.now()))*1000, "values": {}}
|
||||||
|
topic = "v1/devices/me/telemetry"
|
||||||
|
try:
|
||||||
|
data = recall()#json.loads(recall().decode("utf-8"))
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
logger.debug(data)
|
||||||
|
for controller in data:
|
||||||
|
for measure in controller["measures"]:
|
||||||
|
#publish measure
|
||||||
|
payload["values"][measure["name"]] = measure["value"]
|
||||||
|
logger.debug("Sending on topic: {}".format(topic))
|
||||||
|
logger.debug("Sending value: {}".format(payload))
|
||||||
|
for chunk in chunk_payload(payload=payload):
|
||||||
|
publish(topic, json.dumps(chunk), 1)
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
|
def writeplctag(value):
|
||||||
|
#value in the form {"measurement": <measurement_name>, "value": <value to write>}
|
||||||
|
try:
|
||||||
|
#value = json.loads(value.replace("'",'"'))
|
||||||
|
logger.info(value)
|
||||||
|
#payload format: [{"name": "advvfdipp", "measures": [{"name": "manualfrequencysetpoint", "value": 49}]}]
|
||||||
|
message = [{"name": "ek_facility", "measures":[{"name":value["measurement"], "value": value["value"]}]}]
|
||||||
|
resp = write(message)
|
||||||
|
logger.info("RETURN FROM WRITE: {}".format(resp))
|
||||||
|
return True
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
return False
|
||||||
|
|
||||||
|
def receiveCommand(topic, payload, wizard_api):
|
||||||
|
try:
|
||||||
|
logger.debug(topic)
|
||||||
|
logger.info(json.loads(payload))
|
||||||
|
p = json.loads(payload)
|
||||||
|
command = p["method"]
|
||||||
|
commands = {
|
||||||
|
"sync": sync,
|
||||||
|
"writeplctag": writeplctag,
|
||||||
|
}
|
||||||
|
if command == "setPLCTag":
|
||||||
|
result = commands["writeplctag"](p["params"])
|
||||||
|
if result:
|
||||||
|
sync()
|
||||||
|
#commands[command](p["mac"].lower(),p["payload"]["value"], wizard_api)
|
||||||
|
#logger.debug(command)
|
||||||
|
ack(topic.split("/")[-1], wizard_api)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
|
||||||
|
|
||||||
|
def ack(msgid, wizard_api):
|
||||||
|
#logger.debug(msgid)
|
||||||
|
#logger.debug(mac)
|
||||||
|
#logger.debug(name)
|
||||||
|
#logger.debug(value)
|
||||||
|
wizard_api.mqtt_publish("v1/devices/me/rpc/response/" + str(msgid), json.dumps({"msg": {"time": time.time()}, "metadata": "", "msgType": ""}))
|
||||||
1132
Pub_Sub/fk_transfer/thingsboard/fk_transfer.cfg
Normal file
1132
Pub_Sub/fk_transfer/thingsboard/fk_transfer.cfg
Normal file
File diff suppressed because one or more lines are too long
26
Pub_Sub/fk_transfer/thingsboard/fk_transfer.csv
Normal file
26
Pub_Sub/fk_transfer/thingsboard/fk_transfer.csv
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
MeasuringPointName,ControllerName,GroupName,UploadType,DeadZonePercent,DataType,ArrayIndex,EnableBit,BitIndex,reverseBit,Address,Decimal,Len,ReadWrite,Unit,Description,Transform Type,MaxValue,MinValue,MaxScale,MinScale,Gain,Offset,startBit,endBit,Pt,Ct,Mapping_table,TransDecimal,bitMap,msecSample,storageLwTSDB,DataEndianReverse,ReadOffset,ReadLength,WriteOffset,WriteLength,DataParseMethod,BitId
|
||||||
|
discharge_in,fk_transfer,default,periodic,,FLOAT,,,,,DisPSI_In,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
discharge_out,fk_transfer,default,periodic,,FLOAT,,,,,DisPSI_Out,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
discharge_hi_spt,fk_transfer,default,periodic,,FLOAT,,,,,AlarmSpt_DisPSI_Hi,2,,rw,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
discharge_lo_spt,fk_transfer,default,periodic,,FLOAT,,,,,AlarmSpt_DisPSI_Lo,2,,rw,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
discharge_hi_alm,fk_transfer,default,periodic,,BIT,,,,0,Alarm_DisPSI_Hi,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
discharge_lo_alm,fk_transfer,default,periodic,,BIT,,,,0,Alarm_DisPSI_Lo,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
alarm_enable_cmd,fk_transfer,default,periodic,,INT,,0,,,Alarm_Enable,,,rw,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
aa_flow_rate,fk_transfer,default,periodic,,FLOAT,,,,,Flow_Rate_AA,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
aa_totalizer_1,fk_transfer,default,periodic,,FLOAT,,,,,Totalizer_1_AA,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
flow_rate_hi_spt,fk_transfer,default,periodic,,FLOAT,,,,,AlarmSpt_FlowRate_Hi,2,,rw,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
flow_rate_lo_spt,fk_transfer,default,periodic,,FLOAT,,,,,AlarmSpt_FlowRate_Lo,2,,rw,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
flow_rate_hi_alm,fk_transfer,default,periodic,,BIT,,,,0,Alarm_FlowRate_Hi,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
flow_rate_lo_alm,fk_transfer,default,periodic,,BIT,,,,0,Alarm_FlowRate_Lo,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
pond_level,fk_transfer,default,periodic,,FLOAT,,,,,PondLvl,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
pond_level_hi_spt,fk_transfer,default,periodic,,FLOAT,,,,,AlarmSpt_PondLvl_Hi,2,,rw,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
pond_level_lo_spt,fk_transfer,default,periodic,,FLOAT,,,,,AlarmSpt_PondLvl_Lo,2,,rw,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
pond_level_hi_alm,fk_transfer,default,periodic,,BIT,,,,0,Alarm_PondLvl_Hi,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
pond_level_lo_alm,fk_transfer,default,periodic,,BIT,,,,0,Alarm_Pondlvl_Lo,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
power_loss_120v_alm,fk_transfer,default,periodic,,BIT,,,,0,Alarm_PowerLoss_120V,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
vfd_ready,fk_transfer,default,periodic,,BIT,,,,0,VFD_Ready,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
vfd_warning,fk_transfer,default,periodic,,BIT,,,,0,VFD_Warning,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
vfd_faulted,fk_transfer,default,periodic,,BIT,,,,0,VFD_Faulted,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
vfd_running,fk_transfer,default,periodic,,BIT,,,,0,VFD_Running,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
vfd_frequency_reference,fk_transfer,default,periodic,,FLOAT,,,,,VFD_Freq_Ref,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
vfd_frequency_output,fk_transfer,default,periodic,,FLOAT,,,,,VFD_Output_Freq,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
5468
Pub_Sub/fk_transfer/thingsboard/fk_transferTags.json
Normal file
5468
Pub_Sub/fk_transfer/thingsboard/fk_transferTags.json
Normal file
File diff suppressed because it is too large
Load Diff
256
Pub_Sub/fk_transfer/thingsboard/pub/sendData.py
Normal file
256
Pub_Sub/fk_transfer/thingsboard/pub/sendData.py
Normal file
@@ -0,0 +1,256 @@
|
|||||||
|
# Enter your python code.
|
||||||
|
import json, os, time, shutil
|
||||||
|
from datetime import datetime as dt
|
||||||
|
from common.Logger import logger
|
||||||
|
from quickfaas.remotebus import publish
|
||||||
|
from quickfaas.global_dict import get as get_params
|
||||||
|
from quickfaas.global_dict import _set_global_args
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def chunk_payload(payload, chunk_size=20):
|
||||||
|
if "values" in payload:
|
||||||
|
# Original format: {"ts": ..., "values": {...}}
|
||||||
|
chunked_values = list(payload["values"].items())
|
||||||
|
for i in range(0, len(chunked_values), chunk_size):
|
||||||
|
yield {
|
||||||
|
"ts": payload["ts"],
|
||||||
|
"values": dict(chunked_values[i:i+chunk_size])
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
# New format: {"key1": "value1", "key2": "value2"}
|
||||||
|
chunked_keys = list(payload.keys())
|
||||||
|
for i in range(0, len(chunked_keys), chunk_size):
|
||||||
|
yield {k: payload[k] for k in chunked_keys[i:i+chunk_size]}
|
||||||
|
|
||||||
|
|
||||||
|
def sendData(message):
|
||||||
|
#logger.debug(message)
|
||||||
|
payload = {"ts": (round(dt.timestamp(dt.now())/600)*600)*1000, "values": {}}
|
||||||
|
attributes_payload = {}
|
||||||
|
resetPayload = {"ts": "", "values": {}}
|
||||||
|
dayReset, weekReset, monthReset, yearReset = False, False, False, False
|
||||||
|
for measure in message["measures"]:
|
||||||
|
try:
|
||||||
|
logger.debug(measure)
|
||||||
|
if measure["health"] == 1:
|
||||||
|
if "_spt" in measure["name"]:
|
||||||
|
attributes_payload[measure["name"]] = measure["value"]
|
||||||
|
elif measure in ["totalizer_1"]:
|
||||||
|
payload["values"]["day_volume"], dayReset = totalizeDay(measure["value"])
|
||||||
|
payload["values"]["week_volume"], weekReset = totalizeWeek(measure["value"])
|
||||||
|
payload["values"]["month_volume"], monthReset = totalizeMonth(measure["value"])
|
||||||
|
payload["values"]["year_volume"], yearReset = totalizeYear(measure["value"])
|
||||||
|
payload["values"][measure["name"]] = measure["value"]
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
|
||||||
|
|
||||||
|
for chunk in chunk_payload(payload=payload):
|
||||||
|
publish(__topic__, json.dumps(chunk), __qos__, cloud_name="FK Transfer")
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
|
attributes_payload["latestReportTime"] = (round(dt.timestamp(dt.now())/600)*600)*1000
|
||||||
|
for chunk in chunk_payload(payload=attributes_payload):
|
||||||
|
publish("v1/devices/me/attributes", json.dumps(chunk), __qos__, cloud_name="FK Transfer")
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
|
if dayReset:
|
||||||
|
resetPayload["values"]["yesterday_volume"] = payload["values"]["day_volume"]
|
||||||
|
resetPayload["values"]["day_volume"] = 0
|
||||||
|
if weekReset:
|
||||||
|
resetPayload["values"]["last_week_volume"] = payload["values"]["week_volume"]
|
||||||
|
resetPayload["values"]["week_volume"] = 0
|
||||||
|
if monthReset:
|
||||||
|
resetPayload["values"]["last_month_volume"] = payload["values"]["month_volume"]
|
||||||
|
resetPayload["values"]["month_volume"] = 0
|
||||||
|
if yearReset:
|
||||||
|
resetPayload["values"]["last_year_volume"] = payload["values"]["year_volume"]
|
||||||
|
resetPayload["values"]["year_volume"] = 0
|
||||||
|
|
||||||
|
if resetPayload["values"]:
|
||||||
|
resetPayload["ts"] = 1 + (round(dt.timestamp(dt.now())/600)*600)*1000
|
||||||
|
publish(__topic__, json.dumps(resetPayload), __qos__, cloud_name="FK Transfer")
|
||||||
|
|
||||||
|
|
||||||
|
def initialize_totalizers():
|
||||||
|
return {
|
||||||
|
"day": 0,
|
||||||
|
"week": 0,
|
||||||
|
"month": 0,
|
||||||
|
"year": 0,
|
||||||
|
"lifetime": 0,
|
||||||
|
"dayHolding": 0,
|
||||||
|
"weekHolding": 0,
|
||||||
|
"monthHolding": 0,
|
||||||
|
"yearHolding": 0
|
||||||
|
}
|
||||||
|
|
||||||
|
def getTotalizers(file_path="/var/user/files/totalizers.json"):
|
||||||
|
"""
|
||||||
|
Retrieves totalizer data from a JSON file.
|
||||||
|
|
||||||
|
:param file_path: Path to the JSON file storing totalizer data.
|
||||||
|
:return: Dictionary containing totalizer values.
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
with open(file_path, "r") as t:
|
||||||
|
totalizers = json.load(t)
|
||||||
|
if not totalizers or not isinstance(totalizers, dict):
|
||||||
|
logger.info("Invalid data format in the file. Initializing totalizers.")
|
||||||
|
totalizers = initialize_totalizers()
|
||||||
|
except FileNotFoundError:
|
||||||
|
logger.info("File not found. Initializing totalizers.")
|
||||||
|
totalizers = initialize_totalizers()
|
||||||
|
except json.JSONDecodeError:
|
||||||
|
timestamp = dt.now().strftime("%Y%m%d_%H%M%S")
|
||||||
|
# Split the file path and insert the timestamp before the extension
|
||||||
|
file_name, file_extension = os.path.splitext(file_path)
|
||||||
|
backup_file_path = f"{file_name}_{timestamp}{file_extension}"
|
||||||
|
shutil.copyfile(file_path, backup_file_path)
|
||||||
|
logger.error(f"Error decoding JSON. A backup of the file is created at {backup_file_path}. Initializing totalizers.")
|
||||||
|
totalizers = initialize_totalizers()
|
||||||
|
return totalizers
|
||||||
|
|
||||||
|
def saveTotalizers(totalizers, file_path="/var/user/files/totalizers.json"):
|
||||||
|
"""
|
||||||
|
Saves totalizer data to a JSON file.
|
||||||
|
|
||||||
|
:param totalizers: Dictionary containing totalizer values to be saved.
|
||||||
|
:param file_path: Path to the JSON file where totalizer data will be saved.
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
with open(file_path, "w") as t:
|
||||||
|
json.dump(totalizers, t)
|
||||||
|
except (IOError, OSError, json.JSONEncodeError) as e:
|
||||||
|
logger.error(f"Error saving totalizers to {file_path}: {e}")
|
||||||
|
raise # Optionally re-raise the exception if it should be handled by the caller
|
||||||
|
|
||||||
|
|
||||||
|
def totalizeDay(lifetime, max_retries=3, retry_delay=2):
|
||||||
|
"""
|
||||||
|
Update and save daily totalizers based on the lifetime value.
|
||||||
|
|
||||||
|
:param lifetime: The current lifetime total.
|
||||||
|
:param max_retries: Maximum number of save attempts.
|
||||||
|
:param retry_delay: Delay in seconds between retries.
|
||||||
|
:return: A tuple containing the calculated value and a boolean indicating if a reset occurred, or (None, False) if save fails.
|
||||||
|
"""
|
||||||
|
totalizers = getTotalizers()
|
||||||
|
now = dt.fromtimestamp(round(dt.timestamp(dt.now())/600)*600)
|
||||||
|
reset = False
|
||||||
|
value = lifetime - totalizers["dayHolding"]
|
||||||
|
|
||||||
|
if not int(now.strftime("%d")) == int(totalizers["day"]):
|
||||||
|
totalizers["dayHolding"] = lifetime
|
||||||
|
totalizers["day"] = int(now.strftime("%d"))
|
||||||
|
|
||||||
|
for attempt in range(max_retries):
|
||||||
|
try:
|
||||||
|
saveTotalizers(totalizers)
|
||||||
|
reset = True
|
||||||
|
return (value, reset)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Attempt {attempt + 1} failed to save totalizers: {e}")
|
||||||
|
if attempt < max_retries - 1:
|
||||||
|
time.sleep(retry_delay)
|
||||||
|
else:
|
||||||
|
logger.error("All attempts to save totalizers failed.")
|
||||||
|
return (None, False)
|
||||||
|
|
||||||
|
return (value, reset)
|
||||||
|
|
||||||
|
def totalizeWeek(lifetime, max_retries=3, retry_delay=2):
|
||||||
|
"""
|
||||||
|
Update and save weekly totalizers based on the lifetime value.
|
||||||
|
|
||||||
|
:param lifetime: The current lifetime total.
|
||||||
|
:param max_retries: Maximum number of save attempts.
|
||||||
|
:param retry_delay: Delay in seconds between retries.
|
||||||
|
:return: A tuple containing the calculated value and a boolean indicating if a reset occurred, or (None, False) if save fails.
|
||||||
|
"""
|
||||||
|
totalizers = getTotalizers()
|
||||||
|
now = dt.fromtimestamp(round(dt.timestamp(dt.now())/600)*600)
|
||||||
|
reset = False
|
||||||
|
value = lifetime - totalizers["weekHolding"]
|
||||||
|
if (not now.strftime("%U") == totalizers["week"] and now.strftime("%a") == "Sun") or totalizers["week"] == 0:
|
||||||
|
totalizers["weekHolding"] = lifetime
|
||||||
|
totalizers["week"] = now.strftime("%U")
|
||||||
|
|
||||||
|
for attempt in range(max_retries):
|
||||||
|
try:
|
||||||
|
saveTotalizers(totalizers)
|
||||||
|
reset = True
|
||||||
|
return (value, reset)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Attempt {attempt + 1} failed to save totalizers: {e}")
|
||||||
|
if attempt < max_retries - 1:
|
||||||
|
time.sleep(retry_delay)
|
||||||
|
else:
|
||||||
|
logger.error("All attempts to save totalizers failed.")
|
||||||
|
return (None, False)
|
||||||
|
return (value, reset)
|
||||||
|
|
||||||
|
def totalizeMonth(lifetime, max_retries=3, retry_delay=2):
|
||||||
|
"""
|
||||||
|
Update and save monthly totalizers based on the lifetime value.
|
||||||
|
|
||||||
|
:param lifetime: The current lifetime total.
|
||||||
|
:param max_retries: Maximum number of save attempts.
|
||||||
|
:param retry_delay: Delay in seconds between retries.
|
||||||
|
:return: A tuple containing the calculated value and a boolean indicating if a reset occurred, or (None, False) if save fails.
|
||||||
|
"""
|
||||||
|
totalizers = getTotalizers()
|
||||||
|
now = dt.fromtimestamp(round(dt.timestamp(dt.now())/600)*600)
|
||||||
|
reset = False
|
||||||
|
value = lifetime - totalizers["monthHolding"]
|
||||||
|
if not int(now.strftime("%m")) == int(totalizers["month"]):
|
||||||
|
totalizers["monthHolding"] = lifetime
|
||||||
|
totalizers["month"] = now.strftime("%m")
|
||||||
|
|
||||||
|
for attempt in range(max_retries):
|
||||||
|
try:
|
||||||
|
saveTotalizers(totalizers)
|
||||||
|
reset = True
|
||||||
|
return (value, reset)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Attempt {attempt + 1} failed to save totalizers: {e}")
|
||||||
|
if attempt < max_retries - 1:
|
||||||
|
time.sleep(retry_delay)
|
||||||
|
else:
|
||||||
|
logger.error("All attempts to save totalizers failed.")
|
||||||
|
return (None, False)
|
||||||
|
|
||||||
|
return (value,reset)
|
||||||
|
|
||||||
|
def totalizeYear(lifetime, max_retries=3, retry_delay=2):
|
||||||
|
"""
|
||||||
|
Update and save yearly totalizers based on the lifetime value.
|
||||||
|
|
||||||
|
:param lifetime: The current lifetime total.
|
||||||
|
:param max_retries: Maximum number of save attempts.
|
||||||
|
:param retry_delay: Delay in seconds between retries.
|
||||||
|
:return: A tuple containing the calculated value and a boolean indicating if a reset occurred, or (None, False) if save fails.
|
||||||
|
"""
|
||||||
|
totalizers = getTotalizers()
|
||||||
|
now = dt.fromtimestamp(round(dt.timestamp(dt.now())/600)*600)
|
||||||
|
reset = False
|
||||||
|
value = lifetime - totalizers["yearHolding"]
|
||||||
|
if not int(now.strftime("%Y")) == int(totalizers["year"]):
|
||||||
|
totalizers["yearHolding"] = lifetime
|
||||||
|
totalizers["year"] = now.strftime("%Y")
|
||||||
|
|
||||||
|
for attempt in range(max_retries):
|
||||||
|
try:
|
||||||
|
saveTotalizers(totalizers)
|
||||||
|
reset = True
|
||||||
|
return (value, reset)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Attempt {attempt + 1} failed to save totalizers: {e}")
|
||||||
|
if attempt < max_retries - 1:
|
||||||
|
time.sleep(retry_delay)
|
||||||
|
else:
|
||||||
|
logger.error("All attempts to save totalizers failed.")
|
||||||
|
return (None, False)
|
||||||
|
return (value, reset)
|
||||||
|
|
||||||
64
Pub_Sub/fk_transfer/thingsboard/sub/receiveAttributes.py
Normal file
64
Pub_Sub/fk_transfer/thingsboard/sub/receiveAttributes.py
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
import json, time
|
||||||
|
from datetime import datetime as dt
|
||||||
|
from quickfaas.measure import recall, write
|
||||||
|
from quickfaas.remotebus import publish
|
||||||
|
from common.Logger import logger
|
||||||
|
|
||||||
|
# Helper function to split the payload into chunks
|
||||||
|
def chunk_payload(payload, chunk_size=20):
|
||||||
|
chunked_values = list(payload["values"].items())
|
||||||
|
for i in range(0, len(chunked_values), chunk_size):
|
||||||
|
yield {
|
||||||
|
"ts": payload["ts"],
|
||||||
|
"values": dict(chunked_values[i:i+chunk_size])
|
||||||
|
}
|
||||||
|
|
||||||
|
def sync():
|
||||||
|
#get new values and send
|
||||||
|
payload = {"ts": round(dt.timestamp(dt.now()))*1000, "values": {}}
|
||||||
|
topic = "v1/devices/me/telemetry"
|
||||||
|
try:
|
||||||
|
data = recall()#json.loads(recall().decode("utf-8"))
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
logger.debug(data)
|
||||||
|
for controller in data:
|
||||||
|
for measure in controller["measures"]:
|
||||||
|
#publish measure
|
||||||
|
payload["values"][measure["name"]] = measure["value"]
|
||||||
|
logger.debug("Sending on topic: {}".format(topic))
|
||||||
|
logger.debug("Sending value: {}".format(payload))
|
||||||
|
for chunk in chunk_payload(payload=payload):
|
||||||
|
publish(topic, json.dumps(chunk), 1, cloud_name="FK Transfer")
|
||||||
|
time.sleep(2)
|
||||||
|
def writeplctag(value):
|
||||||
|
#value in the form {"measurement": <measurement_name>, "value": <value to write>}
|
||||||
|
try:
|
||||||
|
#value = json.loads(value.replace("'",'"'))
|
||||||
|
logger.debug(value)
|
||||||
|
#payload format: [{"name": "advvfdipp", "measures": [{"name": "manualfrequencysetpoint", "value": 49}]}]
|
||||||
|
message = [{"name": "fk_transfer", "measures":[{"name":value["measurement"], "value": value["value"]}]}]
|
||||||
|
resp = write(message)
|
||||||
|
logger.debug("RETURN FROM WRITE: {}".format(resp))
|
||||||
|
return True
|
||||||
|
except Exception as e:
|
||||||
|
logger.debug(e)
|
||||||
|
return False
|
||||||
|
|
||||||
|
def receiveAttributes(topic, payload):
|
||||||
|
try:
|
||||||
|
logger.debug(topic)
|
||||||
|
logger.debug(json.loads(payload))
|
||||||
|
p = json.loads(payload)
|
||||||
|
for key, value in p.items():
|
||||||
|
try:
|
||||||
|
result = writeplctag({"measurement":key, "value":value})
|
||||||
|
logger.debug(result)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
#logger.debug(command)
|
||||||
|
sync()
|
||||||
|
except Exception as e:
|
||||||
|
logger.debug(e)
|
||||||
|
|
||||||
|
|
||||||
77
Pub_Sub/fk_transfer/thingsboard/sub/receiveCommand.py
Normal file
77
Pub_Sub/fk_transfer/thingsboard/sub/receiveCommand.py
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
import json, time
|
||||||
|
from datetime import datetime as dt
|
||||||
|
from quickfaas.measure import recall, write
|
||||||
|
from quickfaas.remotebus import publish
|
||||||
|
from common.Logger import logger
|
||||||
|
|
||||||
|
# Helper function to split the payload into chunks
|
||||||
|
def chunk_payload(payload, chunk_size=20):
|
||||||
|
chunked_values = list(payload["values"].items())
|
||||||
|
for i in range(0, len(chunked_values), chunk_size):
|
||||||
|
yield {
|
||||||
|
"ts": payload["ts"],
|
||||||
|
"values": dict(chunked_values[i:i+chunk_size])
|
||||||
|
}
|
||||||
|
|
||||||
|
def sync():
|
||||||
|
#get new values and send
|
||||||
|
payload = {"ts": round(dt.timestamp(dt.now()))*1000, "values": {}}
|
||||||
|
topic = "v1/devices/me/telemetry"
|
||||||
|
try:
|
||||||
|
data = recall()#json.loads(recall().decode("utf-8"))
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
logger.debug(data)
|
||||||
|
for controller in data:
|
||||||
|
for measure in controller["measures"]:
|
||||||
|
#publish measure
|
||||||
|
payload["values"][measure["name"]] = measure["value"]
|
||||||
|
logger.debug("Sending on topic: {}".format(topic))
|
||||||
|
logger.debug("Sending value: {}".format(payload))
|
||||||
|
for chunk in chunk_payload(payload=payload):
|
||||||
|
publish(topic, json.dumps(chunk), 1, cloud_name="FK Transfer")
|
||||||
|
time.sleep(2)
|
||||||
|
def writeplctag(value):
|
||||||
|
#value in the form {"measurement": <measurement_name>, "value": <value to write>}
|
||||||
|
try:
|
||||||
|
#value = json.loads(value.replace("'",'"'))
|
||||||
|
logger.debug(value)
|
||||||
|
#payload format: [{"name": "advvfdipp", "measures": [{"name": "manualfrequencysetpoint", "value": 49}]}]
|
||||||
|
message = [{"name": "fk_transfer", "measures":[{"name":value["measurement"], "value": value["value"]}]}]
|
||||||
|
resp = write(message)
|
||||||
|
logger.debug("RETURN FROM WRITE: {}".format(resp))
|
||||||
|
return True
|
||||||
|
except Exception as e:
|
||||||
|
logger.debug(e)
|
||||||
|
return False
|
||||||
|
|
||||||
|
def receiveCommand(topic, payload):
|
||||||
|
try:
|
||||||
|
logger.debug(topic)
|
||||||
|
logger.debug(json.loads(payload))
|
||||||
|
p = json.loads(payload)
|
||||||
|
command = p["method"]
|
||||||
|
commands = {
|
||||||
|
"sync": sync,
|
||||||
|
"writeplctag": writeplctag,
|
||||||
|
}
|
||||||
|
if command == "setPLCTag":
|
||||||
|
try:
|
||||||
|
result = commands["writeplctag"](p["params"])
|
||||||
|
logger.debug(result)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
#logger.debug(command)
|
||||||
|
ack(topic.split("/")[-1])
|
||||||
|
time.sleep(5)
|
||||||
|
sync()
|
||||||
|
except Exception as e:
|
||||||
|
logger.debug(e)
|
||||||
|
|
||||||
|
|
||||||
|
def ack(msgid):
|
||||||
|
#logger.debug(msgid)
|
||||||
|
#logger.debug(mac)
|
||||||
|
#logger.debug(name)
|
||||||
|
#logger.debug(value)
|
||||||
|
publish("v1/devices/me/rpc/response/" + str(msgid), json.dumps({"msg": {"time": time.time()}, "metadata": "", "msgType": ""}), 1, cloud_name="FK Transfer")
|
||||||
322
Pub_Sub/fkplcpond/thingsboard/bp-compressor.cfg
Normal file
322
Pub_Sub/fkplcpond/thingsboard/bp-compressor.cfg
Normal file
File diff suppressed because one or more lines are too long
@@ -156,7 +156,8 @@ def initialize_totalizers():
|
|||||||
"dayHolding": 0,
|
"dayHolding": 0,
|
||||||
"weekHolding": 0,
|
"weekHolding": 0,
|
||||||
"monthHolding": 0,
|
"monthHolding": 0,
|
||||||
"yearHolding": 0
|
"yearHolding": 0,
|
||||||
|
"rolloverCounter": 0
|
||||||
}
|
}
|
||||||
|
|
||||||
def getTotalizers(file_path="/var/user/files/totalizers.json"):
|
def getTotalizers(file_path="/var/user/files/totalizers.json"):
|
||||||
@@ -205,10 +206,10 @@ def sendData(message,wizard_api):
|
|||||||
try:
|
try:
|
||||||
if message["values"]["flowmeter"][measure]["status"] == 1:
|
if message["values"]["flowmeter"][measure]["status"] == 1:
|
||||||
if measure in ["totalizer_1"]:
|
if measure in ["totalizer_1"]:
|
||||||
payload["values"]["day_volume"], dayReset = totalizeDay(message["values"]["flowmeter"][measure]["raw_data"])
|
|
||||||
payload["values"]["week_volume"], weekReset = totalizeWeek(message["values"]["flowmeter"][measure]["raw_data"])
|
|
||||||
payload["values"]["month_volume"], monthReset = totalizeMonth(message["values"]["flowmeter"][measure]["raw_data"])
|
|
||||||
payload["values"]["year_volume"], yearReset = totalizeYear(message["values"]["flowmeter"][measure]["raw_data"])
|
payload["values"]["year_volume"], yearReset = totalizeYear(message["values"]["flowmeter"][measure]["raw_data"])
|
||||||
|
payload["values"]["month_volume"], monthReset = totalizeMonth(message["values"]["flowmeter"][measure]["raw_data"])
|
||||||
|
payload["values"]["week_volume"], weekReset = totalizeWeek(message["values"]["flowmeter"][measure]["raw_data"])
|
||||||
|
payload["values"]["day_volume"], dayReset = totalizeDay(message["values"]["flowmeter"][measure]["raw_data"])
|
||||||
payload["values"][measure] = message["values"]["flowmeter"][measure]["raw_data"]
|
payload["values"][measure] = message["values"]["flowmeter"][measure]["raw_data"]
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(e)
|
logger.error(e)
|
||||||
@@ -289,10 +290,10 @@ def totalizeDay(lifetime, max_retries=3, retry_delay=2):
|
|||||||
totalizers = getTotalizers()
|
totalizers = getTotalizers()
|
||||||
now = dt.fromtimestamp(round(dt.timestamp(dt.now())/600)*600)
|
now = dt.fromtimestamp(round(dt.timestamp(dt.now())/600)*600)
|
||||||
reset = False
|
reset = False
|
||||||
value = lifetime - totalizers["dayHolding"]
|
value = (lifetime + totalizers["rolloverCounter"] * 10000000) - totalizers["dayHolding"]
|
||||||
|
|
||||||
if not int(now.strftime("%d")) == int(totalizers["day"]):
|
if not int(now.strftime("%d")) == int(totalizers["day"]):
|
||||||
totalizers["dayHolding"] = lifetime
|
totalizers["dayHolding"] = lifetime + totalizers["rolloverCounter"] * 10000000
|
||||||
totalizers["day"] = int(now.strftime("%d"))
|
totalizers["day"] = int(now.strftime("%d"))
|
||||||
|
|
||||||
for attempt in range(max_retries):
|
for attempt in range(max_retries):
|
||||||
@@ -322,9 +323,9 @@ def totalizeWeek(lifetime, max_retries=3, retry_delay=2):
|
|||||||
totalizers = getTotalizers()
|
totalizers = getTotalizers()
|
||||||
now = dt.fromtimestamp(round(dt.timestamp(dt.now())/600)*600)
|
now = dt.fromtimestamp(round(dt.timestamp(dt.now())/600)*600)
|
||||||
reset = False
|
reset = False
|
||||||
value = lifetime - totalizers["weekHolding"]
|
value = (lifetime + totalizers["rolloverCounter"] * 10000000) - totalizers["weekHolding"]
|
||||||
if (not now.strftime("%U") == totalizers["week"] and now.strftime("%a") == "Sun") or totalizers["week"] == 0:
|
if (not now.strftime("%U") == totalizers["week"] and now.strftime("%a") == "Sun") or totalizers["week"] == 0:
|
||||||
totalizers["weekHolding"] = lifetime
|
totalizers["weekHolding"] = lifetime + totalizers["rolloverCounter"] * 10000000
|
||||||
totalizers["week"] = now.strftime("%U")
|
totalizers["week"] = now.strftime("%U")
|
||||||
|
|
||||||
for attempt in range(max_retries):
|
for attempt in range(max_retries):
|
||||||
@@ -353,9 +354,9 @@ def totalizeMonth(lifetime, max_retries=3, retry_delay=2):
|
|||||||
totalizers = getTotalizers()
|
totalizers = getTotalizers()
|
||||||
now = dt.fromtimestamp(round(dt.timestamp(dt.now())/600)*600)
|
now = dt.fromtimestamp(round(dt.timestamp(dt.now())/600)*600)
|
||||||
reset = False
|
reset = False
|
||||||
value = lifetime - totalizers["monthHolding"]
|
value = (lifetime + totalizers["rolloverCounter"] * 10000000) - totalizers["monthHolding"]
|
||||||
if not int(now.strftime("%m")) == int(totalizers["month"]):
|
if not int(now.strftime("%m")) == int(totalizers["month"]):
|
||||||
totalizers["monthHolding"] = lifetime
|
totalizers["monthHolding"] = lifetime + totalizers["rolloverCounter"] * 10000000
|
||||||
totalizers["month"] = now.strftime("%m")
|
totalizers["month"] = now.strftime("%m")
|
||||||
|
|
||||||
for attempt in range(max_retries):
|
for attempt in range(max_retries):
|
||||||
@@ -383,23 +384,30 @@ def totalizeYear(lifetime, max_retries=3, retry_delay=2):
|
|||||||
:return: A tuple containing the calculated value and a boolean indicating if a reset occurred, or (None, False) if save fails.
|
:return: A tuple containing the calculated value and a boolean indicating if a reset occurred, or (None, False) if save fails.
|
||||||
"""
|
"""
|
||||||
totalizers = getTotalizers()
|
totalizers = getTotalizers()
|
||||||
|
if not totalizers.get("rolloverCounter"):
|
||||||
|
totalizers["rolloverCounter"] = 0
|
||||||
|
totalizers["lastRawLifetime"] = lifetime
|
||||||
now = dt.fromtimestamp(round(dt.timestamp(dt.now())/600)*600)
|
now = dt.fromtimestamp(round(dt.timestamp(dt.now())/600)*600)
|
||||||
reset = False
|
reset = False
|
||||||
value = lifetime - totalizers["yearHolding"]
|
if totalizers["lastRawLifetime"] > lifetime:
|
||||||
|
totalizers["rolloverCounter"] += 1
|
||||||
|
totalizers["lastRawLifetime"] = lifetime
|
||||||
|
|
||||||
|
value = (lifetime + totalizers["rolloverCounter"] * 10000000) - totalizers["yearHolding"]
|
||||||
if not int(now.strftime("%Y")) == int(totalizers["year"]):
|
if not int(now.strftime("%Y")) == int(totalizers["year"]):
|
||||||
totalizers["yearHolding"] = lifetime
|
totalizers["yearHolding"] = lifetime
|
||||||
totalizers["year"] = now.strftime("%Y")
|
totalizers["year"] = now.strftime("%Y")
|
||||||
|
totalizers["rolloverCounter"] = 0
|
||||||
|
|
||||||
for attempt in range(max_retries):
|
for attempt in range(max_retries):
|
||||||
try:
|
try:
|
||||||
saveTotalizers(totalizers)
|
saveTotalizers(totalizers)
|
||||||
reset = True
|
reset = True
|
||||||
return (value, reset)
|
return (value, reset)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Attempt {attempt + 1} failed to save totalizers: {e}")
|
logger.error(f"Attempt {attempt + 1} failed to save totalizers: {e}")
|
||||||
if attempt < max_retries - 1:
|
if attempt < max_retries - 1:
|
||||||
time.sleep(retry_delay)
|
time.sleep(retry_delay)
|
||||||
else:
|
else:
|
||||||
logger.error("All attempts to save totalizers failed.")
|
logger.error("All attempts to save totalizers failed.")
|
||||||
return (None, False)
|
return (None, False)
|
||||||
return (value, reset)
|
|
||||||
|
|||||||
199
Pub_Sub/hrtankbattery/thingsboard/pub/sendData_sonya.py
Normal file
199
Pub_Sub/hrtankbattery/thingsboard/pub/sendData_sonya.py
Normal file
@@ -0,0 +1,199 @@
|
|||||||
|
# Enter your python code.
|
||||||
|
import json, os, time
|
||||||
|
from datetime import datetime as dt
|
||||||
|
from common.Logger import logger
|
||||||
|
from quickfaas.remotebus import publish
|
||||||
|
from quickfaas.global_dict import get as get_params
|
||||||
|
from quickfaas.global_dict import _set_global_args
|
||||||
|
|
||||||
|
def reboot(reason="Rebooting for config file update"):
|
||||||
|
#basic = Basic()
|
||||||
|
logger.info("!" * 10 + "REBOOTING DEVICE" + "!"*10)
|
||||||
|
logger.info(reason)
|
||||||
|
r = os.popen("kill -s SIGHUP `cat /var/run/python/supervisord.pid`").read()
|
||||||
|
logger.info(f"REBOOT : {r}")
|
||||||
|
|
||||||
|
def checkFileExist(filename):
|
||||||
|
path = "/var/user/files"
|
||||||
|
if not os.path.exists(path):
|
||||||
|
logger.info("no folder making files folder in var/user")
|
||||||
|
os.makedirs(path)
|
||||||
|
with open(path + "/" + filename, "a") as f:
|
||||||
|
json.dump({}, f)
|
||||||
|
if not os.path.exists(path + "/" + filename):
|
||||||
|
logger.info("no creds file making creds file")
|
||||||
|
with open(path + "/" + filename, "a") as f:
|
||||||
|
json.dump({}, f)
|
||||||
|
|
||||||
|
def convertDStoJSON(ds):
|
||||||
|
j = dict()
|
||||||
|
for x in ds:
|
||||||
|
j[x["key"]] = x["value"]
|
||||||
|
return j
|
||||||
|
|
||||||
|
def convertJSONtoDS(j):
|
||||||
|
d = []
|
||||||
|
for key in j.keys():
|
||||||
|
d.append({"key": key, "value": j[key]})
|
||||||
|
return d
|
||||||
|
|
||||||
|
def checkCredentialConfig():
|
||||||
|
logger.debug("CHECKING CONFIG")
|
||||||
|
cfgpath = "/var/user/cfg/device_supervisor/device_supervisor.cfg"
|
||||||
|
credspath = "/var/user/files/creds.json"
|
||||||
|
cfg = dict()
|
||||||
|
with open(cfgpath, "r") as f:
|
||||||
|
cfg = json.load(f)
|
||||||
|
clouds = cfg.get("clouds")
|
||||||
|
logger.debug(clouds)
|
||||||
|
#if not configured then try to configure from stored values
|
||||||
|
if clouds[0]["args"]["clientId"] == "unknown" or clouds[0]["args"]["username"] == "unknown" or not clouds[0]["args"]["passwd"] or clouds[0]["args"]["passwd"] == "unknown":
|
||||||
|
checkFileExist("creds.json")
|
||||||
|
with open(credspath, "r") as c:
|
||||||
|
creds = json.load(c)
|
||||||
|
if creds:
|
||||||
|
logger.debug("updating config with stored data")
|
||||||
|
clouds[0]["args"]["clientId"] = creds["clientId"]
|
||||||
|
clouds[0]["args"]["username"] = creds["userName"]
|
||||||
|
clouds[0]["args"]["passwd"] = creds["password"]
|
||||||
|
cfg["clouds"] = clouds
|
||||||
|
cfg = checkParameterConfig(cfg)
|
||||||
|
with open(cfgpath, "w", encoding='utf-8') as n:
|
||||||
|
json.dump(cfg, n, indent=1, ensure_ascii=False)
|
||||||
|
reboot()
|
||||||
|
else:
|
||||||
|
#assuming clouds is filled out, if data is different then assume someone typed in something new and store it, if creds is empty fill with clouds' data
|
||||||
|
checkFileExist("creds.json")
|
||||||
|
with open(credspath, "r") as c:
|
||||||
|
logger.debug("updating stored file with new data")
|
||||||
|
cfg = checkParameterConfig(cfg)
|
||||||
|
with open(cfgpath, "w", encoding='utf-8') as n:
|
||||||
|
json.dump(cfg, n, indent=1, ensure_ascii=False)
|
||||||
|
creds = json.load(c)
|
||||||
|
if creds:
|
||||||
|
if creds["clientId"] != clouds[0]["args"]["clientId"]:
|
||||||
|
creds["clientId"] = clouds[0]["args"]["clientId"]
|
||||||
|
if creds["userName"] != clouds[0]["args"]["username"]:
|
||||||
|
creds["userName"] = clouds[0]["args"]["username"]
|
||||||
|
if creds["password"] != clouds[0]["args"]["passwd"]:
|
||||||
|
creds["password"] = clouds[0]["args"]["passwd"]
|
||||||
|
else:
|
||||||
|
creds["clientId"] = clouds[0]["args"]["clientId"]
|
||||||
|
creds["userName"] = clouds[0]["args"]["username"]
|
||||||
|
creds["password"] = clouds[0]["args"]["passwd"]
|
||||||
|
with open(credspath, "w") as cw:
|
||||||
|
json.dump(creds,cw)
|
||||||
|
|
||||||
|
def checkParameterConfig(cfg):
|
||||||
|
logger.debug("Checking Parameters!!!!")
|
||||||
|
paramspath = "/var/user/files/params.json"
|
||||||
|
cfgparams = convertDStoJSON(cfg.get("labels"))
|
||||||
|
#check stored values
|
||||||
|
checkFileExist("params.json")
|
||||||
|
with open(paramspath, "r") as f:
|
||||||
|
logger.debug("Opened param storage file")
|
||||||
|
params = json.load(f)
|
||||||
|
if params:
|
||||||
|
if cfgparams != params:
|
||||||
|
#go through each param
|
||||||
|
#if not "unknown" and cfg and params aren't the same take from cfg likely updated manually
|
||||||
|
#if key in cfg but not in params copy to params
|
||||||
|
logger.debug("equalizing params between cfg and stored")
|
||||||
|
for key in cfgparams.keys():
|
||||||
|
try:
|
||||||
|
if cfgparams[key] != params[key] and cfgparams[key] != "unknown":
|
||||||
|
params[key] = cfgparams[key]
|
||||||
|
except:
|
||||||
|
params[key] = cfgparams[key]
|
||||||
|
cfg["labels"] = convertJSONtoDS(params)
|
||||||
|
_set_global_args(convertJSONtoDS(params))
|
||||||
|
with open(paramspath, "w") as p:
|
||||||
|
json.dump(params, p)
|
||||||
|
else:
|
||||||
|
with open(paramspath, "w") as p:
|
||||||
|
logger.debug("initializing param file with params in memory")
|
||||||
|
json.dump(convertDStoJSON(get_params()), p)
|
||||||
|
cfg["labels"] = get_params()
|
||||||
|
|
||||||
|
return cfg
|
||||||
|
|
||||||
|
def chunk_payload(payload, chunk_size=20):
|
||||||
|
if "values" in payload:
|
||||||
|
# Original format: {"ts": ..., "values": {...}}
|
||||||
|
chunked_values = list(payload["values"].items())
|
||||||
|
for i in range(0, len(chunked_values), chunk_size):
|
||||||
|
yield {
|
||||||
|
"ts": payload["ts"],
|
||||||
|
"values": dict(chunked_values[i:i+chunk_size])
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
# New format: {"key1": "value1", "key2": "value2"}
|
||||||
|
chunked_keys = list(payload.keys())
|
||||||
|
for i in range(0, len(chunked_keys), chunk_size):
|
||||||
|
yield {k: payload[k] for k in chunked_keys[i:i+chunk_size]}
|
||||||
|
|
||||||
|
wellNames = {
|
||||||
|
"vessel_1_active_well":{
|
||||||
|
0: "26JM",
|
||||||
|
1: "21JM",
|
||||||
|
2: "14JM"
|
||||||
|
},
|
||||||
|
"vessel_2_active_well":{
|
||||||
|
0: "29LB",
|
||||||
|
1: "24LB",
|
||||||
|
2: "16LB",
|
||||||
|
3: "11LB"
|
||||||
|
},
|
||||||
|
"vessel_3_active_well":{
|
||||||
|
0: "27WA",
|
||||||
|
1: "23WA",
|
||||||
|
2: "17WA",
|
||||||
|
3: "27WA"
|
||||||
|
},
|
||||||
|
"vessel_4_active_well":{
|
||||||
|
0: "28WB",
|
||||||
|
1: "25WB",
|
||||||
|
2: "22WB",
|
||||||
|
3: "15WB",
|
||||||
|
4: "12WB"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def sendData(message):
|
||||||
|
#logger.debug(message)
|
||||||
|
try:
|
||||||
|
checkCredentialConfig()
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
payload = {"ts": (round(dt.timestamp(dt.now())/600)*600)*1000, "values": {}}
|
||||||
|
attributes_payload = {}
|
||||||
|
run_tanks = {}
|
||||||
|
|
||||||
|
for measure in message["measures"]:
|
||||||
|
try:
|
||||||
|
logger.debug(measure)
|
||||||
|
if measure["health"] == 1:
|
||||||
|
if abs(payload["ts"]/1000 - measure["timestamp"]) > 3600:
|
||||||
|
reboot(reason="Poll timestamp and actual timestamp out of sync. Actual: {} Poll: {}".format(payload["ts"]/1000,measure["timestamp"]))
|
||||||
|
if measure["name"] in ["oil_run_tank","water_run_tank"]:
|
||||||
|
run_tanks[measure["name"]] = measure["value"]
|
||||||
|
if "_level" in measure["name"]:
|
||||||
|
run_tanks[measure["name"]] = measure["value"]
|
||||||
|
if measure["name"] in ["vessel_1_active_well","vessel_2_active_well", "vessel_3_active_well", "vessel_4_active_well"]:
|
||||||
|
payload["values"][measure["name"]] = wellNames[measure["name"]].get(measure["value"], "Unknown Well")
|
||||||
|
payload["values"][measure["name"] + "_int"] = measure["value"]
|
||||||
|
payload["values"][measure["name"]] = measure["value"]
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
payload["values"]["oil_run_tank_level"] = run_tanks["oil_0" + str(run_tanks["oil_run_tank"]) + "_level"]
|
||||||
|
payload["values"]["water_run_tank_level"] = run_tanks["water_0" + str(run_tanks["water_run_tank"]) + "_level"]
|
||||||
|
|
||||||
|
for chunk in chunk_payload(payload=payload):
|
||||||
|
publish(__topic__, json.dumps(chunk), __qos__)
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
|
attributes_payload["latestReportTime"] = (round(dt.timestamp(dt.now())/600)*600)*1000
|
||||||
|
for chunk in chunk_payload(payload=attributes_payload):
|
||||||
|
publish("v1/devices/me/attributes", json.dumps(chunk), __qos__, cloud_name="ThingsBoard")
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
5974
Pub_Sub/hrtankbattery/thingsboard/sonya.cfg
Normal file
5974
Pub_Sub/hrtankbattery/thingsboard/sonya.cfg
Normal file
File diff suppressed because one or more lines are too long
340
Pub_Sub/hrtankbattery/thingsboard/sonya_measures.csv
Normal file
340
Pub_Sub/hrtankbattery/thingsboard/sonya_measures.csv
Normal file
@@ -0,0 +1,340 @@
|
|||||||
|
MeasuringPointName,ControllerName,GroupName,UploadType,DeadZonePercent,DataType,ArrayIndex,EnableBit,BitIndex,reverseBit,Address,Decimal,Len,CodeType,ReadWrite,Unit,Description,Transform Type,MaxValue,MinValue,MaxScale,MinScale,Gain,Offset,startBit,endBit,Pt,Ct,Mapping_table,TransDecimal,bitMap,msecSample,storageLwTSDB,DataEndianReverse,ReadOffset,ReadLength,WriteOffset,WriteLength,DataParseMethod,BitId,pollCycle
|
||||||
|
ac_power_alm,hrtankbattery,default,periodic,,BIT,,,,0,Alm_AC_Pwr.Alm_TgtDisagree,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
air_compressor_disharge,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Air_Compressor_Discharge_PSI_Scaled,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
air_compressor_low_discharge_alm,hrtankbattery,default,periodic,,BIT,,,,0,AL0_Air_Compressor_Low_Discharge,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
analog_01_alm,hrtankbattery,default,periodic,,BIT,,,,0,Fault_Analog_Mod_01,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
analog_02_alm,hrtankbattery,default,periodic,,BIT,,,,0,Fault_Analog_Mod_02,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
analog_03_alm,hrtankbattery,default,periodic,,BIT,,,,0,Fault_Analog_Mod_03,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
analog_04_alm,hrtankbattery,default,periodic,,BIT,,,,0,Fault_Analog_Mod_04,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
analog_05_alm,hrtankbattery,default,periodic,,BIT,,,,0,Fault_Analog_Mod_05,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
analog_06_alm,hrtankbattery,default,periodic,,BIT,,,,0,Fault_Analog_Mod_06,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
containment_high_alm,hrtankbattery,default,periodic,,BIT,,,,0,Contain_Hi_Level.Alm_TgtDisagree,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
count_flow_meters,hrtankbattery,default,periodic,,DINT,,0,,,NUMBER_OF_FLOWMETERS,,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
count_lacts,hrtankbattery,default,periodic,,DINT,,0,,,NUMBER_OF_LACTS,,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
count_oil_tanks,hrtankbattery,default,periodic,,DINT,,0,,,NUMBER_OF_OIL_TANKS,,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
count_transfer_pumps,hrtankbattery,default,periodic,,DINT,,0,,,NUMBER_OF_TRANSFER_PUMPS,,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
count_water_tanks,hrtankbattery,default,periodic,,DINT,,0,,,NUMBER_OF_WTR_TANKS,,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
dc_power_alm,hrtankbattery,default,periodic,,BIT,,,,0,DC_Power_OK.Alm_TgtDisagree,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
h2s_alm,hrtankbattery,default,periodic,,BIT,,,,0,H2s_Alarm.Alm_TgtDisagree,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
lact_01_alm,hrtankbattery,default,periodic,,BIT,,,,0,LACT_01_Failure,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
lact_01_bs_w,hrtankbattery,default,periodic,,FLOAT,,,,,Lact_01_BS_and_W_Reading,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
lact_01_bsw,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Lact_BSW,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
lact_01_daily_volume,hrtankbattery,default,periodic,,FLOAT,,,,,Lact_01_Current_Daily_Ind_Volume_Total,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
lact_01_density,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Lact_Density,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
lact_01_flow_rate,hrtankbattery,default,periodic,,FLOAT,,,,,Lact_01_Realtime_Flow_Rate,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
lact_01_gross_flow_rate,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Lact_Gross_FR,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
lact_01_lifetime,hrtankbattery,default,periodic,,FLOAT,,,,,Lact_01_Cumulative_Ind_Volume,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
lact_01_net_flow_rate,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Lact_Net_FR,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
lact_01_net_volume,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Lact_Yest_Net_Volume,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
lact_01_oil_shutdown,hrtankbattery,default,periodic,,BIT,,,,0,LACT_01_Bad_Oil_Shutdown,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
lact_01_permissive,hrtankbattery,default,periodic,,BIT,,,,0,LACT_01_Permissive,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
lact_01_pressure,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Lact_Meter_PSI,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
lact_01_prev_day,hrtankbattery,default,periodic,,FLOAT,,,,,Lact_01_History.Previous_Day_1,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
lact_01_sts,hrtankbattery,default,periodic,,BIT,,,,0,LACT_01_Run_Status,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
lact_01_temperature,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Lact_Temp,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
lact_01_today_net_volume,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Lact_Todays_Net_Volume,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
lact_01_today_volume,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Lact_Todays_Gross_Volume,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
lact_01_totalizer_1,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Lact_T1_Gross,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
lact_01_totalizer_1_net,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Lact_T1_Net,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
lact_01_yesterday_volume,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Lact_Yest_Gross_Volume,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
lact_02_alm,hrtankbattery,default,periodic,,BIT,,,,0,LACT_02_Failure,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
lact_02_bs_w,hrtankbattery,default,periodic,,FLOAT,,,,,Lact_02_BS_and_W_Reading,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
lact_02_daily_volume,hrtankbattery,default,periodic,,FLOAT,,,,,Lact_02_Current_Daily_Ind_Volume_Total,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
lact_02_flow_rate,hrtankbattery,default,periodic,,FLOAT,,,,,Lact_02_Realtime_Flow_Rate,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
lact_02_lifetime,hrtankbattery,default,periodic,,FLOAT,,,,,Lact_02_Cumulative_Ind_Volume,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
lact_02_oil_shutdown,hrtankbattery,default,periodic,,BIT,,,,0,LACT_02_Bad_Oil_Shutdown,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
lact_02_permissive,hrtankbattery,default,periodic,,BIT,,,,0,LACT_02_Permissive,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
lact_02_prev_day,hrtankbattery,default,periodic,,FLOAT,,,,,Lact_02_History.Previous_Day_1,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
lact_02_sts,hrtankbattery,default,periodic,,BIT,,,,0,LACT_02_Run_Status,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
oil_01_hi_alm,hrtankbattery,default,periodic,,BIT,,,,0,OT_1.Alm_Hi,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
oil_01_hi_spt,hrtankbattery,default,periodic,,FLOAT,,,,,OT_1.PSet_HiLim,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
oil_01_hihi_alm,hrtankbattery,default,periodic,,BIT,,,,0,OT_1.Alm_HiHi,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
oil_01_hihi_spt,hrtankbattery,default,periodic,,FLOAT,,,,,OT_1.PSet_HiHiLim,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
oil_01_level,hrtankbattery,default,periodic,,FLOAT,,,,,OT_1.Val,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
oil_01_max_height,hrtankbattery,default,periodic,,FLOAT,,,,,OT_1.Cfg_PVEUMax,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
oil_01_pv_level_daily_holding,hrtankbattery,default,periodic,,FLOAT,,,,,Val_OT1_MBS_PV_DH,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
oil_01_sv_level_daily_holding,hrtankbattery,default,periodic,,FLOAT,,,,,Val_OT1_MBS_SV_DH,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
oil_01_tx_alm,hrtankbattery,default,periodic,,BIT,,,,0,OT_1.Alm_Fail,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
oil_02_hi_alm,hrtankbattery,default,periodic,,BIT,,,,0,OT_2.Alm_Hi,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
oil_02_hi_spt,hrtankbattery,default,periodic,,FLOAT,,,,,OT_2.PSet_HiLim,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
oil_02_hihi_alm,hrtankbattery,default,periodic,,BIT,,,,0,OT_2.Alm_HiHi,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
oil_02_hihi_spt,hrtankbattery,default,periodic,,FLOAT,,,,,OT_2.PSet_HiHiLim,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
oil_02_level,hrtankbattery,default,periodic,,FLOAT,,,,,OT_2.Val,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
oil_02_max_height,hrtankbattery,default,periodic,,FLOAT,,,,,OT_2.Cfg_PVEUMax,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
oil_02_pv_level_daily_holding,hrtankbattery,default,periodic,,FLOAT,,,,,Val_OT2_MBS_PV_DH,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
oil_02_sv_level_daily_holding,hrtankbattery,default,periodic,,FLOAT,,,,,Val_OT2_MBS_SV_DH,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
oil_02_tx_alm,hrtankbattery,default,periodic,,BIT,,,,0,OT_2.Alm_Fail,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
oil_03_hi_alm,hrtankbattery,default,periodic,,BIT,,,,0,OT_3.Alm_Hi,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
oil_03_hi_spt,hrtankbattery,default,periodic,,FLOAT,,,,,OT_3.PSet_HiLim,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
oil_03_hihi_alm,hrtankbattery,default,periodic,,BIT,,,,0,OT_3.Alm_HiHi,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
oil_03_hihi_spt,hrtankbattery,default,periodic,,FLOAT,,,,,OT_3.PSet_HiHiLim,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
oil_03_level,hrtankbattery,default,periodic,,FLOAT,,,,,OT_3.Val,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
oil_03_max_height,hrtankbattery,default,periodic,,FLOAT,,,,,OT_3.Cfg_PVEUMax,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
oil_03_pv_level_daily_holding,hrtankbattery,default,periodic,,FLOAT,,,,,Val_OT3_MBS_PV_DH,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
oil_03_sv_level_daily_holding,hrtankbattery,default,periodic,,FLOAT,,,,,Val_OT3_MBS_SV_DH,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
oil_03_tx_alm,hrtankbattery,default,periodic,,BIT,,,,0,OT_3.Alm_Fail,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
oil_04_hi_alm,hrtankbattery,default,periodic,,BIT,,,,0,OT_4.Alm_Hi,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
oil_04_hi_spt,hrtankbattery,default,periodic,,FLOAT,,,,,OT_4.PSet_HiLim,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
oil_04_hihi_alm,hrtankbattery,default,periodic,,BIT,,,,0,OT_4.Alm_HiHi,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
oil_04_hihi_spt,hrtankbattery,default,periodic,,FLOAT,,,,,OT_4.PSet_HiHiLim,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
oil_04_level,hrtankbattery,default,periodic,,FLOAT,,,,,OT_4.Val,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
oil_04_max_height,hrtankbattery,default,periodic,,FLOAT,,,,,OT_4.Cfg_PVEUMax,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
oil_04_pv_level_daily_holding,hrtankbattery,default,periodic,,FLOAT,,,,,Val_OT4_MBS_PV_DH,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
oil_04_sv_level_daily_holding,hrtankbattery,default,periodic,,FLOAT,,,,,Val_OT4_MBS_SV_DH,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
oil_04_tx_alm,hrtankbattery,default,periodic,,BIT,,,,0,OT_4.Alm_Fail,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
oil_05_hi_alm,hrtankbattery,default,periodic,,BIT,,,,0,OT_5.Alm_Hi,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
oil_05_hi_spt,hrtankbattery,default,periodic,,FLOAT,,,,,OT_5.PSet_HiLim,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
oil_05_hihi_alm,hrtankbattery,default,periodic,,BIT,,,,0,OT_5.Alm_HiHi,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
oil_05_hihi_spt,hrtankbattery,default,periodic,,FLOAT,,,,,OT_5.PSet_HiHiLim,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
oil_05_level,hrtankbattery,default,periodic,,FLOAT,,,,,OT_5.Val,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
oil_05_max_height,hrtankbattery,default,periodic,,FLOAT,,,,,OT_5.Cfg_PVEUMax,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
oil_05_tx_alm,hrtankbattery,default,periodic,,BIT,,,,0,OT_5.Alm_Fail,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
oil_06_hi_alm,hrtankbattery,default,periodic,,BIT,,,,0,OT_6.Alm_Hi,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
oil_06_hi_spt,hrtankbattery,default,periodic,,FLOAT,,,,,OT_6.PSet_HiLim,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
oil_06_hihi_alm,hrtankbattery,default,periodic,,BIT,,,,0,OT_6.Alm_HiHi,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
oil_06_hihi_spt,hrtankbattery,default,periodic,,FLOAT,,,,,OT_6.PSet_HiHiLim,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
oil_06_level,hrtankbattery,default,periodic,,FLOAT,,,,,OT_6.Val,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
oil_06_max_height,hrtankbattery,default,periodic,,FLOAT,,,,,OT_6.Cfg_PVEUMax,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
oil_06_tx_alm,hrtankbattery,default,periodic,,BIT,,,,0,OT_6.Alm_Fail,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
oil_07_hi_alm,hrtankbattery,default,periodic,,BIT,,,,0,OT_7.Alm_Hi,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
oil_07_hi_spt,hrtankbattery,default,periodic,,FLOAT,,,,,OT_7.PSet_HiLim,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
oil_07_hihi_alm,hrtankbattery,default,periodic,,BIT,,,,0,OT_7.Alm_HiHi,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
oil_07_hihi_spt,hrtankbattery,default,periodic,,FLOAT,,,,,OT_7.PSet_HiHiLim,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
oil_07_level,hrtankbattery,default,periodic,,FLOAT,,,,,OT_7.Val,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
oil_07_max_height,hrtankbattery,default,periodic,,FLOAT,,,,,OT_7.Cfg_PVEUMax,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
oil_07_tx_alm,hrtankbattery,default,periodic,,BIT,,,,0,OT_7.Alm_Fail,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
oil_gauge_off_volume,hrtankbattery,default,periodic,,FLOAT,,,,,Gauge_Off_Oil_Tank_Volume,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
oil_run_tank,hrtankbattery,default,periodic,,DINT,,0,,,OT_Selector,,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
oil_run_tank_volume,hrtankbattery,default,periodic,,FLOAT,,,,,Current_Oil_Tank_Volume,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
plc_fault,hrtankbattery,default,periodic,,BIT,,,,0,PLC_FAULT,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
plc_io_fault_alm,hrtankbattery,default,periodic,,BIT,,,,0,IO_Fault_Alarm,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
tf_sales_battery_voltage,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Sales_TF_Battery_Voltage,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_sales_charger_voltage,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Sales_TF_Charger_Voltage,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_sales_differential_pressure,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Sales_TF_Differential_Pressure,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_sales_flow_rate,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Sales_TF_Flow_Rate,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_sales_lifetime,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Sales_TF_Lifetime,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_sales_static_pressure,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Sales_TF_Static_Pressure,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_sales_temperature,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Sales_TF_Temperature,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_sales_yesterday_total,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Sales_TF_Yesterday_Total,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v1_battery_voltage,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V1_TF_Battery_Voltage,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v1_charger_voltage,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V1_TF_Charger_Voltage,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v1_differential_pressure,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V1_TF_Differential_Pressure,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v1_flow_rate,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V1_TF_Flow_Rate,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v1_lifetime,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V1_TF_Lifetime,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v1_static_pressure,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V1_TF_Static_Pressure,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v1_temperature,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V1_TF_Temperature,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v1_yesterday_total,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V1_TF_Yesterday_Total,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v2_battery_voltage,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V2_TF_Battery_Voltage,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v2_charger_voltage,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V2_TF_Charger_Voltage,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v2_differential_pressure,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V2_TF_Differential_Pressure,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v2_flow_rate,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V2_TF_Flow_Rate,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v2_lifetime,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V2_TF_Lifetime,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v2_static_pressure,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V2_TF_Static_Pressure,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v2_temperature,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V2_TF_Temperature,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v2_yesterday_total,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V2_TF_Yesterday_Total,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v3_battery_voltage,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V3_TF_Battery_Voltage,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v3_charger_voltage,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V3_TF_Charger_Voltage,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v3_differential_pressure,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V3_TF_Differential_Pressure,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v3_flow_rate,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V3_TF_Flow_Rate,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v3_lifetime,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V3_TF_Lifetime,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v3_static_pressure,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V3_TF_Static_Pressure,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v3_temperature,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V3_TF_Temperature,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v3_yesterday_total,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V3_TF_Yesterday_Total,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v4_battery_voltage,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V4_TF_Battery_Voltage,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v4_charger_voltage,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V4_TF_Charger_Voltage,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v4_differential_pressure,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V4_TF_Differential_Pressure,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v4_flow_rate,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V4_TF_Flow_Rate,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v4_lifetime,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V4_TF_Lifetime,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v4_static_pressure,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V4_TF_Static_Pressure,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v4_temperature,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V4_TF_Temperature,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v4_yesterday_total,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V4_TF_Yesterday_Total,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v5_battery_voltage,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V5_TF_Battery_Voltage,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v5_charger_voltage,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V5_TF_Charger_Voltage,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v5_differential_pressure,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V5_TF_Differential_Pressure,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v5_flow_rate,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V5_TF_Flow_Rate,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v5_lifetime,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V5_TF_Lifetime,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v5_static_pressure,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V5_TF_Static_Pressure,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v5_temperature,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V5_TF_Temperature,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
tf_v5_yesterday_total,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V5_TF_Yesterday_Total,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
three_phase_pwr_alm,hrtankbattery,default,periodic,,BIT,,,,0,Three_Phase_Power_Alarm.Alm_TgtDisagree,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
transfer_01_3_phase_pwr_alm,hrtankbattery,default,periodic,,BIT,,,,0,Transfer_Pump_3_Phase_Power_Alarm.Alm_TgtDisagree,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
transfer_01_alm,hrtankbattery,default,periodic,,BIT,,,,0,XFER_PUMP_Motor_01.Alm_FailToStart,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
transfer_01_discharge,hrtankbattery,default,periodic,,FLOAT,,,,,XferPump_01_Dis_PSI.Val,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
transfer_01_discharge_hihi_alm,hrtankbattery,default,periodic,,BIT,,,,0,XferPump_01_Dis_PSI.Alm_HiHi,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
transfer_01_discharge_lolo_alm,hrtankbattery,default,periodic,,BIT,,,,0,XferPump_01_Dis_PSI.Alm_LoLo,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
transfer_01_flow_rate,hrtankbattery,default,periodic,,FLOAT,,,,,XferPump_01_FlowRate.Val,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
transfer_01_flow_rate_hihi_alm,hrtankbattery,default,periodic,,BIT,,,,0,XferPump_01_FlowRate.Alm_HiHi,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
transfer_01_flow_rate_lolo_alm,hrtankbattery,default,periodic,,BIT,,,,0,XferPump_01_FlowRate.Alm_LoLo,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
transfer_01_sts,hrtankbattery,default,periodic,,BIT,,,,0,XFER_PUMP_Motor_01.Sts_Running,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
transfer_02_alm,hrtankbattery,default,periodic,,BIT,,,,0,XFER_PUMP_Motor_02.Alm_FailToStart,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
transfer_02_discharge,hrtankbattery,default,periodic,,FLOAT,,,,,XferPump_02_Dis_PSI.Val,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
transfer_02_discharge_hihi_alm,hrtankbattery,default,periodic,,BIT,,,,0,XferPump_02_Dis_PSI.Alm_HiHi,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
transfer_02_discharge_lolo_alm,hrtankbattery,default,periodic,,BIT,,,,0,XferPump_02_Dis_PSI.Alm_LoLo,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
transfer_02_flow_rate,hrtankbattery,default,periodic,,FLOAT,,,,,XferPump_02_FlowRate.Val,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
transfer_02_flow_rate_hihi_alm,hrtankbattery,default,periodic,,BIT,,,,0,XferPump_02_FlowRate.Alm_HiHi,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
transfer_02_flow_rate_lolo_alm,hrtankbattery,default,periodic,,BIT,,,,0,XferPump_02_FlowRate.Alm_LoLo,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
transfer_02_sts,hrtankbattery,default,periodic,,BIT,,,,0,XFER_PUMP_Motor_02.Sts_Running,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
ups_alm,hrtankbattery,default,periodic,,BIT,,,,0,Alm_UPS.Alm_TgtDisagree,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
vessel_1_active_well,hrtankbattery,default,periodic,,INT,,0,,,Test_Vessel_1_Active_Well,,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_1_gas_flow_rate,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_1_Gas_FR,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_1_gas_today,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V1_Gas_Daily_Total,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_1_oil_flow_rate,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_1_Oil_FR,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_1_oil_last_month,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_1_OIL_LastMonth_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_1_oil_lifetime,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_1_Oil_T1,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_1_oil_month,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_1_OIL_Month_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_1_oil_temperature,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_1_Oil_Temp,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_1_oil_today,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_1_Oil_Todays_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_1_oil_yesterday,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_1_Oil_Yest_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_1_water_flow_rate,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_1_Water_FR,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_1_water_last_month,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_1_Water_LastMonth_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_1_water_lifetime,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_1_Water_T1,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_1_water_month,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_1_Water_Month_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_1_water_temperature,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_1_Water_Temp,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_1_water_today,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_1_Water_Todays_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_1_water_yesterday,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_1_Water_Yest_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_2_active_well,hrtankbattery,default,periodic,,INT,,0,,,Test_Vessel_2_Active_Well,,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_2_gas_flow_rate,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_2_Gas_FR,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_2_gas_today,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V2_Gas_Daily_Total,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_2_oil_flow_rate,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_2_Oil_FR,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_2_oil_last_month,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_2_OIL_LastMonth_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_2_oil_lifetime,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_2_Oil_T1,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_2_oil_month,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_2_OIL_Month_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_2_oil_temperature,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_2_Oil_Temp,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_2_oil_today,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_2_Oil_Todays_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_2_oil_yesterday,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_2_OIL_Yest_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_2_water_flow_rate,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_2_Water_FR,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_2_water_last_month,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_2_Water_LastMonth_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_2_water_lifetime,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_2_Water_T1,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_2_water_month,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_2_Water_Month_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_2_water_temperature,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_2_Water_Temp,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_2_water_today,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_2_Water_Todays_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_2_water_yesterday,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_2_Water_Yest_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_3_active_well,hrtankbattery,default,periodic,,INT,,0,,,Test_Vessel_3_Active_Well,,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_3_gas_flow_rate,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_3_Gas_FR,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_3_gas_today,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V3_Gas_Daily_Total,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_3_oil_flow_rate,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_3_Oil_FR,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_3_oil_last_month,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_3_OIL_LastMonth_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_3_oil_lifetime,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_3_Oil_T1,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_3_oil_month,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_3_OIL_Month_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_3_oil_temperature,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_3_Oil_Temp,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_3_oil_today,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_3_Oil_Todays_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_3_oil_yesterday,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_3_OIL_Yest_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_3_water_flow_rate,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_3_Water_FR,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_3_water_last_month,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_3_Water_LastMonth_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_3_water_lifetime,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_3_Water_T1,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_3_water_month,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_3_Water_Month_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_3_water_temperature,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_3_Water_Temp,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_3_water_today,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_3_Water_Todays_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_3_water_yesterday,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_3_Water_Yest_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_4_active_well,hrtankbattery,default,periodic,,INT,,0,,,Test_Vessel_4_Active_Well,,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_4_gas_flow_rate,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_4_Gas_FR,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_4_gas_today,hrtankbattery,default,periodic,,FLOAT,,,,,Val_V4_Gas_Daily_Total,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_4_oil_flow_rate,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_4_Oil_FR,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_4_oil_last_month,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_4_OIL_LastMonth_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_4_oil_lifetime,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_4_Oil_T1,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_4_oil_month,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_4_OIL_Month_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_4_oil_temperature,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_4_Oil_Temp,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_4_oil_today,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_4_Oil_Todays_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_4_oil_yesterday,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_4_OIL_Yest_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_4_water_flow_rate,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_4_Water_FR,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_4_water_last_month,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_4_Water_LastMonth_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_4_water_lifetime,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_4_Water_T1,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_4_water_month,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_4_Water_Month_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_4_water_temperature,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_4_Water_Temp,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_4_water_today,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_4_Water_Todays_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_4_water_yesterday,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_4_Water_Yest_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_5_gas_flow_rate,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_5_Gas_FR,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_5_oil_flow_rate,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_5_Oil_FR,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_5_oil_last_month,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_5_OIL_LastMonth_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_5_oil_lifetime,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_5_Oil_T1,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_5_oil_month,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_5_OIL_Month_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_5_oil_temperature,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_5_Oil_Temp,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_5_oil_today,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_5_Oil_Todays_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_5_oil_yesterday,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_5_OIL_Yest_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_5_water_flow_rate,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_5_Water_FR,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_5_water_last_month,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_5_Water_LastMonth_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_5_water_lifetime,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_5_Water_T1,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_5_water_month,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_5_Water_Month_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_5_water_temperature,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_5_Water_Temp,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_5_water_today,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_5_Water_Todays_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vessel_5_water_yesterday,hrtankbattery,default,periodic,,FLOAT,,,,,Val_Vessel_5_Water_Yest_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vfd_01_frequency,hrtankbattery,default,periodic,,FLOAT,,,,,FBK_VFD_1_Speed,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
vfd_02_frequency,hrtankbattery,default,periodic,,FLOAT,,,,,FBK_VFD_2_Speed,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_01_hi_alm,hrtankbattery,default,periodic,,BIT,,,,0,WT_1.Alm_Hi,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
water_01_hi_spt,hrtankbattery,default,periodic,,FLOAT,,,,,WT_1.PSet_HiLim,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_01_hihi_alm,hrtankbattery,default,periodic,,BIT,,,,0,WT_1.Alm_HiHi,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
water_01_hihi_spt,hrtankbattery,default,periodic,,FLOAT,,,,,WT_1.PSet_HiHiLim,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_01_level,hrtankbattery,default,periodic,,FLOAT,,,,,WT_1.Val,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_01_level_daily_holding,hrtankbattery,default,periodic,,FLOAT,,,,,Val_WT1_PV_DH,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_01_max_height,hrtankbattery,default,periodic,,FLOAT,,,,,WT_1.Cfg_PVEUMax,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_01_tx_alm,hrtankbattery,default,periodic,,BIT,,,,0,WT_1.Alm_Fail,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
water_02_hi_alm,hrtankbattery,default,periodic,,BIT,,,,0,WT_2.Alm_Hi,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
water_02_hi_spt,hrtankbattery,default,periodic,,FLOAT,,,,,WT_2.PSet_HiLim,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_02_hihi_alm,hrtankbattery,default,periodic,,BIT,,,,0,WT_2.Alm_HiHi,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
water_02_hihi_spt,hrtankbattery,default,periodic,,FLOAT,,,,,WT_2.PSet_HiHiLim,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_02_level,hrtankbattery,default,periodic,,FLOAT,,,,,WT_2.Val,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_02_level_daily_holding,hrtankbattery,default,periodic,,FLOAT,,,,,Val_WT2_PV_DH,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_02_max_height,hrtankbattery,default,periodic,,FLOAT,,,,,WT_2.Cfg_PVEUMax,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_02_tx_alm,hrtankbattery,default,periodic,,BIT,,,,0,WT_2.Alm_Fail,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
water_03_hi_alm,hrtankbattery,default,periodic,,BIT,,,,0,WT_3.Alm_Hi,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
water_03_hi_spt,hrtankbattery,default,periodic,,FLOAT,,,,,WT_3.PSet_HiLim,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_03_hihi_alm,hrtankbattery,default,periodic,,BIT,,,,0,WT_3.Alm_HiHi,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
water_03_hihi_spt,hrtankbattery,default,periodic,,FLOAT,,,,,WT_3.PSet_HiHiLim,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_03_level,hrtankbattery,default,periodic,,FLOAT,,,,,WT_3.Val,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_03_level_daily_holding,hrtankbattery,default,periodic,,FLOAT,,,,,Val_WT3_PV_DH,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_03_max_height,hrtankbattery,default,periodic,,FLOAT,,,,,WT_3.Cfg_PVEUMax,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_03_tx_alm,hrtankbattery,default,periodic,,BIT,,,,0,WT_3.Alm_Fail,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
water_04_hi_alm,hrtankbattery,default,periodic,,BIT,,,,0,WT_4.Alm_Hi,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
water_04_hi_spt,hrtankbattery,default,periodic,,FLOAT,,,,,WT_4.PSet_HiLim,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_04_hihi_alm,hrtankbattery,default,periodic,,BIT,,,,0,WT_4.Alm_HiHi,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
water_04_hihi_spt,hrtankbattery,default,periodic,,FLOAT,,,,,WT_4.PSet_HiHiLim,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_04_level,hrtankbattery,default,periodic,,FLOAT,,,,,WT_4.Val,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_04_level_daily_holding,hrtankbattery,default,periodic,,FLOAT,,,,,Val_WT4_PV_DH,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_04_max_height,hrtankbattery,default,periodic,,FLOAT,,,,,WT_4.Cfg_PVEUMax,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_04_tx_alm,hrtankbattery,default,periodic,,BIT,,,,0,WT_4.Alm_Fail,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
water_05_hi_alm,hrtankbattery,default,periodic,,BIT,,,,0,WT_5.Alm_Hi,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
water_05_hi_spt,hrtankbattery,default,periodic,,FLOAT,,,,,WT_5.PSet_HiLim,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_05_hihi_alm,hrtankbattery,default,periodic,,BIT,,,,0,WT_5.Alm_HiHi,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
water_05_hihi_spt,hrtankbattery,default,periodic,,FLOAT,,,,,WT_5.PSet_HiHiLim,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_05_level,hrtankbattery,default,periodic,,FLOAT,,,,,WT_5.Val,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_05_max_height,hrtankbattery,default,periodic,,FLOAT,,,,,WT_5.Cfg_PVEUMax,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_05_tx_alm,hrtankbattery,default,periodic,,BIT,,,,0,WT_5.Alm_Fail,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
water_06_hi_alm,hrtankbattery,default,periodic,,BIT,,,,0,WT_6.Alm_Hi,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
water_06_hi_spt,hrtankbattery,default,periodic,,FLOAT,,,,,WT_6.PSet_HiLim,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_06_hihi_alm,hrtankbattery,default,periodic,,BIT,,,,0,WT_6.Alm_HiHi,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
water_06_hihi_spt,hrtankbattery,default,periodic,,FLOAT,,,,,WT_6.PSet_HiHiLim,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_06_level,hrtankbattery,default,periodic,,FLOAT,,,,,WT_6.Val,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_06_max_height,hrtankbattery,default,periodic,,FLOAT,,,,,WT_6.Cfg_PVEUMax,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_06_tx_alm,hrtankbattery,default,periodic,,BIT,,,,0,WT_6.Alm_Fail,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
water_07_hi_alm,hrtankbattery,default,periodic,,BIT,,,,0,WT_7.Alm_Hi,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
water_07_hi_spt,hrtankbattery,default,periodic,,FLOAT,,,,,WT_7.PSet_HiLim,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_07_hihi_alm,hrtankbattery,default,periodic,,BIT,,,,0,WT_7.Alm_HiHi,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
water_07_hihi_spt,hrtankbattery,default,periodic,,FLOAT,,,,,WT_7.PSet_HiHiLim,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_07_level,hrtankbattery,default,periodic,,FLOAT,,,,,WT_7.Val,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_07_max_height,hrtankbattery,default,periodic,,FLOAT,,,,,WT_7.Cfg_PVEUMax,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_07_tx_alm,hrtankbattery,default,periodic,,BIT,,,,0,WT_7.Alm_Fail,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
water_08_hi_alm,hrtankbattery,default,periodic,,BIT,,,,0,WT_8.Alm_Hi,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
water_08_hi_spt,hrtankbattery,default,periodic,,FLOAT,,,,,WT_8.PSet_HiLim,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_08_hihi_alm,hrtankbattery,default,periodic,,BIT,,,,0,WT_8.Alm_HiHi,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
water_08_hihi_spt,hrtankbattery,default,periodic,,FLOAT,,,,,WT_8.PSet_HiHiLim,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_08_level,hrtankbattery,default,periodic,,FLOAT,,,,,WT_8.Val,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_08_max_height,hrtankbattery,default,periodic,,FLOAT,,,,,WT_8.Cfg_PVEUMax,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_08_tx_alm,hrtankbattery,default,periodic,,BIT,,,,0,WT_8.Alm_Fail,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
water_09_hi_alm,hrtankbattery,default,periodic,,BIT,,,,0,WT_9.Alm_Hi,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
water_09_hi_spt,hrtankbattery,default,periodic,,FLOAT,,,,,WT_9.PSet_HiLim,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_09_hihi_alm,hrtankbattery,default,periodic,,BIT,,,,0,WT_9.Alm_HiHi,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
water_09_hihi_spt,hrtankbattery,default,periodic,,FLOAT,,,,,WT_9.PSet_HiHiLim,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_09_level,hrtankbattery,default,periodic,,FLOAT,,,,,WT_9.Val,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_09_max_height,hrtankbattery,default,periodic,,FLOAT,,,,,WT_9.Cfg_PVEUMax,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_09_tx_alm,hrtankbattery,default,periodic,,BIT,,,,0,WT_9.Alm_Fail,,,,ro,,,none,,,,,,,,,,,,,0,,1,,,,,,,,
|
||||||
|
water_gauge_off_volume,hrtankbattery,default,periodic,,FLOAT,,,,,Gauge_Off_Water_Tank_Volume,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_run_tank,hrtankbattery,default,periodic,,DINT,,0,,,WT_Selector,,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
water_run_tank_volume,hrtankbattery,default,periodic,,FLOAT,,,,,Curent_Water_Tank_Volume,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
wtp_1_flow_rate,hrtankbattery,default,periodic,,FLOAT,,,,,Val_WTP_FM_FR_MBS,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
wtp_1_forward_volume,hrtankbattery,default,periodic,,FLOAT,,,,,Val_WTP_FM_T2_MBS,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
wtp_1_last_month,hrtankbattery,default,periodic,,FLOAT,,,,,Val_WTP_FM_LastMonth_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
wtp_1_month,hrtankbattery,default,periodic,,FLOAT,,,,,Val_WTP_FM_Month_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
wtp_1_net_volume,hrtankbattery,default,periodic,,FLOAT,,,,,Val_WTP_FM_T1_MBS,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
wtp_1_reverse_volume,hrtankbattery,default,periodic,,FLOAT,,,,,Val_WTP_FM_T3_MBS,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
wtp_1_today,hrtankbattery,default,periodic,,FLOAT,,,,,Val_WTP_FM_Todays_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
wtp_1_yesterday,hrtankbattery,default,periodic,,FLOAT,,,,,Val_WTP_FM_Yest_Accum,2,,,ro,,,none,,,,,,,,,,,,,,,1,,,,,,,,
|
||||||
|
245293
Pub_Sub/hrtankbattery/thingsboard/sonya_tags.json
Normal file
245293
Pub_Sub/hrtankbattery/thingsboard/sonya_tags.json
Normal file
File diff suppressed because it is too large
Load Diff
18
Pub_Sub/plcfreshwater/mistaway/jordan.csv
Normal file
18
Pub_Sub/plcfreshwater/mistaway/jordan.csv
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
MeasuringPointName,ControllerName,GroupName,UploadType,DeadZonePercent,DataType,ArrayIndex,EnableBit,BitIndex,reverseBit,Address,Decimal,Len,ReadWrite,Unit,Description,Transform Type,MaxValue,MinValue,MaxScale,MinScale,Gain,Offset,startBit,endBit,Pt,Ct,Mapping_table,TransDecimal,bitMap,msecSample,storageLwTSDB,DataEndianReverse,ReadOffset,ReadLength,WriteOffset,WriteLength,DataParseMethod,BitId
|
||||||
|
scaled_flow_meter,00:00:00:00:00:34,default,periodic,,FLOAT,,,,,Scaled_Flow_Meter,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
scaled_pressure_transducer,00:00:00:00:00:34,default,periodic,,FLOAT,,,,,Scaled_Pressure_Transducer,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
raw_hand_input,00:00:00:00:00:34,default,periodic,,BIT,,,,0,Raw_Hand_Input,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
raw_auto_input,00:00:00:00:00:34,default,periodic,,BIT,,,,0,Raw_Auto_Input,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
raw_run_status,00:00:00:00:00:34,default,periodic,,BIT,,,,0,Raw_Run_Status,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
raw_local_start,00:00:00:00:00:34,default,periodic,,BIT,,,,0,Raw_Local_Start,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
spt_flow_meter_unit,00:00:00:00:00:34,default,periodic,,BIT,,,,0,SPT_Flow_Meter_Unit,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
raw_overload_status,00:00:00:00:00:34,default,periodic,,BIT,,,,0,Raw_Overload_Status,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
cmd_cloud_control,00:00:00:00:00:34,default,periodic,,BIT,,,,0,CMD_Cloud_Control,,,rw,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
total_fm_yesterday_gal,00:00:00:00:00:34,default,periodic,,FLOAT,,,,,Totalizer_FM_Yesterday_Total_Gal,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
total_fm_day_gal,00:00:00:00:00:34,default,periodic,,FLOAT,,,,,Totalizer_FM_Current_Day_Total_Gal,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
total_fm_last_month_gal,00:00:00:00:00:34,default,periodic,,FLOAT,,,,,Totalizer_FM_Last_Month_Gal,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
total_fm_month_gal,00:00:00:00:00:34,default,periodic,,FLOAT,,,,,Totalizer_FM_Current_Month_Gal,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
total_fm_yesterday_bbls,00:00:00:00:00:34,default,periodic,,FLOAT,,,,,Totalizer_FM_Yesterday_Total_BBLs,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
total_fm_day_bbls,00:00:00:00:00:34,default,periodic,,FLOAT,,,,,Totalizer_FM_Current_Day_Total_BBLs,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
total_fm_last_month_bbls,00:00:00:00:00:34,default,periodic,,FLOAT,,,,,Totalizer_FM_Last_Month_BBLs,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
total_fm_month_bbls,00:00:00:00:00:34,default,periodic,,FLOAT,,,,,Totalizer_FM_Current_Month_BBLs,2,,ro,,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
|
BIN
Pub_Sub/rigpump/.DS_Store
vendored
BIN
Pub_Sub/rigpump/.DS_Store
vendored
Binary file not shown.
108
Pub_Sub/rigpump/thingsboard/pub/sendData.py
Normal file
108
Pub_Sub/rigpump/thingsboard/pub/sendData.py
Normal file
@@ -0,0 +1,108 @@
|
|||||||
|
import json, os, time
|
||||||
|
from common.Logger import logger
|
||||||
|
from quickfaas.remotebus import publish
|
||||||
|
from datetime import datetime as dt
|
||||||
|
from mobiuspi_lib.gps import GPS
|
||||||
|
from quickfaas.global_dict import get as get_params
|
||||||
|
from quickfaas.global_dict import _set_global_args
|
||||||
|
|
||||||
|
def getGPS():
|
||||||
|
# Create a gps instance
|
||||||
|
gps = GPS()
|
||||||
|
|
||||||
|
# Retrieve GPS information
|
||||||
|
position_status = gps.get_position_status()
|
||||||
|
logger.debug("position_status: ")
|
||||||
|
logger.debug(position_status)
|
||||||
|
latitude = position_status["latitude"].split(" ")
|
||||||
|
longitude = position_status["longitude"].split(" ")
|
||||||
|
lat_dec = int(latitude[0][:-1]) + (float(latitude[1][:-1])/60)
|
||||||
|
lon_dec = int(longitude[0][:-1]) + (float(longitude[1][:-1])/60)
|
||||||
|
if latitude[2] == "S":
|
||||||
|
lat_dec = lat_dec * -1
|
||||||
|
if longitude[2] == "W":
|
||||||
|
lon_dec = lon_dec * -1
|
||||||
|
#lat_dec = round(lat_dec, 7)
|
||||||
|
#lon_dec = round(lon_dec, 7)
|
||||||
|
logger.info("HERE IS THE GPS COORDS")
|
||||||
|
logger.info(f"LATITUDE: {lat_dec}, LONGITUDE: {lon_dec}")
|
||||||
|
speedKnots = position_status["speed"].split(" ")
|
||||||
|
speedMPH = float(speedKnots[0]) * 1.151
|
||||||
|
return (f"{lat_dec:.8f}",f"{lon_dec:.8f}",f"{speedMPH:.2f}")
|
||||||
|
|
||||||
|
def chunk_payload(payload, chunk_size=20):
|
||||||
|
if "values" in payload:
|
||||||
|
# Original format: {"ts": ..., "values": {...}}
|
||||||
|
chunked_values = list(payload["values"].items())
|
||||||
|
for i in range(0, len(chunked_values), chunk_size):
|
||||||
|
yield {
|
||||||
|
"ts": payload["ts"],
|
||||||
|
"values": dict(chunked_values[i:i+chunk_size])
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
# New format: {"key1": "value1", "key2": "value2"}
|
||||||
|
chunked_keys = list(payload.keys())
|
||||||
|
for i in range(0, len(chunked_keys), chunk_size):
|
||||||
|
yield {k: payload[k] for k in chunked_keys[i:i+chunk_size]}
|
||||||
|
|
||||||
|
def sendData(message):
|
||||||
|
#logger.debug(message)
|
||||||
|
|
||||||
|
|
||||||
|
payload = {"ts": (round(dt.timestamp(dt.now())/600)*600)*1000, "values": {}}
|
||||||
|
attributes_payload = {}
|
||||||
|
for measure in message["measures"]:
|
||||||
|
try:
|
||||||
|
logger.debug(measure)
|
||||||
|
if measure["health"] == 1:
|
||||||
|
if measure["name"] in ["auto_manual", "auto_control_mode", "device_status"]:
|
||||||
|
logger.debug("Converting DINT/BOOL to STRING")
|
||||||
|
payload["values"][measure["name"]] = convert_int(measure["name"], measure["value"])
|
||||||
|
payload["values"][measure["name"] + "_int"] = measure["value"]
|
||||||
|
else:
|
||||||
|
payload["values"][measure["name"]] = measure["value"]
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
|
||||||
|
try:
|
||||||
|
payload["values"]["latitude"], payload["values"]["longitude"], payload["values"]["speed"] = getGPS()
|
||||||
|
except:
|
||||||
|
logger.error("Could not get GPS coordinates")
|
||||||
|
|
||||||
|
for chunk in chunk_payload(payload=payload):
|
||||||
|
publish(__topic__, json.dumps(chunk), __qos__, cloud_name="ThingsBoard")
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
|
attributes_payload["latestReportTime"] = (round(dt.timestamp(dt.now())/600)*600)*1000
|
||||||
|
for chunk in chunk_payload(payload=attributes_payload):
|
||||||
|
publish("v1/devices/me/attributes", json.dumps(chunk), __qos__, cloud_name="ThingsBoard")
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
|
|
||||||
|
def convert_int(plc_tag, value):
|
||||||
|
auto_manual = {
|
||||||
|
0: "Manual",
|
||||||
|
1: "Auto"
|
||||||
|
}
|
||||||
|
|
||||||
|
auto_control_mode = {
|
||||||
|
0: "Pressure",
|
||||||
|
1: "Flow"
|
||||||
|
}
|
||||||
|
|
||||||
|
device_status = {
|
||||||
|
1: "Running",
|
||||||
|
64: "Idle",
|
||||||
|
128: "Overpressure",
|
||||||
|
1024: "Faulted"
|
||||||
|
}
|
||||||
|
|
||||||
|
plc_tags = {
|
||||||
|
"auto_manual": auto_manual.get(value, "Invalid Code"),
|
||||||
|
"auto_control_mode": auto_control_mode.get(value, "Invalid Code"),
|
||||||
|
"device_status": device_status.get(value, "Invalid Code"),
|
||||||
|
}
|
||||||
|
|
||||||
|
return plc_tags.get(plc_tag, "Invalid Tag")
|
||||||
|
|
||||||
|
|
||||||
68204
Pub_Sub/rigpump/thingsboard/rigpumpTags.json
Normal file
68204
Pub_Sub/rigpump/thingsboard/rigpumpTags.json
Normal file
File diff suppressed because it is too large
Load Diff
547
Pub_Sub/rigpump/thingsboard/rigpump_tb_v1.cfg
Normal file
547
Pub_Sub/rigpump/thingsboard/rigpump_tb_v1.cfg
Normal file
@@ -0,0 +1,547 @@
|
|||||||
|
{
|
||||||
|
"controllers": [
|
||||||
|
{
|
||||||
|
"protocol": "EtherNet/IP",
|
||||||
|
"name": "rigpump",
|
||||||
|
"samplePeriod": 10,
|
||||||
|
"expired": 10000,
|
||||||
|
"endpoint": "192.168.1.10:44818",
|
||||||
|
"args": {
|
||||||
|
"connectTimeOut": 2000,
|
||||||
|
"slot": 0
|
||||||
|
},
|
||||||
|
"desc": "",
|
||||||
|
"enable": 1,
|
||||||
|
"enableDebug": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"measures": [
|
||||||
|
{
|
||||||
|
"name": "vfd_current",
|
||||||
|
"ctrlName": "rigpump",
|
||||||
|
"group": "default",
|
||||||
|
"uploadType": "periodic",
|
||||||
|
"dataType": "FLOAT",
|
||||||
|
"addr": "VFD_OutCurrent",
|
||||||
|
"readWrite": "ro",
|
||||||
|
"unit": "",
|
||||||
|
"desc": "",
|
||||||
|
"transformType": 0,
|
||||||
|
"decimal": 2,
|
||||||
|
"gain": "1.0",
|
||||||
|
"offset": "0.0",
|
||||||
|
"storageLwTSDB": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "vfd_frequency",
|
||||||
|
"ctrlName": "rigpump",
|
||||||
|
"group": "default",
|
||||||
|
"uploadType": "periodic",
|
||||||
|
"dataType": "FLOAT",
|
||||||
|
"addr": "VFD_SpeedFdbk",
|
||||||
|
"readWrite": "ro",
|
||||||
|
"unit": "",
|
||||||
|
"desc": "",
|
||||||
|
"transformType": 0,
|
||||||
|
"decimal": 2,
|
||||||
|
"gain": "1.0",
|
||||||
|
"offset": "0.0",
|
||||||
|
"storageLwTSDB": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "discharge_pressure",
|
||||||
|
"ctrlName": "rigpump",
|
||||||
|
"group": "default",
|
||||||
|
"uploadType": "periodic",
|
||||||
|
"dataType": "FLOAT",
|
||||||
|
"addr": "val_DischargePressure",
|
||||||
|
"readWrite": "ro",
|
||||||
|
"unit": "",
|
||||||
|
"desc": "",
|
||||||
|
"transformType": 0,
|
||||||
|
"decimal": 2,
|
||||||
|
"gain": "1.0",
|
||||||
|
"offset": "0.0",
|
||||||
|
"storageLwTSDB": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "discharge_pressure_setpoint",
|
||||||
|
"ctrlName": "rigpump",
|
||||||
|
"group": "default",
|
||||||
|
"uploadType": "periodic",
|
||||||
|
"dataType": "FLOAT",
|
||||||
|
"addr": "cfg_PID_DischargePressureSP",
|
||||||
|
"readWrite": "ro",
|
||||||
|
"unit": "",
|
||||||
|
"desc": "",
|
||||||
|
"transformType": 0,
|
||||||
|
"decimal": 2,
|
||||||
|
"gain": "1.0",
|
||||||
|
"offset": "0.0",
|
||||||
|
"storageLwTSDB": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "vfd_frequency_setpoint",
|
||||||
|
"ctrlName": "rigpump",
|
||||||
|
"group": "default",
|
||||||
|
"uploadType": "periodic",
|
||||||
|
"dataType": "FLOAT",
|
||||||
|
"addr": "cfg_PID_ManualSP",
|
||||||
|
"readWrite": "ro",
|
||||||
|
"unit": "",
|
||||||
|
"desc": "",
|
||||||
|
"transformType": 0,
|
||||||
|
"decimal": 2,
|
||||||
|
"gain": "1.0",
|
||||||
|
"offset": "0.0",
|
||||||
|
"storageLwTSDB": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "flow_rate_setpoint",
|
||||||
|
"ctrlName": "rigpump",
|
||||||
|
"group": "default",
|
||||||
|
"uploadType": "periodic",
|
||||||
|
"dataType": "FLOAT",
|
||||||
|
"addr": "cfg_PID_FlowSP",
|
||||||
|
"readWrite": "ro",
|
||||||
|
"unit": "",
|
||||||
|
"desc": "",
|
||||||
|
"transformType": 0,
|
||||||
|
"decimal": 2,
|
||||||
|
"gain": "1.0",
|
||||||
|
"offset": "0.0",
|
||||||
|
"storageLwTSDB": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "auto_manual",
|
||||||
|
"ctrlName": "rigpump",
|
||||||
|
"group": "default",
|
||||||
|
"uploadType": "periodic",
|
||||||
|
"dataType": "BIT",
|
||||||
|
"addr": "mode_Auto",
|
||||||
|
"readWrite": "ro",
|
||||||
|
"unit": "",
|
||||||
|
"desc": "",
|
||||||
|
"transformType": 0,
|
||||||
|
"gain": "1.0",
|
||||||
|
"offset": "0.0",
|
||||||
|
"bitMap": 0,
|
||||||
|
"reverseBit": 0,
|
||||||
|
"storageLwTSDB": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "device_status",
|
||||||
|
"ctrlName": "rigpump",
|
||||||
|
"group": "default",
|
||||||
|
"uploadType": "periodic",
|
||||||
|
"dataType": "INT",
|
||||||
|
"addr": "RigPump.State",
|
||||||
|
"readWrite": "ro",
|
||||||
|
"unit": "",
|
||||||
|
"desc": "",
|
||||||
|
"transformType": 0,
|
||||||
|
"gain": "1.0",
|
||||||
|
"offset": "0.0",
|
||||||
|
"enableBit": 0,
|
||||||
|
"storageLwTSDB": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "auto_control_mode",
|
||||||
|
"ctrlName": "rigpump",
|
||||||
|
"group": "default",
|
||||||
|
"uploadType": "periodic",
|
||||||
|
"dataType": "INT",
|
||||||
|
"addr": "controlMode",
|
||||||
|
"readWrite": "ro",
|
||||||
|
"unit": "",
|
||||||
|
"desc": "",
|
||||||
|
"transformType": 0,
|
||||||
|
"gain": "1.0",
|
||||||
|
"offset": "0.0",
|
||||||
|
"enableBit": 0,
|
||||||
|
"storageLwTSDB": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "energy_today",
|
||||||
|
"ctrlName": "rigpump",
|
||||||
|
"group": "default",
|
||||||
|
"uploadType": "periodic",
|
||||||
|
"dataType": "FLOAT",
|
||||||
|
"addr": "Energy_Total[0]",
|
||||||
|
"readWrite": "ro",
|
||||||
|
"unit": "",
|
||||||
|
"desc": "",
|
||||||
|
"transformType": 0,
|
||||||
|
"decimal": 2,
|
||||||
|
"gain": "1.0",
|
||||||
|
"offset": "0.0",
|
||||||
|
"storageLwTSDB": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "flow_rate",
|
||||||
|
"ctrlName": "rigpump",
|
||||||
|
"group": "default",
|
||||||
|
"uploadType": "periodic",
|
||||||
|
"dataType": "FLOAT",
|
||||||
|
"addr": "val_Flowmeter",
|
||||||
|
"readWrite": "ro",
|
||||||
|
"unit": "",
|
||||||
|
"desc": "",
|
||||||
|
"transformType": 0,
|
||||||
|
"decimal": 2,
|
||||||
|
"gain": "1.0",
|
||||||
|
"offset": "0.0",
|
||||||
|
"storageLwTSDB": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "energy_yesterday",
|
||||||
|
"ctrlName": "rigpump",
|
||||||
|
"group": "default",
|
||||||
|
"uploadType": "periodic",
|
||||||
|
"dataType": "FLOAT",
|
||||||
|
"addr": "Energy_Total[1]",
|
||||||
|
"readWrite": "ro",
|
||||||
|
"unit": "",
|
||||||
|
"desc": "",
|
||||||
|
"transformType": 0,
|
||||||
|
"decimal": 2,
|
||||||
|
"gain": "1.0",
|
||||||
|
"offset": "0.0",
|
||||||
|
"storageLwTSDB": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "cmd_Start",
|
||||||
|
"ctrlName": "rigpump",
|
||||||
|
"group": "default",
|
||||||
|
"uploadType": "periodic",
|
||||||
|
"dataType": "BIT",
|
||||||
|
"addr": "cmd_Start",
|
||||||
|
"readWrite": "rw",
|
||||||
|
"unit": "",
|
||||||
|
"desc": "",
|
||||||
|
"transformType": 0,
|
||||||
|
"bitMap": 0,
|
||||||
|
"gain": "1.0",
|
||||||
|
"offset": "0.0",
|
||||||
|
"reverseBit": 0,
|
||||||
|
"storageLwTSDB": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "cmd_Stop",
|
||||||
|
"ctrlName": "rigpump",
|
||||||
|
"group": "default",
|
||||||
|
"uploadType": "periodic",
|
||||||
|
"dataType": "BIT",
|
||||||
|
"addr": "cmd_Stop",
|
||||||
|
"readWrite": "rw",
|
||||||
|
"unit": "",
|
||||||
|
"desc": "",
|
||||||
|
"transformType": 0,
|
||||||
|
"bitMap": 0,
|
||||||
|
"gain": "1.0",
|
||||||
|
"offset": "0.0",
|
||||||
|
"reverseBit": 0,
|
||||||
|
"storageLwTSDB": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"alarmLables": [
|
||||||
|
"default"
|
||||||
|
],
|
||||||
|
"alarms": [],
|
||||||
|
"groups": [
|
||||||
|
{
|
||||||
|
"name": "default",
|
||||||
|
"uploadInterval": 600,
|
||||||
|
"reference": 44,
|
||||||
|
"LwTSDBSize": 1000,
|
||||||
|
"strategy": 1,
|
||||||
|
"historyDataPath": "/var/user/data/dbhome/device_supervisor/LwTSDB",
|
||||||
|
"enablePerOnchange": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"misc": {
|
||||||
|
"maxAlarmRecordSz": 2000,
|
||||||
|
"logLvl": "INFO",
|
||||||
|
"coms": [
|
||||||
|
{
|
||||||
|
"name": "rs232",
|
||||||
|
"baud": 9600,
|
||||||
|
"bits": 8,
|
||||||
|
"stopbits": 1,
|
||||||
|
"parityChk": "n"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "rs485",
|
||||||
|
"baud": 19200,
|
||||||
|
"bits": 8,
|
||||||
|
"stopbits": 1,
|
||||||
|
"parityChk": "n"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"cachePath": "/var/user/data/dbhome/device_supervisor/offlinedata",
|
||||||
|
"cacheSize": 10000,
|
||||||
|
"debugLogPath": "/var/user/data/dbhome/device_supervisor/debugLog",
|
||||||
|
"debugLogSize": 2000
|
||||||
|
},
|
||||||
|
"clouds": [
|
||||||
|
{
|
||||||
|
"cacheSize": 10000,
|
||||||
|
"enable": 1,
|
||||||
|
"type": "Standard MQTT",
|
||||||
|
"args": {
|
||||||
|
"host": "mq194.imistaway.net",
|
||||||
|
"port": 1883,
|
||||||
|
"clientId": "rig-pump-12",
|
||||||
|
"auth": 1,
|
||||||
|
"tls": 0,
|
||||||
|
"cleanSession": 1,
|
||||||
|
"mqttVersion": "v3.1.1",
|
||||||
|
"keepalive": 120,
|
||||||
|
"key": "",
|
||||||
|
"cert": "",
|
||||||
|
"rootCA": "",
|
||||||
|
"verifyServer": 0,
|
||||||
|
"verifyClient": 0,
|
||||||
|
"username": "admin",
|
||||||
|
"passwd": "columbus",
|
||||||
|
"authType": 1,
|
||||||
|
"willQos": 0,
|
||||||
|
"willRetain": 0,
|
||||||
|
"willTopic": "",
|
||||||
|
"willPayload": "",
|
||||||
|
"tlsAuth": "caSelfSigned"
|
||||||
|
},
|
||||||
|
"name": "default",
|
||||||
|
"uploadRules": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cacheSize": 10000,
|
||||||
|
"enable": 1,
|
||||||
|
"name": "ThingsBoard",
|
||||||
|
"type": "Standard MQTT",
|
||||||
|
"args": {
|
||||||
|
"host": "hp.henrypump.cloud",
|
||||||
|
"port": 1883,
|
||||||
|
"clientId": "rig-pump-12",
|
||||||
|
"auth": 1,
|
||||||
|
"tls": 0,
|
||||||
|
"cleanSession": 0,
|
||||||
|
"mqttVersion": "v3.1.1",
|
||||||
|
"keepalive": 60,
|
||||||
|
"key": "",
|
||||||
|
"cert": "",
|
||||||
|
"rootCA": "",
|
||||||
|
"verifyServer": 0,
|
||||||
|
"verifyClient": 0,
|
||||||
|
"username": "7gXrx1ZD45RIx6FGMVbT",
|
||||||
|
"passwd": "",
|
||||||
|
"willQos": 0,
|
||||||
|
"willRetain": 0,
|
||||||
|
"willTopic": "",
|
||||||
|
"willPayload": ""
|
||||||
|
},
|
||||||
|
"uploadRules": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"quickfaas": {
|
||||||
|
"genericFuncs": [],
|
||||||
|
"uploadFuncs": [
|
||||||
|
{
|
||||||
|
"name": "Send Data",
|
||||||
|
"trigger": "measure_event",
|
||||||
|
"topic": "meshify/db/194/_/rigpump/${MAC_LOWER}",
|
||||||
|
"qos": 1,
|
||||||
|
"groups": [
|
||||||
|
"default"
|
||||||
|
],
|
||||||
|
"funcName": "sendData",
|
||||||
|
"script": "# Enter your python code.\nimport json\nfrom common.Logger import logger\nfrom quickfaas.remotebus import publish\nimport re, uuid\nfrom paho.mqtt import client\n\nlwtData = {\n \"init\":False,\n \"client\": client.Client(client_id=str(uuid.uuid4()), clean_session=True, userdata=None, protocol=client.MQTTv311, transport=\"tcp\")\n}\ndef lwt(mac):\n try:\n #if not lwtData[\"connected\"]:\n if not lwtData[\"init\"]:\n logger.info(\"INITIALIZING LWT CLIENT\")\n lwtData[\"client\"].username_pw_set(username=\"admin\", password=\"columbus\")\n lwtData[\"client\"].will_set(\"meshify/db/194/_/mainHP/\" + mac + \":00:00/connected\",json.dumps({\"value\":False}))\n lwtData[\"init\"] = True\n logger.info(\"Connecting to MQTT Broker for LWT purposes!!!!!!!\")\n lwtData[\"client\"].connect(\"mq194.imistaway.net\",1883, 600)\n lwtData[\"client\"].publish(\"meshify/db/194/_/mainHP/\" + mac + \":00:00/connected\", json.dumps({\"value\":True}))\n except Exception as e:\n logger.error(\"LWT DID NOT DO THE THING\")\n logger.error(e)\n\ndef sendData(message):\n #logger.debug(message)\n mac = __topic__.split(\"/\")[-1] #':'.join(re.findall('..', '%012x' % uuid.getnode()))\n lwt(mac)\n for measure in message[\"measures\"]:\n try:\n logger.debug(measure)\n if measure[\"name\"] in [\"auto_manual\", \"auto_control_mode\", \"device_status\"]:\n logger.debug(\"Converting DINT/BOOL to STRING\")\n value = convert_int(measure[\"name\"], measure[\"value\"])\n logger.debug(\"Converted {} to {}\".format(measure[\"value\"], value))\n publish(__topic__ + \":01:99/\" + measure[\"name\"], json.dumps({\"value\": value}), __qos__)\n else:\n publish(__topic__ + \":01:99/\" + measure[\"name\"], json.dumps({\"value\": measure[\"value\"]}), __qos__)\n except Exception as e:\n logger.error(e)\n \n #publish(__topic__, json.dumps({measure[\"name\"]: measure[\"value\"]}), __qos__)\n\ndef convert_int(plc_tag, value):\n auto_manual = {\n 0: \"Manual\",\n 1: \"Auto\"\n }\n\n auto_control_mode = {\n 0: \"Pressure\",\n 1: \"Flow\"\n }\n\n device_status = {\n 1: \"Running\",\n 64: \"Idle\",\n 128: \"Overpressure\",\n 1024: \"Faulted\"\n }\n \n plc_tags = {\n \"auto_manual\": auto_manual.get(value, \"Invalid Code\"),\n \"auto_control_mode\": auto_control_mode.get(value, \"Invalid Code\"),\n \"device_status\": device_status.get(value, \"Invalid Code\"),\n }\n\n return plc_tags.get(plc_tag, \"Invalid Tag\")\n\n ",
|
||||||
|
"cloudName": "default",
|
||||||
|
"msgType": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"qos": 1,
|
||||||
|
"funcName": "sendData",
|
||||||
|
"script": "import json, os, time\nfrom common.Logger import logger\nfrom quickfaas.remotebus import publish\nfrom datetime import datetime as dt\nfrom mobiuspi_lib.gps import GPS\nfrom quickfaas.global_dict import get as get_params\nfrom quickfaas.global_dict import _set_global_args\n\ndef getGPS():\n # Create a gps instance\n gps = GPS()\n\n # Retrieve GPS information\n position_status = gps.get_position_status()\n logger.debug(\"position_status: \")\n logger.debug(position_status)\n latitude = position_status[\"latitude\"].split(\" \")\n longitude = position_status[\"longitude\"].split(\" \")\n lat_dec = int(latitude[0][:-1]) + (float(latitude[1][:-1])/60)\n lon_dec = int(longitude[0][:-1]) + (float(longitude[1][:-1])/60)\n if latitude[2] == \"S\":\n lat_dec = lat_dec * -1\n if longitude[2] == \"W\":\n lon_dec = lon_dec * -1\n #lat_dec = round(lat_dec, 7)\n #lon_dec = round(lon_dec, 7)\n logger.info(\"HERE IS THE GPS COORDS\")\n logger.info(f\"LATITUDE: {lat_dec}, LONGITUDE: {lon_dec}\")\n speedKnots = position_status[\"speed\"].split(\" \")\n speedMPH = float(speedKnots[0]) * 1.151\n return (f\"{lat_dec:.8f}\",f\"{lon_dec:.8f}\",f\"{speedMPH:.2f}\")\n\ndef chunk_payload(payload, chunk_size=20):\n if \"values\" in payload:\n # Original format: {\"ts\": ..., \"values\": {...}}\n chunked_values = list(payload[\"values\"].items())\n for i in range(0, len(chunked_values), chunk_size):\n yield {\n \"ts\": payload[\"ts\"],\n \"values\": dict(chunked_values[i:i+chunk_size])\n }\n else:\n # New format: {\"key1\": \"value1\", \"key2\": \"value2\"}\n chunked_keys = list(payload.keys())\n for i in range(0, len(chunked_keys), chunk_size):\n yield {k: payload[k] for k in chunked_keys[i:i+chunk_size]}\n\ndef sendData(message):\n #logger.debug(message)\n \n \n payload = {\"ts\": (round(dt.timestamp(dt.now())/600)*600)*1000, \"values\": {}}\n attributes_payload = {}\n for measure in message[\"measures\"]:\n try:\n logger.debug(measure)\n if measure[\"health\"] == 1:\n if measure[\"name\"] in [\"auto_manual\", \"auto_control_mode\", \"device_status\"]:\n logger.debug(\"Converting DINT/BOOL to STRING\")\n payload[\"values\"][measure[\"name\"]] = convert_int(measure[\"name\"], measure[\"value\"])\n payload[\"values\"][measure[\"name\"] + \"_int\"] = measure[\"value\"]\n else:\n payload[\"values\"][measure[\"name\"]] = measure[\"value\"]\n except Exception as e:\n logger.error(e)\n\n try:\n payload[\"values\"][\"latitude\"], payload[\"values\"][\"longitude\"], payload[\"values\"][\"speed\"] = getGPS()\n except:\n logger.error(\"Could not get GPS coordinates\")\n\n for chunk in chunk_payload(payload=payload):\n publish(__topic__, json.dumps(chunk), __qos__, cloud_name=\"ThingsBoard\")\n time.sleep(2)\n\n attributes_payload[\"latestReportTime\"] = (round(dt.timestamp(dt.now())/600)*600)*1000\n for chunk in chunk_payload(payload=attributes_payload):\n publish(\"v1/devices/me/attributes\", json.dumps(chunk), __qos__, cloud_name=\"ThingsBoard\")\n time.sleep(2)\n \n\ndef convert_int(plc_tag, value):\n auto_manual = {\n 0: \"Manual\",\n 1: \"Auto\"\n }\n\n auto_control_mode = {\n 0: \"Pressure\",\n 1: \"Flow\"\n }\n\n device_status = {\n 1: \"Running\",\n 64: \"Idle\",\n 128: \"Overpressure\",\n 1024: \"Faulted\"\n }\n \n plc_tags = {\n \"auto_manual\": auto_manual.get(value, \"Invalid Code\"),\n \"auto_control_mode\": auto_control_mode.get(value, \"Invalid Code\"),\n \"device_status\": device_status.get(value, \"Invalid Code\"),\n }\n\n return plc_tags.get(plc_tag, \"Invalid Tag\")\n\n ",
|
||||||
|
"name": "sendData",
|
||||||
|
"trigger": "measure_event",
|
||||||
|
"topic": "v1/devices/me/telemetry",
|
||||||
|
"cloudName": "ThingsBoard",
|
||||||
|
"groups": [
|
||||||
|
"default"
|
||||||
|
],
|
||||||
|
"msgType": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"downloadFuncs": [
|
||||||
|
{
|
||||||
|
"name": "Commands",
|
||||||
|
"topic": "meshify/sets/194/${MAC_UPPER}:01:99",
|
||||||
|
"qos": 1,
|
||||||
|
"funcName": "receiveCommand",
|
||||||
|
"payload_type": "Plaintext",
|
||||||
|
"script": "# Enter your python code.\nimport json\nfrom quickfaas.measure import recall\nfrom common.Logger import logger\n\ndef sync(mac,value, wizard_api):\n #get new values and send\n try:\n data = recall()#json.loads(recall().decode(\"utf-8\"))\n except Exception as e:\n logger.error(e)\n logger.info(data)\n for controller in data:\n for measure in controller[\"measures\"]:\n #publish measure\n topic = \"meshify/db/194/_/rigpump/\" + mac + \"/\" + measure[\"name\"]\n if measure[\"name\"] in [\"auto_manual\", \"auto_control_mode\", \"device_status\"]:\n payload = [{\"value\": convert_int(measure[\"name\"], measure[\"value\"])}]\n else:\n payload = [{\"value\": measure[\"value\"]}]\n logger.debug(\"Sending on topic: {}\".format(topic))\n logger.debug(\"Sending value: {}\".format(payload))\n wizard_api.mqtt_publish(topic, json.dumps(payload))\ndef writeplctag(mac, value, wizard_api):\n try:\n value = json.loads(value.replace(\"'\",'\"'))\n logger.debug(value)\n message = {\"rigpump\":{value[\"tag\"]: value[\"val\"]}}\n wizard_api.write_plc_values(message)\n except Exception as e:\n logger.debug(e)\n \ndef receiveCommand(topic, payload, wizard_api):\n logger.debug(topic)\n logger.debug(json.loads(payload))\n p = json.loads(payload)[0]\n command = p[\"payload\"][\"name\"].split(\".\")[1]\n commands = {\n \"sync\": sync,\n \"writeplctag\": writeplctag,\n }\n commands[command](p[\"mac\"].lower(),p[\"payload\"][\"value\"], wizard_api)\n #logger.debug(command)\n ack(p[\"msgId\"], p[\"mac\"], p[\"payload\"][\"name\"].split(\".\")[1], p[\"payload\"][\"value\"], wizard_api)\n\ndef ack(msgid, mac, name, value, wizard_api):\n #logger.debug(mac)\n mac = \"\".join(mac.split(\":\")[:-2])\n #logger.debug(msgid)\n #logger.debug(mac)\n #logger.debug(name)\n #logger.debug(value)\n wizard_api.mqtt_publish(\"meshify/responses/\" + str(msgid), json.dumps([{\"value\": \"{} Success Setting: {} To: {}\".format(mac,name, value), \"msgid\": str(msgid)}]))\n\ndef convert_int(plc_tag, value):\n auto_manual = {\n 0: \"Manual\",\n 1: \"Auto\"\n }\n\n auto_control_mode = {\n 0: \"Pressure\",\n 1: \"Flow\"\n }\n\n device_status = {\n 1: \"Running\",\n 64: \"Idle\",\n 128: \"Overpressure\",\n 1024: \"Faulted\"\n }\n\n plc_tags = {\n \"auto_manual\": auto_manual.get(value, \"Invalid Code\"),\n \"auto_control_mode\": auto_control_mode.get(value, \"Invalid Code\"),\n \"device_status\": device_status.get(value, \"Invalid Code\"),\n }\n\n return plc_tags.get(plc_tag, \"Invalid Tag\")",
|
||||||
|
"msgType": 0,
|
||||||
|
"trigger": "command_event",
|
||||||
|
"cloudName": "default"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "receiveCommand",
|
||||||
|
"topic": "v1/devices/me/rpc/request/+",
|
||||||
|
"qos": 1,
|
||||||
|
"funcName": "receiveCommand",
|
||||||
|
"payload_type": "JSON",
|
||||||
|
"script": "import json, time\nfrom datetime import datetime as dt\nfrom quickfaas.measure import recall, write\nfrom quickfaas.remotebus import publish\nfrom common.Logger import logger\n\n# Helper function to split the payload into chunks\ndef chunk_payload(payload, chunk_size=20):\n chunked_values = list(payload[\"values\"].items())\n for i in range(0, len(chunked_values), chunk_size):\n yield {\n \"ts\": payload[\"ts\"],\n \"values\": dict(chunked_values[i:i+chunk_size])\n }\n\ndef sync():\n #get new values and send\n payload = {\"ts\": round(dt.timestamp(dt.now()))*1000, \"values\": {}}\n topic = \"v1/devices/me/telemetry\"\n try:\n data = recall()#json.loads(recall().decode(\"utf-8\"))\n except Exception as e:\n logger.error(e)\n logger.debug(data)\n for controller in data:\n for measure in controller[\"measures\"]:\n #publish measure\n if measure[\"name\"] in [\"auto_manual\", \"auto_control_mode\", \"device_status\"]:\n payload[\"values\"][measure[\"name\"]] = convert_int(measure[\"name\"], measure[\"value\"])\n payload[\"values\"][measure[\"name\"]+ \"_int\"] = measure[\"value\"]\n else:\n payload[\"values\"][measure[\"name\"]] = measure[\"value\"]\n logger.debug(\"Sending on topic: {}\".format(topic))\n logger.debug(\"Sending value: {}\".format(payload))\n for chunk in chunk_payload(payload=payload):\n publish(topic, json.dumps(chunk), 1, cloud_name=\"ThingsBoard\")\n time.sleep(2)\ndef writeplctag(value):\n #value in the form {\"measurement\": <measurement_name>, \"value\": <value to write>}\n try:\n #value = json.loads(value.replace(\"'\",'\"'))\n logger.debug(value)\n #payload format: [{\"name\": \"advvfdipp\", \"measures\": [{\"name\": \"manualfrequencysetpoint\", \"value\": 49}]}]\n message = [{\"name\": \"rigpump\", \"measures\":[{\"name\":value[\"measurement\"], \"value\": value[\"value\"]}]}]\n resp = write(message) \n logger.debug(\"RETURN FROM WRITE: {}\".format(resp))\n return True\n except Exception as e:\n logger.debug(e)\n return False\n \ndef receiveCommand(topic, payload):\n try:\n logger.debug(topic)\n logger.debug(json.loads(payload))\n p = json.loads(payload)\n command = p[\"method\"]\n commands = {\n \"sync\": sync,\n \"writeplctag\": writeplctag,\n } \n if command == \"setPLCTag\":\n try:\n result = commands[\"writeplctag\"](p[\"params\"])\n logger.debug(result)\n except Exception as e:\n logger.error(e)\n #logger.debug(command)\n ack(topic.split(\"/\")[-1])\n time.sleep(2)\n sync()\n except Exception as e:\n logger.debug(e)\n \n\ndef ack(msgid):\n #logger.debug(msgid)\n #logger.debug(mac)\n #logger.debug(name)\n #logger.debug(value)\n publish(\"v1/devices/me/rpc/response/\" + str(msgid), json.dumps({\"msg\": {\"time\": time.time()}, \"metadata\": \"\", \"msgType\": \"\"}), 1)\n\ndef getMode():\n try:\n data = recall()\n for controller in data:\n for measure in controller[\"measures\"]:\n if measure[\"name\"] == \"pidcontrolmode\":\n return measure[\"value\"]\n except:\n return None\n\ndef convert_int(plc_tag, value):\n auto_manual = {\n 0: \"Manual\",\n 1: \"Auto\"\n }\n\n auto_control_mode = {\n 0: \"Pressure\",\n 1: \"Flow\"\n }\n\n device_status = {\n 1: \"Running\",\n 64: \"Idle\",\n 128: \"Overpressure\",\n 1024: \"Faulted\"\n }\n\n plc_tags = {\n \"auto_manual\": auto_manual.get(value, \"Invalid Code\"),\n \"auto_control_mode\": auto_control_mode.get(value, \"Invalid Code\"),\n \"device_status\": device_status.get(value, \"Invalid Code\"),\n }\n\n return plc_tags.get(plc_tag, \"Invalid Tag\")",
|
||||||
|
"msgType": 0,
|
||||||
|
"cloudName": "ThingsBoard",
|
||||||
|
"trigger": "command_event"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"labels": [
|
||||||
|
{
|
||||||
|
"key": "SN",
|
||||||
|
"value": "GF5022210011326"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "MAC",
|
||||||
|
"value": "00:18:05:1e:95:26"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "MAC_UPPER",
|
||||||
|
"value": "C4:93:00:0E:E9:F0"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "MAC_LOWER",
|
||||||
|
"value": "c4:93:00:0e:e9:f0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"modbusSlave": {
|
||||||
|
"enable": 0,
|
||||||
|
"protocol": "Modbus-TCP",
|
||||||
|
"port": 502,
|
||||||
|
"slaveAddr": 1,
|
||||||
|
"int16Ord": "ab",
|
||||||
|
"int32Ord": "abcd",
|
||||||
|
"float32Ord": "abcd",
|
||||||
|
"maxConnection": 5,
|
||||||
|
"mapping_table": []
|
||||||
|
},
|
||||||
|
"modbusRTUSlave": {
|
||||||
|
"enable": 0,
|
||||||
|
"protocol": "Modbus-RTU",
|
||||||
|
"coms": "rs485",
|
||||||
|
"slaveAddr": 1,
|
||||||
|
"int16Ord": "ab",
|
||||||
|
"int32Ord": "abcd",
|
||||||
|
"float32Ord": "abcd",
|
||||||
|
"mapping_table": []
|
||||||
|
},
|
||||||
|
"iec104Server": {
|
||||||
|
"enable": 0,
|
||||||
|
"cotSize": 2,
|
||||||
|
"port": 2404,
|
||||||
|
"serverList": [
|
||||||
|
{
|
||||||
|
"asduAddr": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"kValue": 12,
|
||||||
|
"wValue": 8,
|
||||||
|
"t0": 15,
|
||||||
|
"t1": 15,
|
||||||
|
"t2": 10,
|
||||||
|
"t3": 20,
|
||||||
|
"maximumLink": 5,
|
||||||
|
"timeSet": 1,
|
||||||
|
"byteOrder": "abcd",
|
||||||
|
"mapping_table": []
|
||||||
|
},
|
||||||
|
"iec101Server": {
|
||||||
|
"enable": 0,
|
||||||
|
"coms": "rs485",
|
||||||
|
"mode": "UnBalance",
|
||||||
|
"linkLen": 2,
|
||||||
|
"linkAddr": 1,
|
||||||
|
"asduLen": 2,
|
||||||
|
"ioaLen": 3,
|
||||||
|
"cotLen": 2,
|
||||||
|
"serverList": [
|
||||||
|
{
|
||||||
|
"asduAddr": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"linkTimeOut": 2000,
|
||||||
|
"timeSet": 1,
|
||||||
|
"idleTimeOut": 10000,
|
||||||
|
"byteOrder": "abcd",
|
||||||
|
"mapping_table": {
|
||||||
|
"YX": [],
|
||||||
|
"YC": [],
|
||||||
|
"YK": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"iec104Client": {
|
||||||
|
"enable": 0,
|
||||||
|
"connectType": 2,
|
||||||
|
"serverAddr": "ipower.inhandcloud.cn",
|
||||||
|
"serverPort": 2406,
|
||||||
|
"communicationCode": "",
|
||||||
|
"protocol": 1,
|
||||||
|
"asduAddr": 1,
|
||||||
|
"tls": 1,
|
||||||
|
"verification": 1,
|
||||||
|
"mapping_table": {
|
||||||
|
"YX": [],
|
||||||
|
"YC": [],
|
||||||
|
"YK": []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"opcuaServer": {
|
||||||
|
"enable": 0,
|
||||||
|
"port": 4840,
|
||||||
|
"maximumLink": 5,
|
||||||
|
"securityMode": 0,
|
||||||
|
"identifierType": "String",
|
||||||
|
"certificate": "None",
|
||||||
|
"privateKey": "None",
|
||||||
|
"pubsub": 0,
|
||||||
|
"mapping_table": []
|
||||||
|
},
|
||||||
|
"sl651Slave": {
|
||||||
|
"enable": 0,
|
||||||
|
"centerAaddr": 1,
|
||||||
|
"remoteAddr": "",
|
||||||
|
"addrCode": "",
|
||||||
|
"password": "",
|
||||||
|
"platform_list": [],
|
||||||
|
"mapping_table": []
|
||||||
|
},
|
||||||
|
"hj212Client": {
|
||||||
|
"enable": 0,
|
||||||
|
"platform_list": [],
|
||||||
|
"block_list": [],
|
||||||
|
"mapping_table": []
|
||||||
|
},
|
||||||
|
"southMetadata": {},
|
||||||
|
"bindMetadata": {
|
||||||
|
"version": "",
|
||||||
|
"timestamp": ""
|
||||||
|
},
|
||||||
|
"bindConfig": {
|
||||||
|
"enable": 0,
|
||||||
|
"bind": {
|
||||||
|
"modelId": "",
|
||||||
|
"modelName": "",
|
||||||
|
"srcId": "",
|
||||||
|
"srcName": "",
|
||||||
|
"devId": "",
|
||||||
|
"devName": ""
|
||||||
|
},
|
||||||
|
"varGroups": [],
|
||||||
|
"variables": [],
|
||||||
|
"alerts": []
|
||||||
|
},
|
||||||
|
"templates": {},
|
||||||
|
"version": "2.7.1"
|
||||||
|
}
|
||||||
117
Pub_Sub/rigpump/thingsboard/sub/receiveCommand.py
Normal file
117
Pub_Sub/rigpump/thingsboard/sub/receiveCommand.py
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
import json, time
|
||||||
|
from datetime import datetime as dt
|
||||||
|
from quickfaas.measure import recall, write
|
||||||
|
from quickfaas.remotebus import publish
|
||||||
|
from common.Logger import logger
|
||||||
|
|
||||||
|
# Helper function to split the payload into chunks
|
||||||
|
def chunk_payload(payload, chunk_size=20):
|
||||||
|
chunked_values = list(payload["values"].items())
|
||||||
|
for i in range(0, len(chunked_values), chunk_size):
|
||||||
|
yield {
|
||||||
|
"ts": payload["ts"],
|
||||||
|
"values": dict(chunked_values[i:i+chunk_size])
|
||||||
|
}
|
||||||
|
|
||||||
|
def sync():
|
||||||
|
#get new values and send
|
||||||
|
payload = {"ts": round(dt.timestamp(dt.now()))*1000, "values": {}}
|
||||||
|
topic = "v1/devices/me/telemetry"
|
||||||
|
try:
|
||||||
|
data = recall()#json.loads(recall().decode("utf-8"))
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
logger.debug(data)
|
||||||
|
for controller in data:
|
||||||
|
for measure in controller["measures"]:
|
||||||
|
#publish measure
|
||||||
|
if measure["name"] in ["auto_manual", "auto_control_mode", "device_status"]:
|
||||||
|
payload["values"][measure["name"]] = convert_int(measure["name"], measure["value"])
|
||||||
|
payload["values"][measure["name"]+ "_int"] = measure["value"]
|
||||||
|
else:
|
||||||
|
payload["values"][measure["name"]] = measure["value"]
|
||||||
|
logger.debug("Sending on topic: {}".format(topic))
|
||||||
|
logger.debug("Sending value: {}".format(payload))
|
||||||
|
for chunk in chunk_payload(payload=payload):
|
||||||
|
publish(topic, json.dumps(chunk), 1, cloud_name="ThingsBoard")
|
||||||
|
time.sleep(2)
|
||||||
|
def writeplctag(value):
|
||||||
|
#value in the form {"measurement": <measurement_name>, "value": <value to write>}
|
||||||
|
try:
|
||||||
|
#value = json.loads(value.replace("'",'"'))
|
||||||
|
logger.debug(value)
|
||||||
|
#payload format: [{"name": "advvfdipp", "measures": [{"name": "manualfrequencysetpoint", "value": 49}]}]
|
||||||
|
message = [{"name": "rigpump", "measures":[{"name":value["measurement"], "value": value["value"]}]}]
|
||||||
|
resp = write(message)
|
||||||
|
logger.debug("RETURN FROM WRITE: {}".format(resp))
|
||||||
|
return True
|
||||||
|
except Exception as e:
|
||||||
|
logger.debug(e)
|
||||||
|
return False
|
||||||
|
|
||||||
|
def receiveCommand(topic, payload):
|
||||||
|
try:
|
||||||
|
logger.debug(topic)
|
||||||
|
logger.debug(json.loads(payload))
|
||||||
|
p = json.loads(payload)
|
||||||
|
command = p["method"]
|
||||||
|
commands = {
|
||||||
|
"sync": sync,
|
||||||
|
"writeplctag": writeplctag,
|
||||||
|
}
|
||||||
|
if command == "setPLCTag":
|
||||||
|
try:
|
||||||
|
result = commands["writeplctag"](p["params"])
|
||||||
|
logger.debug(result)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
#logger.debug(command)
|
||||||
|
ack(topic.split("/")[-1])
|
||||||
|
time.sleep(2)
|
||||||
|
sync()
|
||||||
|
except Exception as e:
|
||||||
|
logger.debug(e)
|
||||||
|
|
||||||
|
|
||||||
|
def ack(msgid):
|
||||||
|
#logger.debug(msgid)
|
||||||
|
#logger.debug(mac)
|
||||||
|
#logger.debug(name)
|
||||||
|
#logger.debug(value)
|
||||||
|
publish("v1/devices/me/rpc/response/" + str(msgid), json.dumps({"msg": {"time": time.time()}, "metadata": "", "msgType": ""}), 1)
|
||||||
|
|
||||||
|
def getMode():
|
||||||
|
try:
|
||||||
|
data = recall()
|
||||||
|
for controller in data:
|
||||||
|
for measure in controller["measures"]:
|
||||||
|
if measure["name"] == "pidcontrolmode":
|
||||||
|
return measure["value"]
|
||||||
|
except:
|
||||||
|
return None
|
||||||
|
|
||||||
|
def convert_int(plc_tag, value):
|
||||||
|
auto_manual = {
|
||||||
|
0: "Manual",
|
||||||
|
1: "Auto"
|
||||||
|
}
|
||||||
|
|
||||||
|
auto_control_mode = {
|
||||||
|
0: "Pressure",
|
||||||
|
1: "Flow"
|
||||||
|
}
|
||||||
|
|
||||||
|
device_status = {
|
||||||
|
1: "Running",
|
||||||
|
64: "Idle",
|
||||||
|
128: "Overpressure",
|
||||||
|
1024: "Faulted"
|
||||||
|
}
|
||||||
|
|
||||||
|
plc_tags = {
|
||||||
|
"auto_manual": auto_manual.get(value, "Invalid Code"),
|
||||||
|
"auto_control_mode": auto_control_mode.get(value, "Invalid Code"),
|
||||||
|
"device_status": device_status.get(value, "Invalid Code"),
|
||||||
|
}
|
||||||
|
|
||||||
|
return plc_tags.get(plc_tag, "Invalid Tag")
|
||||||
@@ -6,20 +6,20 @@ discharge_02,sp_transfer,default,periodic,,FLOAT,,,,,Discharge_PSI_TP2_Scaled,2,
|
|||||||
flow_rate_fm_01,sp_transfer,default,periodic,,FLOAT,,,,,VAl_1_Flow_Meter_FR,2,,ro,bpd,,none,,,,,,,,,,,,,,,0,,,,,,,
|
flow_rate_fm_01,sp_transfer,default,periodic,,FLOAT,,,,,VAl_1_Flow_Meter_FR,2,,ro,bpd,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
flow_rate_fm_02,sp_transfer,default,periodic,,FLOAT,,,,,VAl_2_Flow_Meter_FR,2,,ro,bpd,,none,,,,,,,,,,,,,,,0,,,,,,,
|
flow_rate_fm_02,sp_transfer,default,periodic,,FLOAT,,,,,VAl_2_Flow_Meter_FR,2,,ro,bpd,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
totalizer_01_fm_01,sp_transfer,default,periodic,,FLOAT,,,,,VAL_1_Flow_Meter_T1,2,,ro,bbls,,none,,,,,,,,,,,,,,,0,,,,,,,
|
totalizer_01_fm_01,sp_transfer,default,periodic,,FLOAT,,,,,VAL_1_Flow_Meter_T1,2,,ro,bbls,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
totalizer_01_fm_02,sp_transfer,default,periodic,,FLOAT,,,,,VAL_2_Flow_Meter_T1,2,,ro,gal,,none,,,,,,,,,,,,,,,0,,,,,,,
|
totalizer_01_fm_02,sp_transfer,default,periodic,,FLOAT,,,,,VAL_2_Flow_Meter_T1,2,,ro,bbls,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
pump_01_start,sp_transfer,default,periodic,,BIT,,,,0,PF1_Start,,,rw,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
pump_01_start,sp_transfer,default,periodic,,BIT,,,,0,PF1_Start,,,rw,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
pump_01_stop,sp_transfer,default,periodic,,BIT,,,,0,PF1_stop,,,rw,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
pump_01_stop,sp_transfer,default,periodic,,BIT,,,,0,PF1_stop,,,rw,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
pump_01_speed_ref,sp_transfer,default,periodic,,FLOAT,,,,,PF1_SpeedRef,,,rw,Hz,,none,,,,,,,,,,,,,,,0,,,,,,,
|
pump_01_speed_ref,sp_transfer,default,periodic,,FLOAT,,,,,PF1_SpeedRef,2,,rw,Hz,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
pump_02_start,sp_transfer,default,periodic,,BIT,,,,0,PF2_Start,,,rw,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
pump_02_start,sp_transfer,default,periodic,,BIT,,,,0,PF2_Start,,,rw,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
pump_02_stop,sp_transfer,default,periodic,,BIT,,,,0,PF2_stop,,,rw,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
pump_02_stop,sp_transfer,default,periodic,,BIT,,,,0,PF2_stop,,,rw,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
pump_02_speed_ref,sp_transfer,default,periodic,,FLOAT,,,,,PF2_SpeedRef,,,rw,Hz,,none,,,,,,,,,,,,,,,0,,,,,,,
|
pump_02_speed_ref,sp_transfer,default,periodic,,FLOAT,,,,,PF2_SpeedRef,2,,rw,Hz,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
pump_01_drive_fault,sp_transfer,default,periodic,,BIT,,,,0,PF1_DriveFault,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
pump_01_drive_fault,sp_transfer,default,periodic,,BIT,,,,0,PF1_DriveFault,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
low_suction_01_spt,sp_transfer,default,periodic,,FLOAT,,,,,Low_suction_1_SPT,,,rw,psi,,none,,,,,,,,,,,,,,,0,,,,,,,
|
low_suction_01_spt,sp_transfer,default,periodic,,FLOAT,,,,,Low_suction_1_SPT,2,,rw,psi,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
low_suction_01_alm,sp_transfer,default,periodic,,BIT,,,,0,Low_Suction_1_PSI,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
low_suction_01_alm,sp_transfer,default,periodic,,BIT,,,,0,Low_Suction_1_PSI,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
hi_discharge_01_spt,sp_transfer,default,periodic,,FLOAT,,,,,High_Discharge_1_SPT,,,rw,psi,,none,,,,,,,,,,,,,,,0,,,,,,,
|
hi_discharge_01_spt,sp_transfer,default,periodic,,FLOAT,,,,,High_Discharge_1_SPT,2,,rw,psi,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
hi_discharge_01_alm,sp_transfer,default,periodic,,BIT,,,,0,High_Discharge_1_PSI,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
hi_discharge_01_alm,sp_transfer,default,periodic,,BIT,,,,0,High_Discharge_1_PSI,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
pump_02_drive_fault,sp_transfer,default,periodic,,BIT,,,,0,PF2_DriveFault,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
pump_02_drive_fault,sp_transfer,default,periodic,,BIT,,,,0,PF2_DriveFault,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
low_suction_02_spt,sp_transfer,default,periodic,,FLOAT,,,,,Low_suction_2_SPT,,,rw,psi,,none,,,,,,,,,,,,,,,0,,,,,,,
|
low_suction_02_spt,sp_transfer,default,periodic,,FLOAT,,,,,Low_suction_2_SPT,2,,rw,psi,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
low_suction_02_alm,sp_transfer,default,periodic,,BIT,,,,0,Low_Suction_2_PSI,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
low_suction_02_alm,sp_transfer,default,periodic,,BIT,,,,0,Low_Suction_2_PSI,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
hi_discharge_02_spt,sp_transfer,default,periodic,,FLOAT,,,,,High_Discharge_2_SPT,,,rw,psi,,none,,,,,,,,,,,,,,,0,,,,,,,
|
hi_discharge_02_spt,sp_transfer,default,periodic,,FLOAT,,,,,High_Discharge_2_SPT,2,,rw,psi,,none,,,,,,,,,,,,,,,0,,,,,,,
|
||||||
hi_discharge_02_alm,sp_transfer,default,periodic,,BIT,,,,0,High_Discharge_2_PSI,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
hi_discharge_02_alm,sp_transfer,default,periodic,,BIT,,,,0,High_Discharge_2_PSI.Q,,,ro,,,none,,,,,,,,,,,,,0,,0,,,,,,,
|
||||||
|
2704
Pub_Sub/sp_booster/thingsboard/tags.json
Normal file
2704
Pub_Sub/sp_booster/thingsboard/tags.json
Normal file
File diff suppressed because it is too large
Load Diff
358
Pub_Sub/sp_pond/thingsboard/sub/receiveCommand.py
Normal file
358
Pub_Sub/sp_pond/thingsboard/sub/receiveCommand.py
Normal file
@@ -0,0 +1,358 @@
|
|||||||
|
import json, os, time, shutil, re
|
||||||
|
from datetime import datetime as dt
|
||||||
|
from quickfaas.measure import recall, write
|
||||||
|
from quickfaas.remotebus import publish
|
||||||
|
from common.Logger import logger
|
||||||
|
|
||||||
|
# Helper function to split the payload into chunks
|
||||||
|
def chunk_payload(payload, chunk_size=20):
|
||||||
|
chunked_values = list(payload["values"].items())
|
||||||
|
for i in range(0, len(chunked_values), chunk_size):
|
||||||
|
yield {
|
||||||
|
"ts": payload["ts"],
|
||||||
|
"values": dict(chunked_values[i:i+chunk_size])
|
||||||
|
}
|
||||||
|
|
||||||
|
def sync():
|
||||||
|
#get new values and send
|
||||||
|
payload = {"ts": round(dt.timestamp(dt.now()))*1000, "values": {}}
|
||||||
|
topic = "v1/devices/me/telemetry"
|
||||||
|
qos = 1
|
||||||
|
try:
|
||||||
|
data = recall()#json.loads(recall().decode("utf-8"))
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
logger.debug(data)
|
||||||
|
resetPayload = {"ts": "", "values": {}}
|
||||||
|
regexPattern = r"fm_\d{2}_t\d"
|
||||||
|
pondLevels = {}
|
||||||
|
topic = "v1/devices/me/telemetry"
|
||||||
|
for controller in data:
|
||||||
|
for measure in controller["measures"]:
|
||||||
|
try:
|
||||||
|
if measure["health"] == 1:
|
||||||
|
if re.search(regexPattern, measure["name"]):
|
||||||
|
dayReset, weekReset, monthReset, yearReset = False, False, False, False
|
||||||
|
file_name = f"/var/user/files/totalizer_{measure['name']}.json"
|
||||||
|
payload["values"][measure["name"] + "_day_volume"], dayReset = totalizeDay(measure["value"], file_path=file_name)
|
||||||
|
payload["values"][measure["name"] + "_week_volume"], weekReset = totalizeWeek(measure["value"], file_path=file_name)
|
||||||
|
payload["values"][measure["name"] + "_month_volume"], monthReset = totalizeMonth(measure["value"], file_path=file_name)
|
||||||
|
payload["values"][measure["name"] + "_year_volume"], yearReset = totalizeYear(measure["value"], file_path=file_name)
|
||||||
|
|
||||||
|
if dayReset:
|
||||||
|
resetPayload["values"][measure["name"] + "_yesterday_volume"] = payload["values"][measure["name"] + "_day_volume"]
|
||||||
|
resetPayload["values"][measure["name"] + "_day_volume"] = 0
|
||||||
|
if weekReset:
|
||||||
|
resetPayload["values"][measure["name"] + "_last_week_volume"] = payload["values"][measure["name"] + "_week_volume"]
|
||||||
|
resetPayload["values"][measure["name"] + "_week_volume"] = 0
|
||||||
|
if monthReset:
|
||||||
|
resetPayload["values"][measure["name"] + "_last_month_volume"] = payload["values"][measure["name"] + "_month_volume"]
|
||||||
|
resetPayload["values"][measure["name"] + "_month_volume"] = 0
|
||||||
|
if yearReset:
|
||||||
|
resetPayload["values"][measure["name"] + "_last_year_volume"] = payload["values"][measure["name"] + "_year_volume"]
|
||||||
|
resetPayload["values"][measure["name"] + "_year_volume"] = 0
|
||||||
|
if "pond_level" in measure["name"]:
|
||||||
|
pondLevels[measure["name"]] = measure["value"]
|
||||||
|
payload["values"][measure["name"]] = measure["value"]
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
# GPT4: Loop through the pondLevels dictionary to calculate deviations with error checking
|
||||||
|
for i in range(1, 4): # Assuming pod IDs range from 01 to 03
|
||||||
|
pod_id = f"pod_{i:02d}" # Format pod ID
|
||||||
|
level_keys = [key for key in pondLevels if key.startswith(pod_id)]
|
||||||
|
levels = [pondLevels[key] for key in level_keys]
|
||||||
|
|
||||||
|
# Check if both pond levels are present
|
||||||
|
if len(levels) == 2:
|
||||||
|
# Calculate average and percent deviation when levels are present
|
||||||
|
avg_level = sum(levels) / len(levels) if sum(levels) > 0 else 1
|
||||||
|
deviation_percent = ((max(levels) - min(levels)) / avg_level) * 100 if avg_level != 0 else 0
|
||||||
|
payload["values"][f"{pod_id}_pond_level_deviation"] = deviation_percent
|
||||||
|
payload["values"][f"{pod_id}_pond_level_alm"] = 0 # Reset alarm to 0
|
||||||
|
else:
|
||||||
|
# Set alarm value if one or both levels are missing
|
||||||
|
payload["values"][f"{pod_id}_pond_level_alm"] = 1
|
||||||
|
|
||||||
|
|
||||||
|
for chunk in chunk_payload(payload=payload):
|
||||||
|
publish(topic, json.dumps(chunk), qos)
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
|
publish("v1/devices/me/attributes", json.dumps({"latestReportTime": (round(dt.timestamp(dt.now())/600)*600)*1000}), qos)
|
||||||
|
|
||||||
|
if resetPayload["values"]:
|
||||||
|
resetPayload["ts"] = 1 + (round(dt.timestamp(dt.now())/600)*600)*1000
|
||||||
|
for chunk in chunk_payload(payload=resetPayload):
|
||||||
|
publish(topic, json.dumps(chunk), qos)
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
|
def writeplctag(value):
|
||||||
|
#value in the form {"measurement": <measurement_name>, "value": <value to write>}
|
||||||
|
try:
|
||||||
|
#value = json.loads(value.replace("'",'"'))
|
||||||
|
logger.debug(value)
|
||||||
|
#payload format: [{"name": "advvfdipp", "measures": [{"name": "manualfrequencysetpoint", "value": 49}]}]
|
||||||
|
message = [{"name": "sp_pond", "measures":[{"name":value["measurement"], "value": value["value"]}]}]
|
||||||
|
resp = write(message)
|
||||||
|
logger.debug("RETURN FROM WRITE: {}".format(resp))
|
||||||
|
if resp[0]["measures"][0]["error_code"] == 0:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
except Exception as e:
|
||||||
|
logger.debug(e)
|
||||||
|
return False
|
||||||
|
|
||||||
|
def receiveCommand(topic, payload):
|
||||||
|
try:
|
||||||
|
logger.debug(topic)
|
||||||
|
logger.debug(json.loads(payload))
|
||||||
|
p = json.loads(payload)
|
||||||
|
command = p["method"]
|
||||||
|
commands = {
|
||||||
|
"sync": sync,
|
||||||
|
"writeplctag": writeplctag,
|
||||||
|
}
|
||||||
|
if command == "setPLCTag":
|
||||||
|
try:
|
||||||
|
result = commands["writeplctag"](p["params"])
|
||||||
|
logger.debug(result)
|
||||||
|
if result:
|
||||||
|
ack(topic.split("/")[-1])
|
||||||
|
if "cmd" in p["params"]["measurement"]:
|
||||||
|
time.sleep(0.5)
|
||||||
|
result = commands["writeplctag"]({"measurement": p["params"]["measurement"], "value": 0})
|
||||||
|
logger.debug(result)
|
||||||
|
if result and "start" in p["params"]["measurement"]:
|
||||||
|
for _ in range(10):
|
||||||
|
sync()
|
||||||
|
time.sleep(30)
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
elif command == "changeSetpoint":
|
||||||
|
try:
|
||||||
|
logger.debug("attempting controlpoint write")
|
||||||
|
params_type = {"measurement": "pidcontrolmode", "value": p["params"]["setpointType"]}
|
||||||
|
if params_type["value"]:
|
||||||
|
commands["writeplctag"](params_type)
|
||||||
|
time.sleep(2)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error("DID NOT WRITE CONTROL MODE")
|
||||||
|
logger.error(e)
|
||||||
|
try:
|
||||||
|
logger.debug("attempting setpoint write")
|
||||||
|
modes = {0: "flowsetpoint", 1: "fluidlevelsetpoint", 2: "tubingpressuresetpoint", 3: "manualfrequencysetpoint"}
|
||||||
|
params_value = {"value": p["params"]["setpointValue"]}
|
||||||
|
if params_value["value"]:
|
||||||
|
params_value["measurement"] = modes[getMode()]
|
||||||
|
result = commands["writeplctag"](params_value)
|
||||||
|
logger.debug(result)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error("DID NOT WRITE SETPOINT")
|
||||||
|
logger.error(e)
|
||||||
|
#logger.debug(command)
|
||||||
|
|
||||||
|
time.sleep(5)
|
||||||
|
sync()
|
||||||
|
except Exception as e:
|
||||||
|
logger.debug(e)
|
||||||
|
|
||||||
|
|
||||||
|
def ack(msgid, metadata="", msgType="ACK"):
|
||||||
|
#logger.debug(msgid)
|
||||||
|
#logger.debug(mac)
|
||||||
|
#logger.debug(name)
|
||||||
|
#logger.debug(value)
|
||||||
|
publish("v1/devices/me/rpc/response/" + str(msgid), json.dumps({"msg": {"time": time.time()}, "metadata": metadata, "msgType": msgType}), 1)
|
||||||
|
|
||||||
|
def getMode():
|
||||||
|
try:
|
||||||
|
data = recall()
|
||||||
|
for controller in data:
|
||||||
|
for measure in controller["measures"]:
|
||||||
|
if measure["name"] == "pidcontrolmode":
|
||||||
|
return measure["value"]
|
||||||
|
except:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def initialize_totalizers():
|
||||||
|
return {
|
||||||
|
"day": 0,
|
||||||
|
"week": 0,
|
||||||
|
"month": 0,
|
||||||
|
"year": 0,
|
||||||
|
"lifetime": 0,
|
||||||
|
"dayHolding": 0,
|
||||||
|
"weekHolding": 0,
|
||||||
|
"monthHolding": 0,
|
||||||
|
"yearHolding": 0
|
||||||
|
}
|
||||||
|
|
||||||
|
def getTotalizers(file_path="/var/user/files/totalizers.json"):
|
||||||
|
"""
|
||||||
|
Retrieves totalizer data from a JSON file.
|
||||||
|
|
||||||
|
:param file_path: Path to the JSON file storing totalizer data.
|
||||||
|
:return: Dictionary containing totalizer values.
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
with open(file_path, "r") as t:
|
||||||
|
totalizers = json.load(t)
|
||||||
|
if not totalizers or not isinstance(totalizers, dict):
|
||||||
|
logger.info("Invalid data format in the file. Initializing totalizers.")
|
||||||
|
totalizers = initialize_totalizers()
|
||||||
|
except FileNotFoundError:
|
||||||
|
logger.info("File not found. Initializing totalizers.")
|
||||||
|
totalizers = initialize_totalizers()
|
||||||
|
except json.JSONDecodeError:
|
||||||
|
timestamp = dt.now().strftime("%Y%m%d_%H%M%S")
|
||||||
|
# Split the file path and insert the timestamp before the extension
|
||||||
|
file_name, file_extension = os.path.splitext(file_path)
|
||||||
|
backup_file_path = f"{file_name}_{timestamp}{file_extension}"
|
||||||
|
shutil.copyfile(file_path, backup_file_path)
|
||||||
|
logger.error(f"Error decoding JSON. A backup of the file is created at {backup_file_path}. Initializing totalizers.")
|
||||||
|
totalizers = initialize_totalizers()
|
||||||
|
return totalizers
|
||||||
|
|
||||||
|
def saveTotalizers(totalizers, file_path="/var/user/files/totalizers.json"):
|
||||||
|
"""
|
||||||
|
Saves totalizer data to a JSON file.
|
||||||
|
|
||||||
|
:param totalizers: Dictionary containing totalizer values to be saved.
|
||||||
|
:param file_path: Path to the JSON file where totalizer data will be saved.
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
with open(file_path, "w") as t:
|
||||||
|
json.dump(totalizers, t)
|
||||||
|
except (IOError, OSError, json.JSONEncodeError) as e:
|
||||||
|
logger.error(f"Error saving totalizers to {file_path}: {e}")
|
||||||
|
raise # Optionally re-raise the exception if it should be handled by the caller
|
||||||
|
|
||||||
|
def totalizeDay(lifetime, file_path="/var/user/files/totalizers.json", max_retries=3, retry_delay=2):
|
||||||
|
"""
|
||||||
|
Update and save daily totalizers based on the lifetime value.
|
||||||
|
|
||||||
|
:param lifetime: The current lifetime total.
|
||||||
|
:param max_retries: Maximum number of save attempts.
|
||||||
|
:param retry_delay: Delay in seconds between retries.
|
||||||
|
:return: A tuple containing the calculated value and a boolean indicating if a reset occurred, or (None, False) if save fails.
|
||||||
|
"""
|
||||||
|
totalizers = getTotalizers(file_path=file_path)
|
||||||
|
now = dt.fromtimestamp(round(dt.timestamp(dt.now())/600)*600)
|
||||||
|
reset = False
|
||||||
|
value = lifetime - totalizers["dayHolding"]
|
||||||
|
|
||||||
|
if not int(now.strftime("%d")) == int(totalizers["day"]):
|
||||||
|
totalizers["dayHolding"] = lifetime
|
||||||
|
totalizers["day"] = int(now.strftime("%d"))
|
||||||
|
|
||||||
|
for attempt in range(max_retries):
|
||||||
|
try:
|
||||||
|
saveTotalizers(totalizers, file_path=file_path)
|
||||||
|
reset = True
|
||||||
|
return (value, reset)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Attempt {attempt + 1} failed to save totalizers: {e}")
|
||||||
|
if attempt < max_retries - 1:
|
||||||
|
time.sleep(retry_delay)
|
||||||
|
else:
|
||||||
|
logger.error("All attempts to save totalizers failed.")
|
||||||
|
return (None, False)
|
||||||
|
|
||||||
|
return (value, reset)
|
||||||
|
|
||||||
|
def totalizeWeek(lifetime, file_path="/var/user/files/totalizers.json", max_retries=3, retry_delay=2):
|
||||||
|
"""
|
||||||
|
Update and save weekly totalizers based on the lifetime value.
|
||||||
|
|
||||||
|
:param lifetime: The current lifetime total.
|
||||||
|
:param max_retries: Maximum number of save attempts.
|
||||||
|
:param retry_delay: Delay in seconds between retries.
|
||||||
|
:return: A tuple containing the calculated value and a boolean indicating if a reset occurred, or (None, False) if save fails.
|
||||||
|
"""
|
||||||
|
totalizers = getTotalizers(file_path=file_path)
|
||||||
|
now = dt.fromtimestamp(round(dt.timestamp(dt.now())/600)*600)
|
||||||
|
reset = False
|
||||||
|
value = lifetime - totalizers["weekHolding"]
|
||||||
|
if (not now.strftime("%U") == totalizers["week"] and now.strftime("%a") == "Sun") or totalizers["week"] == 0:
|
||||||
|
totalizers["weekHolding"] = lifetime
|
||||||
|
totalizers["week"] = now.strftime("%U")
|
||||||
|
|
||||||
|
for attempt in range(max_retries):
|
||||||
|
try:
|
||||||
|
saveTotalizers(totalizers, file_path=file_path)
|
||||||
|
reset = True
|
||||||
|
return (value, reset)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Attempt {attempt + 1} failed to save totalizers: {e}")
|
||||||
|
if attempt < max_retries - 1:
|
||||||
|
time.sleep(retry_delay)
|
||||||
|
else:
|
||||||
|
logger.error("All attempts to save totalizers failed.")
|
||||||
|
return (None, False)
|
||||||
|
return (value, reset)
|
||||||
|
|
||||||
|
def totalizeMonth(lifetime, file_path="/var/user/files/totalizers.json", max_retries=3, retry_delay=2):
|
||||||
|
"""
|
||||||
|
Update and save monthly totalizers based on the lifetime value.
|
||||||
|
|
||||||
|
:param lifetime: The current lifetime total.
|
||||||
|
:param max_retries: Maximum number of save attempts.
|
||||||
|
:param retry_delay: Delay in seconds between retries.
|
||||||
|
:return: A tuple containing the calculated value and a boolean indicating if a reset occurred, or (None, False) if save fails.
|
||||||
|
"""
|
||||||
|
totalizers = getTotalizers(file_path=file_path)
|
||||||
|
now = dt.fromtimestamp(round(dt.timestamp(dt.now())/600)*600)
|
||||||
|
reset = False
|
||||||
|
value = lifetime - totalizers["monthHolding"]
|
||||||
|
if not int(now.strftime("%m")) == int(totalizers["month"]):
|
||||||
|
totalizers["monthHolding"] = lifetime
|
||||||
|
totalizers["month"] = now.strftime("%m")
|
||||||
|
|
||||||
|
for attempt in range(max_retries):
|
||||||
|
try:
|
||||||
|
saveTotalizers(totalizers, file_path=file_path)
|
||||||
|
reset = True
|
||||||
|
return (value, reset)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Attempt {attempt + 1} failed to save totalizers: {e}")
|
||||||
|
if attempt < max_retries - 1:
|
||||||
|
time.sleep(retry_delay)
|
||||||
|
else:
|
||||||
|
logger.error("All attempts to save totalizers failed.")
|
||||||
|
return (None, False)
|
||||||
|
|
||||||
|
return (value,reset)
|
||||||
|
|
||||||
|
def totalizeYear(lifetime, file_path="/var/user/files/totalizers.json", max_retries=3, retry_delay=2):
|
||||||
|
"""
|
||||||
|
Update and save yearly totalizers based on the lifetime value.
|
||||||
|
|
||||||
|
:param lifetime: The current lifetime total.
|
||||||
|
:param max_retries: Maximum number of save attempts.
|
||||||
|
:param retry_delay: Delay in seconds between retries.
|
||||||
|
:return: A tuple containing the calculated value and a boolean indicating if a reset occurred, or (None, False) if save fails.
|
||||||
|
"""
|
||||||
|
totalizers = getTotalizers(file_path=file_path)
|
||||||
|
now = dt.fromtimestamp(round(dt.timestamp(dt.now())/600)*600)
|
||||||
|
reset = False
|
||||||
|
value = lifetime - totalizers["yearHolding"]
|
||||||
|
if not int(now.strftime("%Y")) == int(totalizers["year"]):
|
||||||
|
totalizers["yearHolding"] = lifetime
|
||||||
|
totalizers["year"] = now.strftime("%Y")
|
||||||
|
|
||||||
|
for attempt in range(max_retries):
|
||||||
|
try:
|
||||||
|
saveTotalizers(totalizers, file_path=file_path)
|
||||||
|
reset = True
|
||||||
|
return (value, reset)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Attempt {attempt + 1} failed to save totalizers: {e}")
|
||||||
|
if attempt < max_retries - 1:
|
||||||
|
time.sleep(retry_delay)
|
||||||
|
else:
|
||||||
|
logger.error("All attempts to save totalizers failed.")
|
||||||
|
return (None, False)
|
||||||
|
return (value, reset)
|
||||||
190
Pub_Sub/sp_transfer/thingsboard/pub/sendData.py
Normal file
190
Pub_Sub/sp_transfer/thingsboard/pub/sendData.py
Normal file
@@ -0,0 +1,190 @@
|
|||||||
|
# Enter your python code.
|
||||||
|
import json, os, time
|
||||||
|
from datetime import datetime as dt
|
||||||
|
from common.Logger import logger
|
||||||
|
from quickfaas.remotebus import publish
|
||||||
|
from quickfaas.global_dict import get as get_params
|
||||||
|
from quickfaas.global_dict import _set_global_args
|
||||||
|
from mobiuspi_lib.gps import GPS
|
||||||
|
|
||||||
|
def reboot():
|
||||||
|
#basic = Basic()
|
||||||
|
logger.info("!" * 10 + "REBOOTING DEVICE" + "!"*10)
|
||||||
|
r = os.popen("kill -s SIGHUP `cat /var/run/python/supervisord.pid`").read()
|
||||||
|
logger.info(f"REBOOT : {r}")
|
||||||
|
|
||||||
|
def checkFileExist(filename):
|
||||||
|
path = "/var/user/files"
|
||||||
|
if not os.path.exists(path):
|
||||||
|
logger.info("no folder making files folder in var/user")
|
||||||
|
os.makedirs(path)
|
||||||
|
with open(path + "/" + filename, "a") as f:
|
||||||
|
json.dump({}, f)
|
||||||
|
if not os.path.exists(path + "/" + filename):
|
||||||
|
logger.info("no creds file making creds file")
|
||||||
|
with open(path + "/" + filename, "a") as f:
|
||||||
|
json.dump({}, f)
|
||||||
|
|
||||||
|
def convertDStoJSON(ds):
|
||||||
|
j = dict()
|
||||||
|
for x in ds:
|
||||||
|
j[x["key"]] = x["value"]
|
||||||
|
return j
|
||||||
|
|
||||||
|
def convertJSONtoDS(j):
|
||||||
|
d = []
|
||||||
|
for key in j.keys():
|
||||||
|
d.append({"key": key, "value": j[key]})
|
||||||
|
return d
|
||||||
|
|
||||||
|
def checkCredentialConfig():
|
||||||
|
logger.info("CHECKING CONFIG")
|
||||||
|
cfgpath = "/var/user/cfg/device_supervisor/device_supervisor.cfg"
|
||||||
|
credspath = "/var/user/files/creds.json"
|
||||||
|
cfg = dict()
|
||||||
|
with open(cfgpath, "r") as f:
|
||||||
|
cfg = json.load(f)
|
||||||
|
clouds = cfg.get("clouds")
|
||||||
|
logger.info(clouds)
|
||||||
|
#if not configured then try to configure from stored values
|
||||||
|
if clouds[0]["args"]["clientId"] == "unknown" or clouds[0]["args"]["username"] == "unknown" or not clouds[0]["args"]["passwd"] or clouds[0]["args"]["passwd"] == "unknown":
|
||||||
|
checkFileExist("creds.json")
|
||||||
|
with open(credspath, "r") as c:
|
||||||
|
creds = json.load(c)
|
||||||
|
if creds:
|
||||||
|
logger.info("updating config with stored data")
|
||||||
|
clouds[0]["args"]["clientId"] = creds["clientId"]
|
||||||
|
clouds[0]["args"]["username"] = creds["userName"]
|
||||||
|
clouds[0]["args"]["passwd"] = creds["password"]
|
||||||
|
cfg["clouds"] = clouds
|
||||||
|
cfg = checkParameterConfig(cfg)
|
||||||
|
with open(cfgpath, "w", encoding='utf-8') as n:
|
||||||
|
json.dump(cfg, n, indent=1, ensure_ascii=False)
|
||||||
|
reboot()
|
||||||
|
else:
|
||||||
|
#assuming clouds is filled out, if data is different then assume someone typed in something new and store it, if creds is empty fill with clouds' data
|
||||||
|
checkFileExist("creds.json")
|
||||||
|
with open(credspath, "r") as c:
|
||||||
|
logger.info("updating stored file with new data")
|
||||||
|
cfg = checkParameterConfig(cfg)
|
||||||
|
with open(cfgpath, "w", encoding='utf-8') as n:
|
||||||
|
json.dump(cfg, n, indent=1, ensure_ascii=False)
|
||||||
|
creds = json.load(c)
|
||||||
|
if creds:
|
||||||
|
if creds["clientId"] != clouds[0]["args"]["clientId"]:
|
||||||
|
creds["clientId"] = clouds[0]["args"]["clientId"]
|
||||||
|
if creds["userName"] != clouds[0]["args"]["username"]:
|
||||||
|
creds["userName"] = clouds[0]["args"]["username"]
|
||||||
|
if creds["password"] != clouds[0]["args"]["passwd"]:
|
||||||
|
creds["password"] = clouds[0]["args"]["passwd"]
|
||||||
|
else:
|
||||||
|
creds["clientId"] = clouds[0]["args"]["clientId"]
|
||||||
|
creds["userName"] = clouds[0]["args"]["username"]
|
||||||
|
creds["password"] = clouds[0]["args"]["passwd"]
|
||||||
|
with open(credspath, "w") as cw:
|
||||||
|
json.dump(creds,cw)
|
||||||
|
|
||||||
|
def checkParameterConfig(cfg):
|
||||||
|
logger.info("Checking Parameters!!!!")
|
||||||
|
paramspath = "/var/user/files/params.json"
|
||||||
|
cfgparams = convertDStoJSON(cfg.get("labels"))
|
||||||
|
#check stored values
|
||||||
|
checkFileExist("params.json")
|
||||||
|
with open(paramspath, "r") as f:
|
||||||
|
logger.info("Opened param storage file")
|
||||||
|
params = json.load(f)
|
||||||
|
if params:
|
||||||
|
if cfgparams != params:
|
||||||
|
#go through each param
|
||||||
|
#if not "unknown" and cfg and params aren't the same take from cfg likely updated manually
|
||||||
|
#if key in cfg but not in params copy to params
|
||||||
|
logger.info("equalizing params between cfg and stored")
|
||||||
|
for key in cfgparams.keys():
|
||||||
|
try:
|
||||||
|
if cfgparams[key] != params[key] and cfgparams[key] != "unknown":
|
||||||
|
params[key] = cfgparams[key]
|
||||||
|
except:
|
||||||
|
params[key] = cfgparams[key]
|
||||||
|
cfg["labels"] = convertJSONtoDS(params)
|
||||||
|
_set_global_args(convertJSONtoDS(params))
|
||||||
|
with open(paramspath, "w") as p:
|
||||||
|
json.dump(params, p)
|
||||||
|
else:
|
||||||
|
with open(paramspath, "w") as p:
|
||||||
|
logger.info("initializing param file with params in memory")
|
||||||
|
json.dump(convertDStoJSON(get_params()), p)
|
||||||
|
cfg["labels"] = get_params()
|
||||||
|
|
||||||
|
return cfg
|
||||||
|
|
||||||
|
def getGPS():
|
||||||
|
# Create a gps instance
|
||||||
|
gps = GPS()
|
||||||
|
|
||||||
|
# Retrieve GPS information
|
||||||
|
position_status = gps.get_position_status()
|
||||||
|
logger.debug("position_status: ")
|
||||||
|
logger.debug(position_status)
|
||||||
|
latitude = position_status["latitude"].split(" ")
|
||||||
|
longitude = position_status["longitude"].split(" ")
|
||||||
|
lat_dec = int(latitude[0][:-1]) + (float(latitude[1][:-1])/60)
|
||||||
|
lon_dec = int(longitude[0][:-1]) + (float(longitude[1][:-1])/60)
|
||||||
|
if latitude[2] == "S":
|
||||||
|
lat_dec = lat_dec * -1
|
||||||
|
if longitude[2] == "W":
|
||||||
|
lon_dec = lon_dec * -1
|
||||||
|
#lat_dec = round(lat_dec, 7)
|
||||||
|
#lon_dec = round(lon_dec, 7)
|
||||||
|
logger.info("HERE IS THE GPS COORDS")
|
||||||
|
logger.info(f"LATITUDE: {lat_dec}, LONGITUDE: {lon_dec}")
|
||||||
|
speedKnots = position_status["speed"].split(" ")
|
||||||
|
speedMPH = float(speedKnots[0]) * 1.151
|
||||||
|
return (f"{lat_dec:.8f}",f"{lon_dec:.8f}",f"{speedMPH:.2f}")
|
||||||
|
|
||||||
|
def chunk_payload(payload, chunk_size=20):
|
||||||
|
if "values" in payload:
|
||||||
|
# Original format: {"ts": ..., "values": {...}}
|
||||||
|
chunked_values = list(payload["values"].items())
|
||||||
|
for i in range(0, len(chunked_values), chunk_size):
|
||||||
|
yield {
|
||||||
|
"ts": payload["ts"],
|
||||||
|
"values": dict(chunked_values[i:i+chunk_size])
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
# New format: {"key1": "value1", "key2": "value2"}
|
||||||
|
chunked_keys = list(payload.keys())
|
||||||
|
for i in range(0, len(chunked_keys), chunk_size):
|
||||||
|
yield {k: payload[k] for k in chunked_keys[i:i+chunk_size]}
|
||||||
|
|
||||||
|
def sendData(message):
|
||||||
|
#logger.debug(message)
|
||||||
|
try:
|
||||||
|
checkCredentialConfig()
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
payload = {"ts": (round(dt.timestamp(dt.now())/600)*600)*1000, "values": {}}
|
||||||
|
attributes_payload = {}
|
||||||
|
for measure in message["measures"]:
|
||||||
|
try:
|
||||||
|
logger.debug(measure)
|
||||||
|
if measure["health"] == 1:
|
||||||
|
if "_spt" in measure["name"]:
|
||||||
|
attributes_payload[measure["name"]] = measure["value"]
|
||||||
|
payload["values"][measure["name"]] = measure["value"]
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
|
||||||
|
try:
|
||||||
|
payload["values"]["latitude"], payload["values"]["longitude"], payload["values"]["speed"] = getGPS()
|
||||||
|
except:
|
||||||
|
logger.error("Could not get GPS coordinates")
|
||||||
|
|
||||||
|
for chunk in chunk_payload(payload=payload):
|
||||||
|
publish(__topic__, json.dumps(chunk), __qos__)
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
|
attributes_payload["latestReportTime"] = (round(dt.timestamp(dt.now())/600)*600)*1000
|
||||||
|
for chunk in chunk_payload(payload=attributes_payload):
|
||||||
|
publish("v1/devices/me/attributes", json.dumps(chunk), __qos__)
|
||||||
|
time.sleep(2)
|
||||||
|
|
||||||
412
Pub_Sub/sp_transfer/thingsboard/sp_transfer.cfg
Normal file
412
Pub_Sub/sp_transfer/thingsboard/sp_transfer.cfg
Normal file
File diff suppressed because one or more lines are too long
10
Pub_Sub/sp_transfer/thingsboard/sp_transfer.csv
Normal file
10
Pub_Sub/sp_transfer/thingsboard/sp_transfer.csv
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
MeasuringPointName,ControllerName,GroupName,UploadType,DataType,EnableBit,BitIndex,reverseBit,Address,Decimal,Len,ReadWrite,Unit,Description,Transform Type,MaxValue,MinValue,MaxScale,MinScale,Gain,Offset,startBit,endBit,Pt,Ct,Mapping_table,TransDecimal,bitMap,msecSample,DataEndianReverse,ReadOffset,ReadLength,DataParseMethod,BitId,storageLwTSDB
|
||||||
|
water_tank_01_level,sp_transfer,default,periodic,FLOAT,,,,Water_Tank_1_Level,2,,ro,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||||
|
hand_input,sp_transfer,default,periodic,BIT,,,0,Raw_Hand_Input,,,ro,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||||
|
local_start_input,sp_transfer,default,periodic,BIT,,,0,Raw_Local_Start,,,ro,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||||
|
auto_input,sp_transfer,default,periodic,BIT,,,0,Raw_Auto_Input,,,ro,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||||
|
cloud_control_cmd,sp_transfer,default,periodic,BIT,,,0,CMD_Cloud_Control,,,rw,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||||
|
start_permissive_spt,sp_transfer,default,periodic,FLOAT,,,,WTP_Start_Setpoint,2,,rw,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||||
|
stop_permissive_spt,sp_transfer,default,periodic,FLOAT,,,,WTP_Stop_Setpoint,2,,rw,,,none,,,,,,,,,,,,,,,,,,,,0
|
||||||
|
water_tank_01_hi_alm,sp_transfer,default,periodic,BIT,,,0,WT1_Hi_AL0,,,ro,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||||
|
water_tank_01_hihi_alm,sp_transfer,default,periodic,BIT,,,0,WT1_HiHi_AL0,,,ro,,,none,,,,,,,,,,,,,0,,,,,,,0
|
||||||
|
64
Pub_Sub/sp_transfer/thingsboard/sub/receiveAttributes.py
Normal file
64
Pub_Sub/sp_transfer/thingsboard/sub/receiveAttributes.py
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
import json, time
|
||||||
|
from datetime import datetime as dt
|
||||||
|
from quickfaas.measure import recall, write
|
||||||
|
from quickfaas.remotebus import publish
|
||||||
|
from common.Logger import logger
|
||||||
|
|
||||||
|
# Helper function to split the payload into chunks
|
||||||
|
def chunk_payload(payload, chunk_size=20):
|
||||||
|
chunked_values = list(payload["values"].items())
|
||||||
|
for i in range(0, len(chunked_values), chunk_size):
|
||||||
|
yield {
|
||||||
|
"ts": payload["ts"],
|
||||||
|
"values": dict(chunked_values[i:i+chunk_size])
|
||||||
|
}
|
||||||
|
|
||||||
|
def sync():
|
||||||
|
#get new values and send
|
||||||
|
payload = {"ts": round(dt.timestamp(dt.now()))*1000, "values": {}}
|
||||||
|
topic = "v1/devices/me/telemetry"
|
||||||
|
try:
|
||||||
|
data = recall()#json.loads(recall().decode("utf-8"))
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
logger.debug(data)
|
||||||
|
for controller in data:
|
||||||
|
for measure in controller["measures"]:
|
||||||
|
#publish measure
|
||||||
|
payload["values"][measure["name"]] = measure["value"]
|
||||||
|
logger.debug("Sending on topic: {}".format(topic))
|
||||||
|
logger.debug("Sending value: {}".format(payload))
|
||||||
|
for chunk in chunk_payload(payload=payload):
|
||||||
|
publish(topic, json.dumps(chunk), 1)
|
||||||
|
time.sleep(2)
|
||||||
|
def writeplctag(value):
|
||||||
|
#value in the form {"measurement": <measurement_name>, "value": <value to write>}
|
||||||
|
try:
|
||||||
|
#value = json.loads(value.replace("'",'"'))
|
||||||
|
logger.debug(value)
|
||||||
|
#payload format: [{"name": "advvfdipp", "measures": [{"name": "manualfrequencysetpoint", "value": 49}]}]
|
||||||
|
message = [{"name": "sp_transfer", "measures":[{"name":value["measurement"], "value": value["value"]}]}]
|
||||||
|
resp = write(message)
|
||||||
|
logger.debug("RETURN FROM WRITE: {}".format(resp))
|
||||||
|
return True
|
||||||
|
except Exception as e:
|
||||||
|
logger.debug(e)
|
||||||
|
return False
|
||||||
|
|
||||||
|
def receiveAttributes(topic, payload):
|
||||||
|
try:
|
||||||
|
logger.debug(topic)
|
||||||
|
logger.debug(json.loads(payload))
|
||||||
|
p = json.loads(payload)
|
||||||
|
for key, value in p.items():
|
||||||
|
try:
|
||||||
|
result = writeplctag({"measurement":key, "value":value})
|
||||||
|
logger.debug(result)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
#logger.debug(command)
|
||||||
|
sync()
|
||||||
|
except Exception as e:
|
||||||
|
logger.debug(e)
|
||||||
|
|
||||||
|
|
||||||
77
Pub_Sub/sp_transfer/thingsboard/sub/receiveCommand.py
Normal file
77
Pub_Sub/sp_transfer/thingsboard/sub/receiveCommand.py
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
import json, time
|
||||||
|
from datetime import datetime as dt
|
||||||
|
from quickfaas.measure import recall, write
|
||||||
|
from quickfaas.remotebus import publish
|
||||||
|
from common.Logger import logger
|
||||||
|
|
||||||
|
# Helper function to split the payload into chunks
|
||||||
|
def chunk_payload(payload, chunk_size=20):
|
||||||
|
chunked_values = list(payload["values"].items())
|
||||||
|
for i in range(0, len(chunked_values), chunk_size):
|
||||||
|
yield {
|
||||||
|
"ts": payload["ts"],
|
||||||
|
"values": dict(chunked_values[i:i+chunk_size])
|
||||||
|
}
|
||||||
|
|
||||||
|
def sync():
|
||||||
|
#get new values and send
|
||||||
|
payload = {"ts": round(dt.timestamp(dt.now()))*1000, "values": {}}
|
||||||
|
topic = "v1/devices/me/telemetry"
|
||||||
|
try:
|
||||||
|
data = recall()#json.loads(recall().decode("utf-8"))
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
logger.debug(data)
|
||||||
|
for controller in data:
|
||||||
|
for measure in controller["measures"]:
|
||||||
|
#publish measure
|
||||||
|
payload["values"][measure["name"]] = measure["value"]
|
||||||
|
logger.debug("Sending on topic: {}".format(topic))
|
||||||
|
logger.debug("Sending value: {}".format(payload))
|
||||||
|
for chunk in chunk_payload(payload=payload):
|
||||||
|
publish(topic, json.dumps(chunk), 1)
|
||||||
|
time.sleep(2)
|
||||||
|
def writeplctag(value):
|
||||||
|
#value in the form {"measurement": <measurement_name>, "value": <value to write>}
|
||||||
|
try:
|
||||||
|
#value = json.loads(value.replace("'",'"'))
|
||||||
|
logger.debug(value)
|
||||||
|
#payload format: [{"name": "advvfdipp", "measures": [{"name": "manualfrequencysetpoint", "value": 49}]}]
|
||||||
|
message = [{"name": "sp_transfer", "measures":[{"name":value["measurement"], "value": value["value"]}]}]
|
||||||
|
resp = write(message)
|
||||||
|
logger.debug("RETURN FROM WRITE: {}".format(resp))
|
||||||
|
return True
|
||||||
|
except Exception as e:
|
||||||
|
logger.debug(e)
|
||||||
|
return False
|
||||||
|
|
||||||
|
def receiveCommand(topic, payload):
|
||||||
|
try:
|
||||||
|
logger.debug(topic)
|
||||||
|
logger.debug(json.loads(payload))
|
||||||
|
p = json.loads(payload)
|
||||||
|
command = p["method"]
|
||||||
|
commands = {
|
||||||
|
"sync": sync,
|
||||||
|
"writeplctag": writeplctag,
|
||||||
|
}
|
||||||
|
if command == "setPLCTag":
|
||||||
|
try:
|
||||||
|
result = commands["writeplctag"](p["params"])
|
||||||
|
logger.debug(result)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
#logger.debug(command)
|
||||||
|
ack(topic.split("/")[-1])
|
||||||
|
time.sleep(5)
|
||||||
|
sync()
|
||||||
|
except Exception as e:
|
||||||
|
logger.debug(e)
|
||||||
|
|
||||||
|
|
||||||
|
def ack(msgid):
|
||||||
|
#logger.debug(msgid)
|
||||||
|
#logger.debug(mac)
|
||||||
|
#logger.debug(name)
|
||||||
|
#logger.debug(value)
|
||||||
|
publish("v1/devices/me/rpc/response/" + str(msgid), json.dumps({"msg": {"time": time.time()}, "metadata": "", "msgType": ""}), 1)
|
||||||
119
VPN/Nico Client/TestOpenVPN.OVPN
Normal file
119
VPN/Nico Client/TestOpenVPN.OVPN
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
##############################################
|
||||||
|
# Sample client-side OpenVPN 2.6 config file #
|
||||||
|
# for connecting to multi-client server. #
|
||||||
|
# #
|
||||||
|
# This configuration can be used by multiple #
|
||||||
|
# clients, however each client should have #
|
||||||
|
# its own cert and key files. #
|
||||||
|
# #
|
||||||
|
# On Windows, you might want to rename this #
|
||||||
|
# file so it has a .ovpn extension #
|
||||||
|
##############################################
|
||||||
|
|
||||||
|
# Specify that we are a client and that we
|
||||||
|
# will be pulling certain config file directives
|
||||||
|
# from the server.
|
||||||
|
client
|
||||||
|
|
||||||
|
# Use the same setting as you are using on
|
||||||
|
# the server.
|
||||||
|
# On most systems, the VPN will not function
|
||||||
|
# unless you partially or fully disable
|
||||||
|
# the firewall for the TUN/TAP interface.
|
||||||
|
;dev tap
|
||||||
|
dev tun
|
||||||
|
|
||||||
|
# Windows needs the TAP-Win32 adapter name
|
||||||
|
# from the Network Connections panel
|
||||||
|
# if you have more than one. On XP SP2,
|
||||||
|
# you may need to disable the firewall
|
||||||
|
# for the TAP adapter.
|
||||||
|
;dev-node MyTap
|
||||||
|
|
||||||
|
# Are we connecting to a TCP or
|
||||||
|
# UDP server? Use the same setting as
|
||||||
|
# on the server.
|
||||||
|
;proto tcp
|
||||||
|
proto udp
|
||||||
|
|
||||||
|
# The hostname/IP and port of the server.
|
||||||
|
# You can have multiple remote entries
|
||||||
|
# to load balance between the servers.
|
||||||
|
remote 166.252.175.224 1194
|
||||||
|
remote 172.85.171.82 1194
|
||||||
|
|
||||||
|
# Choose a random host from the remote
|
||||||
|
# list for load-balancing. Otherwise
|
||||||
|
# try hosts in the order specified.
|
||||||
|
;remote-random
|
||||||
|
|
||||||
|
# Keep trying indefinitely to resolve the
|
||||||
|
# host name of the OpenVPN server. Very useful
|
||||||
|
# on machines which are not permanently connected
|
||||||
|
# to the internet such as laptops.
|
||||||
|
resolv-retry infinite
|
||||||
|
|
||||||
|
# Most clients don't need to bind to
|
||||||
|
# a specific local port number.
|
||||||
|
nobind
|
||||||
|
|
||||||
|
# Downgrade privileges after initialization (non-Windows only)
|
||||||
|
;user openvpn
|
||||||
|
;group openvpn
|
||||||
|
|
||||||
|
# Try to preserve some state across restarts.
|
||||||
|
persist-tun
|
||||||
|
|
||||||
|
# If you are connecting through an
|
||||||
|
# HTTP proxy to reach the actual OpenVPN
|
||||||
|
# server, put the proxy server/IP and
|
||||||
|
# port number here. See the man page
|
||||||
|
# if your proxy server requires
|
||||||
|
# authentication.
|
||||||
|
;http-proxy-retry # retry on connection failures
|
||||||
|
;http-proxy [proxy server] [proxy port #]
|
||||||
|
|
||||||
|
# Wireless networks often produce a lot
|
||||||
|
# of duplicate packets. Set this flag
|
||||||
|
# to silence duplicate packet warnings.
|
||||||
|
;mute-replay-warnings
|
||||||
|
|
||||||
|
# SSL/TLS parms.
|
||||||
|
# See the server config file for more
|
||||||
|
# description. It's best to use
|
||||||
|
# a separate .crt/.key file pair
|
||||||
|
# for each client. A single ca
|
||||||
|
# file can be used for all clients.
|
||||||
|
ca ca.crt
|
||||||
|
cert nico.crt
|
||||||
|
key nico.key
|
||||||
|
|
||||||
|
# Verify server certificate by checking that the
|
||||||
|
# certificate has the correct key usage set.
|
||||||
|
# This is an important precaution to protect against
|
||||||
|
# a potential attack discussed here:
|
||||||
|
# http://openvpn.net/howto.html#mitm
|
||||||
|
#
|
||||||
|
# To use this feature, you will need to generate
|
||||||
|
# your server certificates with the keyUsage set to
|
||||||
|
# digitalSignature, keyEncipherment
|
||||||
|
# and the extendedKeyUsage to
|
||||||
|
# serverAuth
|
||||||
|
# EasyRSA can do this for you.
|
||||||
|
remote-cert-tls server
|
||||||
|
|
||||||
|
# Allow to connect to really old OpenVPN versions
|
||||||
|
# without AEAD support (OpenVPN 2.3.x or older)
|
||||||
|
# This adds AES-256-CBC as fallback cipher and
|
||||||
|
# keeps the modern ciphers as well.
|
||||||
|
;data-ciphers AES-256-GCM:AES-128-GCM:?CHACHA20-POLY1305:AES-256-CBC
|
||||||
|
|
||||||
|
# If a tls-auth key is used on the server
|
||||||
|
# then every client must also have the key.
|
||||||
|
;tls-auth ta.key 1
|
||||||
|
|
||||||
|
# Set log file verbosity.
|
||||||
|
verb 3
|
||||||
|
|
||||||
|
# Silence repeating messages
|
||||||
|
;mute 20
|
||||||
118
VPN/Nico Client/TestOpenVPN_HP.OVPN
Normal file
118
VPN/Nico Client/TestOpenVPN_HP.OVPN
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
##############################################
|
||||||
|
# Sample client-side OpenVPN 2.6 config file #
|
||||||
|
# for connecting to multi-client server. #
|
||||||
|
# #
|
||||||
|
# This configuration can be used by multiple #
|
||||||
|
# clients, however each client should have #
|
||||||
|
# its own cert and key files. #
|
||||||
|
# #
|
||||||
|
# On Windows, you might want to rename this #
|
||||||
|
# file so it has a .ovpn extension #
|
||||||
|
##############################################
|
||||||
|
|
||||||
|
# Specify that we are a client and that we
|
||||||
|
# will be pulling certain config file directives
|
||||||
|
# from the server.
|
||||||
|
client
|
||||||
|
|
||||||
|
# Use the same setting as you are using on
|
||||||
|
# the server.
|
||||||
|
# On most systems, the VPN will not function
|
||||||
|
# unless you partially or fully disable
|
||||||
|
# the firewall for the TUN/TAP interface.
|
||||||
|
;dev tap
|
||||||
|
dev tun
|
||||||
|
|
||||||
|
# Windows needs the TAP-Win32 adapter name
|
||||||
|
# from the Network Connections panel
|
||||||
|
# if you have more than one. On XP SP2,
|
||||||
|
# you may need to disable the firewall
|
||||||
|
# for the TAP adapter.
|
||||||
|
;dev-node MyTap
|
||||||
|
|
||||||
|
# Are we connecting to a TCP or
|
||||||
|
# UDP server? Use the same setting as
|
||||||
|
# on the server.
|
||||||
|
;proto tcp
|
||||||
|
proto udp
|
||||||
|
|
||||||
|
# The hostname/IP and port of the server.
|
||||||
|
# You can have multiple remote entries
|
||||||
|
# to load balance between the servers.
|
||||||
|
remote 172.85.171.82 1194
|
||||||
|
|
||||||
|
# Choose a random host from the remote
|
||||||
|
# list for load-balancing. Otherwise
|
||||||
|
# try hosts in the order specified.
|
||||||
|
;remote-random
|
||||||
|
|
||||||
|
# Keep trying indefinitely to resolve the
|
||||||
|
# host name of the OpenVPN server. Very useful
|
||||||
|
# on machines which are not permanently connected
|
||||||
|
# to the internet such as laptops.
|
||||||
|
resolv-retry infinite
|
||||||
|
|
||||||
|
# Most clients don't need to bind to
|
||||||
|
# a specific local port number.
|
||||||
|
nobind
|
||||||
|
|
||||||
|
# Downgrade privileges after initialization (non-Windows only)
|
||||||
|
;user openvpn
|
||||||
|
;group openvpn
|
||||||
|
|
||||||
|
# Try to preserve some state across restarts.
|
||||||
|
persist-tun
|
||||||
|
|
||||||
|
# If you are connecting through an
|
||||||
|
# HTTP proxy to reach the actual OpenVPN
|
||||||
|
# server, put the proxy server/IP and
|
||||||
|
# port number here. See the man page
|
||||||
|
# if your proxy server requires
|
||||||
|
# authentication.
|
||||||
|
;http-proxy-retry # retry on connection failures
|
||||||
|
;http-proxy [proxy server] [proxy port #]
|
||||||
|
|
||||||
|
# Wireless networks often produce a lot
|
||||||
|
# of duplicate packets. Set this flag
|
||||||
|
# to silence duplicate packet warnings.
|
||||||
|
;mute-replay-warnings
|
||||||
|
|
||||||
|
# SSL/TLS parms.
|
||||||
|
# See the server config file for more
|
||||||
|
# description. It's best to use
|
||||||
|
# a separate .crt/.key file pair
|
||||||
|
# for each client. A single ca
|
||||||
|
# file can be used for all clients.
|
||||||
|
ca ca.crt
|
||||||
|
cert nico.crt
|
||||||
|
key nico.key
|
||||||
|
|
||||||
|
# Verify server certificate by checking that the
|
||||||
|
# certificate has the correct key usage set.
|
||||||
|
# This is an important precaution to protect against
|
||||||
|
# a potential attack discussed here:
|
||||||
|
# http://openvpn.net/howto.html#mitm
|
||||||
|
#
|
||||||
|
# To use this feature, you will need to generate
|
||||||
|
# your server certificates with the keyUsage set to
|
||||||
|
# digitalSignature, keyEncipherment
|
||||||
|
# and the extendedKeyUsage to
|
||||||
|
# serverAuth
|
||||||
|
# EasyRSA can do this for you.
|
||||||
|
remote-cert-tls server
|
||||||
|
|
||||||
|
# Allow to connect to really old OpenVPN versions
|
||||||
|
# without AEAD support (OpenVPN 2.3.x or older)
|
||||||
|
# This adds AES-256-CBC as fallback cipher and
|
||||||
|
# keeps the modern ciphers as well.
|
||||||
|
;data-ciphers AES-256-GCM:AES-128-GCM:?CHACHA20-POLY1305:AES-256-CBC
|
||||||
|
|
||||||
|
# If a tls-auth key is used on the server
|
||||||
|
# then every client must also have the key.
|
||||||
|
;tls-auth ta.key 1
|
||||||
|
|
||||||
|
# Set log file verbosity.
|
||||||
|
verb 3
|
||||||
|
|
||||||
|
# Silence repeating messages
|
||||||
|
;mute 20
|
||||||
20
VPN/Nico Client/ca.crt
Normal file
20
VPN/Nico Client/ca.crt
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIDRTCCAi2gAwIBAgIUA5ZIApoeltCztaBg/JeH+SgMt3IwDQYJKoZIhvcNAQEL
|
||||||
|
BQAwFDESMBAGA1UEAwwJSGVucnlQdW1wMB4XDTI0MDUwMTIxMTQyN1oXDTM0MDQy
|
||||||
|
OTIxMTQyN1owFDESMBAGA1UEAwwJSGVucnlQdW1wMIIBIjANBgkqhkiG9w0BAQEF
|
||||||
|
AAOCAQ8AMIIBCgKCAQEApICJTFUY1xF+0nHwU0CKSiobSSqHkp5grGRY+FU5l2Np
|
||||||
|
Qvg++6aeHomBCfwe/4/EBVX0aGXjwuwYLWSij+1uHDINnCmXhd5hX01weFYhDJS2
|
||||||
|
UR0Xlccg7OTp2o4ljd/d0ozellf7tDP8qoKfFVLEHSvGghnSmj0O6fM6El3OiU51
|
||||||
|
pOxOruekvExavt8Mj+XbxAxq5R21qClJo50+gXLyHHFeVMqcqJLnz01wqNO0rXDe
|
||||||
|
5h5Xlk9mQAKfW1Rg9RAFDIgydFf2EwfmtYJV59gSeOJwEgg5Wx5vrXf/xHxZZsnp
|
||||||
|
jY8YPnII3PsYFjRww6uYhwKBeYI8tnpwisY2BfFpHQIDAQABo4GOMIGLMAwGA1Ud
|
||||||
|
EwQFMAMBAf8wHQYDVR0OBBYEFAD8RvALpSHNVirmp6Ul098yFsAmME8GA1UdIwRI
|
||||||
|
MEaAFAD8RvALpSHNVirmp6Ul098yFsAmoRikFjAUMRIwEAYDVQQDDAlIZW5yeVB1
|
||||||
|
bXCCFAOWSAKaHpbQs7WgYPyXh/koDLdyMAsGA1UdDwQEAwIBBjANBgkqhkiG9w0B
|
||||||
|
AQsFAAOCAQEACo0KLqvUjTNNj+76Jr092BAFlfkPnFRPis46s1fenyAMNSevOPvl
|
||||||
|
3yukYfI2FNpVErLFHRbo24Z0kmciHIuGprTC21HjxjMjRbDji818Vt62OR+wg9kg
|
||||||
|
uQ2U0E7yxNW9tPtMf+wGdc9eBakVqganMYlcRK9AgfTLMV+QHQZDzD+3COLcfz8q
|
||||||
|
AxigwJfChgVGQUkrOPlYtRrdfjz8oZB9DHaIfbsfsXV1kGc4CBcyvcWUYgPBAH9V
|
||||||
|
qNKcsepsNFARX8P3NCgsBID2bwc9kc/ArfeF+UZbTTVbwRVvZTa/WAQzY9Y9xrhY
|
||||||
|
HQw9r6oDUXeEIPyTwtYjfby2T5kPHevetg==
|
||||||
|
-----END CERTIFICATE-----
|
||||||
84
VPN/Nico Client/nico.crt
Normal file
84
VPN/Nico Client/nico.crt
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
Certificate:
|
||||||
|
Data:
|
||||||
|
Version: 3 (0x2)
|
||||||
|
Serial Number:
|
||||||
|
c5:3c:3d:ea:3c:70:00:7e:f9:71:0f:79:94:e0:f8:b0
|
||||||
|
Signature Algorithm: sha256WithRSAEncryption
|
||||||
|
Issuer: CN=HenryPump
|
||||||
|
Validity
|
||||||
|
Not Before: May 1 21:26:14 2024 GMT
|
||||||
|
Not After : Aug 4 21:26:14 2026 GMT
|
||||||
|
Subject: CN=nico
|
||||||
|
Subject Public Key Info:
|
||||||
|
Public Key Algorithm: rsaEncryption
|
||||||
|
Public-Key: (2048 bit)
|
||||||
|
Modulus:
|
||||||
|
00:bc:4b:fb:42:17:cb:e1:d8:bc:21:75:51:59:53:
|
||||||
|
b9:e9:41:cc:0b:dd:a0:5a:5c:f9:be:8d:37:4c:84:
|
||||||
|
11:6e:7d:e2:37:01:67:ef:96:e5:d4:e6:3f:cf:70:
|
||||||
|
23:d3:1e:cb:34:97:cb:02:07:5d:66:02:d4:0d:56:
|
||||||
|
e0:10:54:07:2c:cf:80:c7:62:18:30:a3:4e:0a:12:
|
||||||
|
54:95:a4:35:db:8c:fa:1f:65:c5:f5:0b:6d:63:1e:
|
||||||
|
f3:ac:3e:86:16:1f:98:e0:e6:be:1c:c2:12:10:08:
|
||||||
|
0a:c6:ac:55:0e:b9:ad:b7:33:31:f0:83:32:80:0e:
|
||||||
|
8d:42:e3:7e:00:b6:46:71:85:2b:75:d6:42:8d:b9:
|
||||||
|
e0:7c:cc:ac:b2:dc:94:81:f9:6d:3d:94:9a:1c:ca:
|
||||||
|
ea:e0:bb:b8:46:d9:0b:f4:39:46:2a:ac:83:8b:3b:
|
||||||
|
ec:bf:1b:9d:6c:7c:3f:3f:7a:dc:0d:4a:82:ce:87:
|
||||||
|
51:7d:74:f2:d5:80:38:0a:8c:ad:2f:4b:e3:0f:25:
|
||||||
|
16:82:b4:be:fa:77:82:2d:3e:0d:0c:67:a2:4b:14:
|
||||||
|
71:01:52:0d:31:4b:0c:84:71:b0:5a:12:4c:c9:20:
|
||||||
|
f6:b9:cc:14:5d:47:ec:c0:e0:18:23:f8:7e:d5:b3:
|
||||||
|
b9:1f:fa:34:dd:1e:11:63:f8:f5:40:91:92:aa:82:
|
||||||
|
7c:5f
|
||||||
|
Exponent: 65537 (0x10001)
|
||||||
|
X509v3 extensions:
|
||||||
|
X509v3 Basic Constraints:
|
||||||
|
CA:FALSE
|
||||||
|
X509v3 Subject Key Identifier:
|
||||||
|
A6:CB:3C:07:1E:C3:F1:1F:3B:B4:49:96:08:45:3D:BE:7C:C5:F6:6C
|
||||||
|
X509v3 Authority Key Identifier:
|
||||||
|
keyid:00:FC:46:F0:0B:A5:21:CD:56:2A:E6:A7:A5:25:D3:DF:32:16:C0:26
|
||||||
|
DirName:/CN=HenryPump
|
||||||
|
serial:03:96:48:02:9A:1E:96:D0:B3:B5:A0:60:FC:97:87:F9:28:0C:B7:72
|
||||||
|
X509v3 Extended Key Usage:
|
||||||
|
TLS Web Client Authentication
|
||||||
|
X509v3 Key Usage:
|
||||||
|
Digital Signature
|
||||||
|
Signature Algorithm: sha256WithRSAEncryption
|
||||||
|
Signature Value:
|
||||||
|
97:2b:c7:0a:1b:29:39:a0:e6:96:82:b8:55:12:d2:11:7a:7a:
|
||||||
|
bc:0f:60:c8:d8:ce:d0:63:f2:93:46:77:1d:cd:04:55:4f:26:
|
||||||
|
a3:1a:70:65:c5:4b:ca:32:4f:2e:ea:df:de:d4:0f:4b:a5:04:
|
||||||
|
9e:a0:1a:ab:ca:bf:30:34:ae:1c:32:1c:74:f3:f2:c0:4c:62:
|
||||||
|
4f:62:2d:fe:0f:7c:ea:da:59:65:61:5e:f5:36:0b:b3:70:07:
|
||||||
|
f2:df:1e:07:98:d8:87:7a:d5:82:4b:d3:ad:f3:5d:e5:93:91:
|
||||||
|
3e:07:e3:82:72:4a:4e:2d:6b:b8:9f:75:b1:c1:ae:6d:7a:ab:
|
||||||
|
4b:6c:26:d5:e9:c5:59:36:d2:e9:60:18:6e:8c:2b:fd:e7:d5:
|
||||||
|
9e:46:fe:44:0b:b2:f5:3d:d3:50:f4:59:e6:b8:d1:84:5e:a3:
|
||||||
|
98:e3:ca:ee:07:ec:c1:02:16:49:6b:11:13:98:b9:0a:f2:d1:
|
||||||
|
6a:5f:ff:56:9d:be:6a:22:ad:9b:e3:34:56:81:43:56:a2:79:
|
||||||
|
66:86:57:3c:1c:b7:c4:33:df:34:01:08:d5:dd:fd:f6:38:02:
|
||||||
|
3f:72:1d:f8:fa:44:1b:e8:85:0c:20:af:4a:0a:b3:a5:2e:d3:
|
||||||
|
d0:a0:58:01:14:91:04:15:f3:7d:44:49:eb:df:b4:50:aa:fa:
|
||||||
|
0b:73:91:10
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIDTzCCAjegAwIBAgIRAMU8Peo8cAB++XEPeZTg+LAwDQYJKoZIhvcNAQELBQAw
|
||||||
|
FDESMBAGA1UEAwwJSGVucnlQdW1wMB4XDTI0MDUwMTIxMjYxNFoXDTI2MDgwNDIx
|
||||||
|
MjYxNFowDzENMAsGA1UEAwwEbmljbzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
|
||||||
|
AQoCggEBALxL+0IXy+HYvCF1UVlTuelBzAvdoFpc+b6NN0yEEW594jcBZ++W5dTm
|
||||||
|
P89wI9MeyzSXywIHXWYC1A1W4BBUByzPgMdiGDCjTgoSVJWkNduM+h9lxfULbWMe
|
||||||
|
86w+hhYfmODmvhzCEhAICsasVQ65rbczMfCDMoAOjULjfgC2RnGFK3XWQo254HzM
|
||||||
|
rLLclIH5bT2UmhzK6uC7uEbZC/Q5Riqsg4s77L8bnWx8Pz963A1Kgs6HUX108tWA
|
||||||
|
OAqMrS9L4w8lFoK0vvp3gi0+DQxnoksUcQFSDTFLDIRxsFoSTMkg9rnMFF1H7MDg
|
||||||
|
GCP4ftWzuR/6NN0eEWP49UCRkqqCfF8CAwEAAaOBoDCBnTAJBgNVHRMEAjAAMB0G
|
||||||
|
A1UdDgQWBBSmyzwHHsPxHzu0SZYIRT2+fMX2bDBPBgNVHSMESDBGgBQA/EbwC6Uh
|
||||||
|
zVYq5qelJdPfMhbAJqEYpBYwFDESMBAGA1UEAwwJSGVucnlQdW1wghQDlkgCmh6W
|
||||||
|
0LO1oGD8l4f5KAy3cjATBgNVHSUEDDAKBggrBgEFBQcDAjALBgNVHQ8EBAMCB4Aw
|
||||||
|
DQYJKoZIhvcNAQELBQADggEBAJcrxwobKTmg5paCuFUS0hF6erwPYMjYztBj8pNG
|
||||||
|
dx3NBFVPJqMacGXFS8oyTy7q397UD0ulBJ6gGqvKvzA0rhwyHHTz8sBMYk9iLf4P
|
||||||
|
fOraWWVhXvU2C7NwB/LfHgeY2Id61YJL063zXeWTkT4H44JySk4ta7ifdbHBrm16
|
||||||
|
q0tsJtXpxVk20ulgGG6MK/3n1Z5G/kQLsvU901D0Wea40YReo5jjyu4H7MECFklr
|
||||||
|
EROYuQry0Wpf/1advmoirZvjNFaBQ1aieWaGVzwct8Qz3zQBCNXd/fY4Aj9yHfj6
|
||||||
|
RBvohQwgr0oKs6Uu09CgWAEUkQQV831ESevftFCq+gtzkRA=
|
||||||
|
-----END CERTIFICATE-----
|
||||||
30
VPN/Nico Client/nico.key
Normal file
30
VPN/Nico Client/nico.key
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
-----BEGIN ENCRYPTED PRIVATE KEY-----
|
||||||
|
MIIFJDBWBgkqhkiG9w0BBQ0wSTAxBgkqhkiG9w0BBQwwJAQQAlydeXPf9+FUGlGH
|
||||||
|
EgvbTAICCAAwDAYIKoZIhvcNAgkFADAUBggqhkiG9w0DBwQIZwOyte4bsAEEggTI
|
||||||
|
Fb9IYZA5B6q6CT3BR9yaYMQQETy5uYfnT8WOdonPqCy2HEn3j9HsPjHk8Ot/WWIs
|
||||||
|
SZH4uFcxij2VIC9v7kOreG7FKA/NJIrXMpYafPj7/+6ZwyGk3ig0pEIu1Zd7Kvap
|
||||||
|
jgxSPGq4U9UkPBsEc+ZngtzMxQKHR72wmSt7/S5rTsd844rZfv1fi5RxT9BnbxV9
|
||||||
|
ZCOmJed+R6Vrl3uGdgeJ6RZRJQT4Noxn1U8NW/yFey1wFiM0JVLi6SYxvNVp6k9e
|
||||||
|
MD1eU3Bg9NNlmoCbuWVlkU9dWCpk8m+4eia3YYCHkE6k+beNSoZaIU7geMQaPgNU
|
||||||
|
qOas6N8sz9k4aVKdAb9DLOxwvXxXylD5WoxYw+dpWF02ykOnW4IiRYhh9HJ4umFM
|
||||||
|
BWSue1BRSkIBhae4x4YmgqDAZGDvszgx1f/D8S1KXnnHc3AUU5dqhtrk3DEg1nI0
|
||||||
|
7hOwRzhchPyMlzO+f4GAiIZSbRKDHhzMNiTEZlyMbvSqoP6BYercC7VOTrZiZf+w
|
||||||
|
dK227m279E59kbVcKLJts5sftnQTFLqGty9ApIPWq5hRzb4yvmhYVVRa8pgRlAzx
|
||||||
|
Dj23F8GUM/xBQ9m7T/g9JkKx4QqKoozAJuK+aWbpaW0MY94669hQ5gn1w93WDH33
|
||||||
|
ndrPbdFA53b6I89oTXCR/LmXTu0/HYSb+ZDnmLlsy3Ot4fqT6ztc+OsdeOp8Cmev
|
||||||
|
tpmq1JB32wCgo4JMgyLfukoKjtYhHB/duNgdFQ/tV8tYjooMM24W8cv5SKRC2Oiu
|
||||||
|
6QN1Own3SVbb/AytyQsv0kEdzx9sw+efTDXGRHCO1npJwTK1xganXrEa2WBcpklm
|
||||||
|
iFPSmxu+9JQ6LQP5nJtGz4D/Q2Uju3weBZpsMKhluq6+9n9W3pXMfe6ID+B6tynA
|
||||||
|
NEuxIG6tZwM+WjhnaxYJ1/YGn7F+juqCSqpjNPSO6My3M0GO5Y/eP1ujYfaKRuBt
|
||||||
|
IKOJ4hIFmKHcfh7rHaKQbEa0wTF7X9yPb7CHufGMSwK15x6Bke2/OJIX+8F6zNxf
|
||||||
|
wpmOHHuarHXMEBfWHD9AP1tLkhPKMPb/QSjzW/OWzrhyRiANJhRn2sFdO7Ax8mO7
|
||||||
|
nJSHGg0yORJXlC5G5psdwUqLfORDjPsUa0rPogacByAp+uqNVJM7pXBipBZFK/el
|
||||||
|
HyYVLf9iZ2OCP1cRBWFMOpwV6SDZfVDQXvzzEjGZntEQ9Qwe/kKqPCmF5QFbDpSs
|
||||||
|
QC9fzl+5X3/yZrLRCPJ6IrGtIsYIrJ/yvaXWHbfK1kCpmE6TL8aLAg+vn2xRbfwe
|
||||||
|
u9YVKYk90kreZUWFp0ngYNSNg4AXWv0A9qAyIZEr2yo4Yp0yYztyejsJeNAudiep
|
||||||
|
t6zhAaztmU6I0Gdr3CMqTyu1zFQuOooOGXqORCRrAI9Y3tqza35lkWZRLKrYvJai
|
||||||
|
Zmkyhe0ewRUyaPObA4XWu/FtXWcj0YyJuVxjmP5Ke442BOr5fIT/dUzDL6nshuxP
|
||||||
|
BiD/FLbZ3R1SUdfoWQslzY6lF2OLwt6HxD6n2S7eEMSXVVlfkcRKC6nXwJOknO86
|
||||||
|
zGafBq4PIdSN2AFmc0nOmHARyFIAFJGrD7kxlTkkap7juGBQ1yhgt71wZgcZIHaf
|
||||||
|
Q4+BBhz8j6KZuQ2A7fw2baD+GJ+pjm79
|
||||||
|
-----END ENCRYPTED PRIVATE KEY-----
|
||||||
20
VPN/ca.crt
Normal file
20
VPN/ca.crt
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIDRTCCAi2gAwIBAgIUA5ZIApoeltCztaBg/JeH+SgMt3IwDQYJKoZIhvcNAQEL
|
||||||
|
BQAwFDESMBAGA1UEAwwJSGVucnlQdW1wMB4XDTI0MDUwMTIxMTQyN1oXDTM0MDQy
|
||||||
|
OTIxMTQyN1owFDESMBAGA1UEAwwJSGVucnlQdW1wMIIBIjANBgkqhkiG9w0BAQEF
|
||||||
|
AAOCAQ8AMIIBCgKCAQEApICJTFUY1xF+0nHwU0CKSiobSSqHkp5grGRY+FU5l2Np
|
||||||
|
Qvg++6aeHomBCfwe/4/EBVX0aGXjwuwYLWSij+1uHDINnCmXhd5hX01weFYhDJS2
|
||||||
|
UR0Xlccg7OTp2o4ljd/d0ozellf7tDP8qoKfFVLEHSvGghnSmj0O6fM6El3OiU51
|
||||||
|
pOxOruekvExavt8Mj+XbxAxq5R21qClJo50+gXLyHHFeVMqcqJLnz01wqNO0rXDe
|
||||||
|
5h5Xlk9mQAKfW1Rg9RAFDIgydFf2EwfmtYJV59gSeOJwEgg5Wx5vrXf/xHxZZsnp
|
||||||
|
jY8YPnII3PsYFjRww6uYhwKBeYI8tnpwisY2BfFpHQIDAQABo4GOMIGLMAwGA1Ud
|
||||||
|
EwQFMAMBAf8wHQYDVR0OBBYEFAD8RvALpSHNVirmp6Ul098yFsAmME8GA1UdIwRI
|
||||||
|
MEaAFAD8RvALpSHNVirmp6Ul098yFsAmoRikFjAUMRIwEAYDVQQDDAlIZW5yeVB1
|
||||||
|
bXCCFAOWSAKaHpbQs7WgYPyXh/koDLdyMAsGA1UdDwQEAwIBBjANBgkqhkiG9w0B
|
||||||
|
AQsFAAOCAQEACo0KLqvUjTNNj+76Jr092BAFlfkPnFRPis46s1fenyAMNSevOPvl
|
||||||
|
3yukYfI2FNpVErLFHRbo24Z0kmciHIuGprTC21HjxjMjRbDji818Vt62OR+wg9kg
|
||||||
|
uQ2U0E7yxNW9tPtMf+wGdc9eBakVqganMYlcRK9AgfTLMV+QHQZDzD+3COLcfz8q
|
||||||
|
AxigwJfChgVGQUkrOPlYtRrdfjz8oZB9DHaIfbsfsXV1kGc4CBcyvcWUYgPBAH9V
|
||||||
|
qNKcsepsNFARX8P3NCgsBID2bwc9kc/ArfeF+UZbTTVbwRVvZTa/WAQzY9Y9xrhY
|
||||||
|
HQw9r6oDUXeEIPyTwtYjfby2T5kPHevetg==
|
||||||
|
-----END CERTIFICATE-----
|
||||||
12
VPN/crl.pem
Normal file
12
VPN/crl.pem
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
-----BEGIN X509 CRL-----
|
||||||
|
MIIBsjCBmwIBATANBgkqhkiG9w0BAQsFADAUMRIwEAYDVQQDDAlIZW5yeVB1bXAX
|
||||||
|
DTI0MDUwMTIxMzExNVoXDTI0MTAyODIxMzExNVqgUzBRME8GA1UdIwRIMEaAFAD8
|
||||||
|
RvALpSHNVirmp6Ul098yFsAmoRikFjAUMRIwEAYDVQQDDAlIZW5yeVB1bXCCFAOW
|
||||||
|
SAKaHpbQs7WgYPyXh/koDLdyMA0GCSqGSIb3DQEBCwUAA4IBAQBEbpx0hCQl0T+C
|
||||||
|
OnmaZK7hNJpWma9gtBUpNTxiIppc2bc5iFP0kU+hJGHoFZUz2hGOmyXu2vxfFVau
|
||||||
|
QbaxRlioC5FElRxWy4bjRPbEuzyCOi+YsdJF5QW0nWx8K0GBX6DNnU0Dj/RTD50R
|
||||||
|
cxrdW4zT4UriL5v+pFw0OvtnhGGjkl1/VbEhrFCM6bsqm6zGpCLW4wK+3hxVZ31t
|
||||||
|
MdF4t8KgkiPjLqMDF/N8CKvvx+WmKH7ouH5q26wRJqXPZM3/qDpOR0PZy22LIL/5
|
||||||
|
5/RJjhoOm+hSw0adWGqPbd+LRR6VUWmmb1UOKItB5MIvqWCqgdoKLFpotU+XR9H+
|
||||||
|
4AsiBi0x
|
||||||
|
-----END X509 CRL-----
|
||||||
87
VPN/ig502ovpnserver.crt
Normal file
87
VPN/ig502ovpnserver.crt
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
Certificate:
|
||||||
|
Data:
|
||||||
|
Version: 3 (0x2)
|
||||||
|
Serial Number:
|
||||||
|
59:6d:e6:6b:2b:ea:d1:ae:0d:33:25:cc:85:d4:33:1a
|
||||||
|
Signature Algorithm: sha256WithRSAEncryption
|
||||||
|
Issuer: CN=HenryPump
|
||||||
|
Validity
|
||||||
|
Not Before: May 1 21:20:27 2024 GMT
|
||||||
|
Not After : Aug 4 21:20:27 2026 GMT
|
||||||
|
Subject: CN=ig502ovpnserver
|
||||||
|
Subject Public Key Info:
|
||||||
|
Public Key Algorithm: rsaEncryption
|
||||||
|
Public-Key: (2048 bit)
|
||||||
|
Modulus:
|
||||||
|
00:9d:60:e1:0c:8f:cf:12:c9:9d:61:cd:2f:c4:68:
|
||||||
|
4a:71:03:23:8b:f8:d7:7f:53:fb:d3:e2:7d:bd:07:
|
||||||
|
ed:45:3e:1c:14:fd:40:35:72:0d:b2:c6:43:32:57:
|
||||||
|
f9:cb:99:bb:7f:16:95:56:dd:c9:7a:3c:6b:c2:7a:
|
||||||
|
24:c1:ad:0b:b0:05:ed:ca:06:56:76:8a:5c:cc:cd:
|
||||||
|
f5:13:f7:e1:c4:ab:e7:87:6e:b3:86:7d:78:cb:da:
|
||||||
|
3a:fc:64:bb:74:9d:12:f9:88:c1:d0:63:16:32:d1:
|
||||||
|
97:4a:af:7c:15:e7:3b:5e:ec:97:16:f3:dd:a1:9c:
|
||||||
|
74:5d:44:69:09:ec:8e:86:77:45:f9:4e:2b:60:de:
|
||||||
|
c5:cb:e3:d4:81:10:39:84:74:84:8e:bc:a9:dc:dc:
|
||||||
|
20:20:08:5f:c6:5e:97:b9:10:f5:cd:51:b8:12:83:
|
||||||
|
63:19:f4:d1:b5:60:ee:63:6c:04:e8:e3:a1:1b:77:
|
||||||
|
25:16:e9:ab:68:eb:d0:ab:ef:d6:af:b4:b0:be:e6:
|
||||||
|
5f:68:a4:5c:00:72:63:1a:b5:17:e2:76:72:b6:ba:
|
||||||
|
cd:c3:ad:69:16:c7:44:3d:54:f8:19:c4:a8:35:a3:
|
||||||
|
e4:47:eb:c0:56:06:33:8b:b9:41:11:87:1b:2c:35:
|
||||||
|
b3:8b:fe:63:bc:f2:06:2b:41:eb:53:93:fc:81:8d:
|
||||||
|
6f:1d
|
||||||
|
Exponent: 65537 (0x10001)
|
||||||
|
X509v3 extensions:
|
||||||
|
X509v3 Basic Constraints:
|
||||||
|
CA:FALSE
|
||||||
|
X509v3 Subject Key Identifier:
|
||||||
|
58:DC:7D:51:44:B8:5D:0C:E2:4B:02:C2:D2:8A:49:88:70:FF:7D:65
|
||||||
|
X509v3 Authority Key Identifier:
|
||||||
|
keyid:00:FC:46:F0:0B:A5:21:CD:56:2A:E6:A7:A5:25:D3:DF:32:16:C0:26
|
||||||
|
DirName:/CN=HenryPump
|
||||||
|
serial:03:96:48:02:9A:1E:96:D0:B3:B5:A0:60:FC:97:87:F9:28:0C:B7:72
|
||||||
|
X509v3 Extended Key Usage:
|
||||||
|
TLS Web Server Authentication
|
||||||
|
X509v3 Key Usage:
|
||||||
|
Digital Signature, Key Encipherment
|
||||||
|
X509v3 Subject Alternative Name:
|
||||||
|
DNS:ig502ovpnserver
|
||||||
|
Signature Algorithm: sha256WithRSAEncryption
|
||||||
|
Signature Value:
|
||||||
|
59:17:3a:5b:ff:f1:4b:b6:9a:d2:a0:87:00:f4:8e:cf:b2:99:
|
||||||
|
30:a5:51:0d:12:27:87:77:e3:59:8b:e3:4b:c7:a6:eb:ef:2f:
|
||||||
|
84:30:04:c2:f0:ff:14:d0:f5:a8:0e:85:7f:58:e3:e6:e5:87:
|
||||||
|
94:6d:0a:19:98:5c:d7:ee:4c:38:94:8d:c4:2f:d9:09:36:fb:
|
||||||
|
25:3e:1a:62:de:40:ba:c4:6c:cd:3f:13:97:1f:cd:34:6c:d6:
|
||||||
|
a0:3d:09:72:5a:c7:68:eb:6b:85:4d:30:6a:17:d5:24:3c:43:
|
||||||
|
7a:3a:c2:f6:63:e0:c6:70:17:ec:8c:80:1f:c3:7c:e6:b6:26:
|
||||||
|
dc:53:7f:26:f9:b6:7a:6e:51:ad:f6:b1:03:29:18:c1:7d:fc:
|
||||||
|
2b:18:8e:b4:7c:81:8b:ba:9f:89:54:05:3f:02:45:3f:98:31:
|
||||||
|
95:8c:cb:78:e6:35:f0:7b:db:02:4b:fa:50:bf:0c:70:23:e9:
|
||||||
|
19:f9:70:10:70:79:2c:5a:09:6c:5c:9b:10:cf:63:80:5d:04:
|
||||||
|
8a:8a:41:4d:f4:47:e6:dd:4c:68:3c:0e:5e:25:1a:c1:20:6a:
|
||||||
|
6a:41:e7:e1:f1:90:a2:0c:9c:52:92:49:e3:bd:ee:b9:11:c8:
|
||||||
|
ba:19:13:e5:bc:9c:4a:2b:8f:7d:db:93:28:7d:7b:72:d8:aa:
|
||||||
|
5c:53:b4:a1
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIDdTCCAl2gAwIBAgIQWW3mayvq0a4NMyXMhdQzGjANBgkqhkiG9w0BAQsFADAU
|
||||||
|
MRIwEAYDVQQDDAlIZW5yeVB1bXAwHhcNMjQwNTAxMjEyMDI3WhcNMjYwODA0MjEy
|
||||||
|
MDI3WjAaMRgwFgYDVQQDDA9pZzUwMm92cG5zZXJ2ZXIwggEiMA0GCSqGSIb3DQEB
|
||||||
|
AQUAA4IBDwAwggEKAoIBAQCdYOEMj88SyZ1hzS/EaEpxAyOL+Nd/U/vT4n29B+1F
|
||||||
|
PhwU/UA1cg2yxkMyV/nLmbt/FpVW3cl6PGvCeiTBrQuwBe3KBlZ2ilzMzfUT9+HE
|
||||||
|
q+eHbrOGfXjL2jr8ZLt0nRL5iMHQYxYy0ZdKr3wV5zte7JcW892hnHRdRGkJ7I6G
|
||||||
|
d0X5Titg3sXL49SBEDmEdISOvKnc3CAgCF/GXpe5EPXNUbgSg2MZ9NG1YO5jbATo
|
||||||
|
46EbdyUW6ato69Cr79avtLC+5l9opFwAcmMatRfidnK2us3DrWkWx0Q9VPgZxKg1
|
||||||
|
o+RH68BWBjOLuUERhxssNbOL/mO88gYrQetTk/yBjW8dAgMBAAGjgbwwgbkwCQYD
|
||||||
|
VR0TBAIwADAdBgNVHQ4EFgQUWNx9UUS4XQziSwLC0opJiHD/fWUwTwYDVR0jBEgw
|
||||||
|
RoAUAPxG8AulIc1WKuanpSXT3zIWwCahGKQWMBQxEjAQBgNVBAMMCUhlbnJ5UHVt
|
||||||
|
cIIUA5ZIApoeltCztaBg/JeH+SgMt3IwEwYDVR0lBAwwCgYIKwYBBQUHAwEwCwYD
|
||||||
|
VR0PBAQDAgWgMBoGA1UdEQQTMBGCD2lnNTAyb3ZwbnNlcnZlcjANBgkqhkiG9w0B
|
||||||
|
AQsFAAOCAQEAWRc6W//xS7aa0qCHAPSOz7KZMKVRDRInh3fjWYvjS8em6+8vhDAE
|
||||||
|
wvD/FND1qA6Ff1jj5uWHlG0KGZhc1+5MOJSNxC/ZCTb7JT4aYt5AusRszT8Tlx/N
|
||||||
|
NGzWoD0JclrHaOtrhU0wahfVJDxDejrC9mPgxnAX7IyAH8N85rYm3FN/Jvm2em5R
|
||||||
|
rfaxAykYwX38KxiOtHyBi7qfiVQFPwJFP5gxlYzLeOY18HvbAkv6UL8McCPpGflw
|
||||||
|
EHB5LFoJbFybEM9jgF0EiopBTfRH5t1MaDwOXiUawSBqakHn4fGQogycUpJJ473u
|
||||||
|
uRHIuhkT5bycSiuPfduTKH17ctiqXFO0oQ==
|
||||||
|
-----END CERTIFICATE-----
|
||||||
30
VPN/ig502ovpnserver.key
Normal file
30
VPN/ig502ovpnserver.key
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
-----BEGIN ENCRYPTED PRIVATE KEY-----
|
||||||
|
MIIFJDBWBgkqhkiG9w0BBQ0wSTAxBgkqhkiG9w0BBQwwJAQQCC4EKtiuElrV2YIM
|
||||||
|
D0B13QICCAAwDAYIKoZIhvcNAgkFADAUBggqhkiG9w0DBwQIERj5nZ3J7YgEggTI
|
||||||
|
F7e5yoHh9BQxXVUmkLT+XqoDc+gu32MlQizfV2Ct+VJw37cdAIUfEa4aDmds+z51
|
||||||
|
knJ1dJV4nxttL6DTLq4tPMbi/lwrLZh/uc2NkXc92LUf7X85GfGTZsNr7hBl+3V6
|
||||||
|
JeMXK0DhDEpmmUEfHVw8rydYeCqc4/+WGm1ztRoZLD8Zkh6Xk/82k7B4Hza7a6RF
|
||||||
|
aCgHADtkjAtwKC41eBQXhZG/8zwo7KcN1tYjgJNJEevFD/H4rbociiffL1t5DrcY
|
||||||
|
+f7ZdBYj/kk5d2xA04ouOE1ND6DnGC7SWHI/NnMk76KF3RVNBL7wyjW02AjjkIrB
|
||||||
|
t0K0kkeLOA5Kagka0oO0F3z7MSxkOGYOSuV4lRrsyQKTimeJCPlMId5fOfXJv0tx
|
||||||
|
JSeCUlSoE8YTtM8u/xE69Axv61hSi30KRZ3qUJDy0ITFJ/CkkGMRaS2OmYHKhMQl
|
||||||
|
XKcadqRT4Yg95aoOFA53Y6QcQOwJMVqWUIAjLyk6HAE81ee6Cr0n1k6aLXDOrWkP
|
||||||
|
n2FstZZ06wi933klcY/9w45YXCs07hUtbZRXZGjUFR/vQuM82LmpyVwTS/cpLkw+
|
||||||
|
Fjev9ZbItCZYzyDjlv3/B9yq3L8lw4PVU+Dsq1e+BTZ4fTnTIEi+Tj138wWmT0xj
|
||||||
|
kp6oxilK+bSXwFEFqFnDdnpvJclV4hc6wHZd9JVb8Te2ozWtRHJwQ+Ss4HhcvTFu
|
||||||
|
ac7r1M7lnjGjQU1Rs8zCbdxFcKQU9RGRNy4sHnWcsECFlGzwkB3S1CRGpPNc01Cd
|
||||||
|
ASkS1hoB9htKBfw/gu34JlIL+B8/6tgqSFPGIWcR4JVReJEdmg3DRI9UkBwdGTKC
|
||||||
|
LI+E9s4fUdary+dSFZh+lNpp716tJFp2VL2/WlQEffea907UiEGlH1AAlSYf1UjP
|
||||||
|
03oWCRDWQBtUdMBv+WdELmM/ZZ+Pg42cnJ+h3XJaoz04cQcagTz82qIRGtlLVKZU
|
||||||
|
8eR7TM5pbA/WGtdl6z5NvgzBGGg4+onUHXVGjL+0XsH0t+3vm+7CMzHkoVNJQS6e
|
||||||
|
xoQh2MUOEJmA1wKkeaGb8E1ciILcRZ6PQVoon4LrCWk1kuxdhxoy6b1ktFPAzGhR
|
||||||
|
yEczeNUt/7TjCDuLaL34ldBTTpFLRcYvIlP4G41iVZL4joWxfVilzcrdZiCfPCx9
|
||||||
|
jno8EffbDh1n7LD3ZYpSF3VIFwJY6wwNw+/Hyp0ZETiJ8UtGSlWFfHSRblwmIlbL
|
||||||
|
XYtUwfBEFFNkzqRWDFLaIpqKq2Xc042aavWDoVFAJ+/h8QI+sPVTwXyvIIwWzP1k
|
||||||
|
hIR0NDafFUA+HE/V5dr9yUkTz4D+QbX2Jh4WVbWFXgSG5gxW6yg7SHaOwWq0ZEAh
|
||||||
|
RrhTV7xMBr/JAeRdUB76v2rd7HN2leljXbkAWmlXpvc4zezpaCxoNr6a8B55cBEo
|
||||||
|
3CPjzObjn3T7Yx/XvlNpewy8ZDQ6Xwl7G8hKiO+IAJvrrngOBTY0rAgXgojuXpR6
|
||||||
|
R1xW1OjFqL+e5xxAgaQrMElr6LhN4OWoFwsgyMfcpX0vKqSA0ofyU304Zg+7ETwH
|
||||||
|
/DhIiAC3+kwCpHvnfuJ4TpYC8ga8dXhI4Hne+ZpxLsSEHyYoC4N2BHYt8++IPPHf
|
||||||
|
wJcKq8CBAitftLhjCMkyL5vtEx3m79T/
|
||||||
|
-----END ENCRYPTED PRIVATE KEY-----
|
||||||
73
code snippets/alarmList.ipynb
Normal file
73
code snippets/alarmList.ipynb
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
{
|
||||||
|
"cells": [
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 1,
|
||||||
|
"metadata": {},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"import json\n",
|
||||||
|
"from openpyxl import Workbook\n",
|
||||||
|
"\n",
|
||||||
|
"# Load the JSON data\n",
|
||||||
|
"with open('/Users/nico/Documents/GitHub/thingsboard_vc/device_profile/836174d0-44f2-11ed-b441-bfcc3466332b.json') as f:\n",
|
||||||
|
" data = json.load(f)\n",
|
||||||
|
"\n",
|
||||||
|
"# Create a new Excel workbook\n",
|
||||||
|
"wb = Workbook()\n",
|
||||||
|
"ws = wb.active\n",
|
||||||
|
"\n",
|
||||||
|
"# Set the column headers\n",
|
||||||
|
"ws['A1'] = 'Alarm Type'\n",
|
||||||
|
"ws['B1'] = 'PLC Tag'\n",
|
||||||
|
"ws['C1'] = 'Priority'\n",
|
||||||
|
"ws['D1'] = 'Output'\n",
|
||||||
|
"\n",
|
||||||
|
"# Iterate through the alarms and create rows in the spreadsheet\n",
|
||||||
|
"row_num = 2\n",
|
||||||
|
"for alarm in data['entity']['profileData']['alarms']:\n",
|
||||||
|
" alarm_type = alarm['alarmType']\n",
|
||||||
|
" plc_tag = alarm['clearRule']['condition']['condition'][0]['key']['key']\n",
|
||||||
|
" priority_key = next(iter(alarm['createRules']))\n",
|
||||||
|
" priority = priority_key.upper()\n",
|
||||||
|
" output_map = {\n",
|
||||||
|
" 'CRITICAL': 'Voice, SMS, Email',\n",
|
||||||
|
" 'MAJOR': 'SMS, Email',\n",
|
||||||
|
" 'MINOR': 'Email'\n",
|
||||||
|
" }\n",
|
||||||
|
" output = output_map.get(priority, '')\n",
|
||||||
|
"\n",
|
||||||
|
" ws[f'A{row_num}'] = alarm_type\n",
|
||||||
|
" ws[f'B{row_num}'] = plc_tag\n",
|
||||||
|
" ws[f'C{row_num}'] = priority\n",
|
||||||
|
" ws[f'D{row_num}'] = output\n",
|
||||||
|
"\n",
|
||||||
|
" row_num += 1\n",
|
||||||
|
"\n",
|
||||||
|
"# Save the Excel file\n",
|
||||||
|
"wb.save('/Users/nico/Desktop/HR Tank Battery Alarms.xlsx')"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"kernelspec": {
|
||||||
|
"display_name": "xlxs",
|
||||||
|
"language": "python",
|
||||||
|
"name": "python3"
|
||||||
|
},
|
||||||
|
"language_info": {
|
||||||
|
"codemirror_mode": {
|
||||||
|
"name": "ipython",
|
||||||
|
"version": 3
|
||||||
|
},
|
||||||
|
"file_extension": ".py",
|
||||||
|
"mimetype": "text/x-python",
|
||||||
|
"name": "python",
|
||||||
|
"nbconvert_exporter": "python",
|
||||||
|
"pygments_lexer": "ipython3",
|
||||||
|
"version": "3.1.-1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nbformat": 4,
|
||||||
|
"nbformat_minor": 2
|
||||||
|
}
|
||||||
77
code snippets/base_receiveCommand.py
Normal file
77
code snippets/base_receiveCommand.py
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
import json, time
|
||||||
|
from datetime import datetime as dt
|
||||||
|
from quickfaas.measure import recall, write
|
||||||
|
from quickfaas.remotebus import publish
|
||||||
|
from common.Logger import logger
|
||||||
|
|
||||||
|
# Helper function to split the payload into chunks
|
||||||
|
def chunk_payload(payload, chunk_size=20):
|
||||||
|
chunked_values = list(payload["values"].items())
|
||||||
|
for i in range(0, len(chunked_values), chunk_size):
|
||||||
|
yield {
|
||||||
|
"ts": payload["ts"],
|
||||||
|
"values": dict(chunked_values[i:i+chunk_size])
|
||||||
|
}
|
||||||
|
|
||||||
|
def sync():
|
||||||
|
#get new values and send
|
||||||
|
payload = {"ts": round(dt.timestamp(dt.now()))*1000, "values": {}}
|
||||||
|
topic = "v1/devices/me/telemetry"
|
||||||
|
try:
|
||||||
|
data = recall()#json.loads(recall().decode("utf-8"))
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
logger.debug(data)
|
||||||
|
for controller in data:
|
||||||
|
for measure in controller["measures"]:
|
||||||
|
#publish measure
|
||||||
|
payload["values"][measure["name"]] = measure["value"]
|
||||||
|
logger.debug("Sending on topic: {}".format(topic))
|
||||||
|
logger.debug("Sending value: {}".format(payload))
|
||||||
|
for chunk in chunk_payload(payload=payload):
|
||||||
|
publish(topic, json.dumps(chunk), 1)
|
||||||
|
time.sleep(2)
|
||||||
|
def writeplctag(value):
|
||||||
|
#value in the form {"measurement": <measurement_name>, "value": <value to write>}
|
||||||
|
try:
|
||||||
|
#value = json.loads(value.replace("'",'"'))
|
||||||
|
logger.debug(value)
|
||||||
|
#payload format: [{"name": "advvfdipp", "measures": [{"name": "manualfrequencysetpoint", "value": 49}]}]
|
||||||
|
message = [{"name": "advvfdipp", "measures":[{"name":value["measurement"], "value": value["value"]}]}]
|
||||||
|
resp = write(message)
|
||||||
|
logger.debug("RETURN FROM WRITE: {}".format(resp))
|
||||||
|
return True
|
||||||
|
except Exception as e:
|
||||||
|
logger.debug(e)
|
||||||
|
return False
|
||||||
|
|
||||||
|
def receiveCommand(topic, payload):
|
||||||
|
try:
|
||||||
|
logger.debug(topic)
|
||||||
|
logger.debug(json.loads(payload))
|
||||||
|
p = json.loads(payload)
|
||||||
|
command = p["method"]
|
||||||
|
commands = {
|
||||||
|
"sync": sync,
|
||||||
|
"writeplctag": writeplctag,
|
||||||
|
}
|
||||||
|
if command == "setPLCTag":
|
||||||
|
try:
|
||||||
|
result = commands["writeplctag"](p["params"])
|
||||||
|
logger.debug(result)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(e)
|
||||||
|
#logger.debug(command)
|
||||||
|
ack(topic.split("/")[-1])
|
||||||
|
time.sleep(5)
|
||||||
|
sync()
|
||||||
|
except Exception as e:
|
||||||
|
logger.debug(e)
|
||||||
|
|
||||||
|
|
||||||
|
def ack(msgid):
|
||||||
|
#logger.debug(msgid)
|
||||||
|
#logger.debug(mac)
|
||||||
|
#logger.debug(name)
|
||||||
|
#logger.debug(value)
|
||||||
|
publish("v1/devices/me/rpc/response/" + str(msgid), json.dumps({"msg": {"time": time.time()}, "metadata": "", "msgType": ""}), 1)
|
||||||
1267
code snippets/datapoints.json
Normal file
1267
code snippets/datapoints.json
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
18
code snippets/mobotix_example.py
Normal file
18
code snippets/mobotix_example.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
from requests.adapters import HTTPAdapter, Retry
|
||||||
|
from requests.auth import HTTPDigestAuth, HTTPBasicAuth
|
||||||
|
from requests.exceptions import ConnectionError, RetryError
|
||||||
|
import time, requests
|
||||||
|
with open('./snapshot.jpg', 'wb') as handle:
|
||||||
|
with requests.Session() as s:
|
||||||
|
retries = Retry(total = 3, backoff_factor=0.1, status_forcelist=[404,408, 500, 502, 503, 504])
|
||||||
|
s.mount('http://', HTTPAdapter(max_retries=retries))
|
||||||
|
resp = ""
|
||||||
|
try:
|
||||||
|
resp = s.get("http://192.168.1.97/cgi-bin/jpg/image.cgi?id=2.1212121212", auth=HTTPDigestAuth("admin", "Amerus@1903"), stream=True)
|
||||||
|
except RetryError as m:
|
||||||
|
print(m)
|
||||||
|
if resp:
|
||||||
|
for block in resp.iter_content(1024):
|
||||||
|
if not block:
|
||||||
|
break
|
||||||
|
handle.write(block)
|
||||||
459
code snippets/rpiSimDevice.ipynb
Normal file
459
code snippets/rpiSimDevice.ipynb
Normal file
File diff suppressed because one or more lines are too long
129
code snippets/rpiSimDevice.py
Normal file
129
code snippets/rpiSimDevice.py
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
import paho.mqtt.client as mqtt
|
||||||
|
import json
|
||||||
|
import time
|
||||||
|
import math
|
||||||
|
import random
|
||||||
|
# MQTT Broker settings
|
||||||
|
MQTT_BROKER = "hp.henrypump.cloud"
|
||||||
|
MQTT_TOPIC = "v1/devices/me/telemetry"
|
||||||
|
# Data simulation settings
|
||||||
|
DATA_INTERVAL = 10 * 60 # 10 minutes
|
||||||
|
#SINE_WAVE_PERIOD = 3600 # 1 hour
|
||||||
|
#RANDOM_MIN = 0
|
||||||
|
#RANDOM_MAX = 100
|
||||||
|
SHUTDOWN_DURATION = 30 * 60 # 30 minutes
|
||||||
|
# Load data points configuration from JSON file
|
||||||
|
with open('/Users/nico/Documents/GitHub/HP_InHand_IG502/code snippets/datapoints.json') as f:
|
||||||
|
datapoints_config = json.load(f)
|
||||||
|
# Shutdown state variables
|
||||||
|
shutdown_active = False
|
||||||
|
shutdown_start_time = 0
|
||||||
|
# MQTT Client setup
|
||||||
|
client = mqtt.Client(client_id="rpiSim")
|
||||||
|
client.username_pw_set(username="henrypumptest2")
|
||||||
|
client.connect(MQTT_BROKER)
|
||||||
|
def reconnect_to_broker():
|
||||||
|
if not client.is_connected():
|
||||||
|
try:
|
||||||
|
client.reconnect()
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Error reconnecting to broker: {e}")
|
||||||
|
time.sleep(1)
|
||||||
|
def round_to_nearest_ten_minutes(ts):
|
||||||
|
return ts - (ts % 600000) + 600000 * ((ts // 600000) % 10)
|
||||||
|
"""
|
||||||
|
def generate_sine_wave_value(t, period, amplitude=1, offset=0):
|
||||||
|
return amplitude * math.sin(2 * math.pi * t / period) + offset
|
||||||
|
"""
|
||||||
|
def generate_sine_wave_value(datapoint):
|
||||||
|
amplitude = datapoints_config[datapoint]['amplitude']
|
||||||
|
frequency = datapoints_config[datapoint]['frequency']
|
||||||
|
phase = random.uniform(0, .5)#datapoints_config[datapoint]['phase']
|
||||||
|
offset = datapoints_config[datapoint]['offset']
|
||||||
|
value = amplitude * math.sin((time.time() * frequency) + phase) + offset
|
||||||
|
if shutdown_active:
|
||||||
|
return max(0, value - (time.time() - shutdown_start_time) / 60)
|
||||||
|
else:
|
||||||
|
return value
|
||||||
|
"""
|
||||||
|
def generate_random_value(min_val, max_val):
|
||||||
|
return random.uniform(min_val, max_val)
|
||||||
|
"""
|
||||||
|
def generate_random_value(datapoint):
|
||||||
|
min_val = datapoints_config[datapoint]['min']
|
||||||
|
max_val = datapoints_config[datapoint]['max']
|
||||||
|
value = random.uniform(min_val, max_val)
|
||||||
|
if shutdown_active:
|
||||||
|
return max(0, value - (time.time() - shutdown_start_time) / 60)
|
||||||
|
else:
|
||||||
|
return value
|
||||||
|
def constant_value(datapoint):
|
||||||
|
return datapoints_config[datapoint]["value"]
|
||||||
|
def get_shutdown_state():
|
||||||
|
global shutdown_active
|
||||||
|
global shutdown_start_time
|
||||||
|
if shutdown_active:
|
||||||
|
if time.time() - shutdown_start_time > SHUTDOWN_DURATION:
|
||||||
|
shutdown_active = False
|
||||||
|
else:
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
if random.random() < 0.01: # 1% chance of entering shutdown state
|
||||||
|
shutdown_active = True
|
||||||
|
shutdown_start_time = time.time()
|
||||||
|
return False
|
||||||
|
"""def get_datapoint_value(key, value_type):
|
||||||
|
global shutdown_active
|
||||||
|
if shutdown_active:
|
||||||
|
if key == "value1":
|
||||||
|
return max(0, value_type - (time.time() - shutdown_start_time) / 60)
|
||||||
|
elif key == "value2":
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return 0
|
||||||
|
else:
|
||||||
|
if key == "value1":
|
||||||
|
return generate_sine_wave_value(time.time(), SINE_WAVE_PERIOD)
|
||||||
|
elif key == "value2":
|
||||||
|
return generate_random_value(0, 1) > 0.5
|
||||||
|
else:
|
||||||
|
return generate_random_value(RANDOM_MIN, RANDOM_MAX)
|
||||||
|
"""
|
||||||
|
# Helper function to split the payload into chunks
|
||||||
|
def chunk_payload(payload, chunk_size=20):
|
||||||
|
chunked_values = list(payload["values"].items())
|
||||||
|
for i in range(0, len(chunked_values), chunk_size):
|
||||||
|
yield {
|
||||||
|
"ts": payload["ts"],
|
||||||
|
"values": dict(chunked_values[i:i+chunk_size])
|
||||||
|
}
|
||||||
|
while True:
|
||||||
|
now = int(time.time())
|
||||||
|
if now % 600 == 0:
|
||||||
|
ts = now * 1000
|
||||||
|
get_shutdown_state()
|
||||||
|
"""
|
||||||
|
values = {
|
||||||
|
"value1": get_datapoint_value("value1", generate_sine_wave_value),
|
||||||
|
"value2": get_datapoint_value("value2", generate_random_value),
|
||||||
|
"value3": get_datapoint_value("value3", generate_random_value)
|
||||||
|
}"""
|
||||||
|
values = {}
|
||||||
|
for datapoint in datapoints_config:
|
||||||
|
if datapoints_config[datapoint]['type'] == 'sine_wave':
|
||||||
|
values[datapoint] = generate_sine_wave_value(datapoint)
|
||||||
|
elif datapoints_config[datapoint]['type'] == 'random':
|
||||||
|
values[datapoint] = generate_random_value(datapoint)
|
||||||
|
elif datapoints_config[datapoint]['type'] == 'constant':
|
||||||
|
values[datapoint] = constant_value(datapoint)
|
||||||
|
payload = {"ts": ts, "values": values}
|
||||||
|
# Reconnect to broker if disconnected
|
||||||
|
reconnect_to_broker()
|
||||||
|
try:
|
||||||
|
for chunk in chunk_payload(payload=payload):
|
||||||
|
client.publish(MQTT_TOPIC, json.dumps(chunk))
|
||||||
|
time.sleep(2)
|
||||||
|
print(f"Published data at {ts}: {payload}")
|
||||||
|
except Exception as e:
|
||||||
|
print(f"ERROR in Publish: {e}")
|
||||||
|
time.sleep(1)
|
||||||
Reference in New Issue
Block a user