adding AUTH_TOKEN into .env

This commit is contained in:
2026-05-05 14:37:42 +02:00
parent 5212d4cbd5
commit 33678fb90b
6 changed files with 29 additions and 16 deletions
+3
View File
@@ -0,0 +1,3 @@
export DEVICE_NAME="ePowerSwitch"
export EPOWERSWITCH_SOCKET_NUMBER=8
export AUTH_TOKEN=$(echo $(USERNAME):$(PASSWORD) | base64)
+9 -1
View File
@@ -1,7 +1,10 @@
get4 {
InTerminator="\n";
OutTerminator="\r\n";
out "GET /hidden.htm";
out "Authorization: Basic \$1";
out "";
in "Hidden Page";
in "%*d%*s%*d %*d:%*d:%*d";
in "Version: %*u.%*u.%*u.%*u";
@@ -14,7 +17,10 @@ get4 {
get8 {
InTerminator="\n";
OutTerminator="\r\n";
out "GET /hidden.htm";
out "Authorization: Basic \$1";
out "";
in "Hidden Page";
in "%*d%*s%*d %*d:%*d:%*d";
in "Version: %*u.%*u.%*u.%*u";
@@ -31,6 +37,8 @@ get8 {
set {
OutTerminator = "\r\n";
out "POST /hidden.htm/M0:O\$1=%s";
out "POST /hidden.htm/M0:O\$2=%s";
out "Authorization: Basic \$1";
out "";
disconnect;
}
+1 -1
View File
@@ -6,7 +6,7 @@ record(scalcout, "$(DEVICE_NAME)_outlet_getter") {
field(DTYP, "stream")
field(SCAN, "1 second")
field(CALC, "0")
field(OUT, "@$(DB)command.proto get$(OUTLET_NUMBER)() $(PORT)")
field(OUT, "@$(DB)command.proto get$(OUTLET_NUMBER)($(AUTH_TOKEN)) $(PORT)")
field(FLNK, "$(DEVICE_NAME)_get_outlet_0")
}
+1 -1
View File
@@ -1,7 +1,7 @@
record(stringout, "$(DEVICE_NAME)_set_$(PARAMETER_NAME)_$(PARAMETER_ID)") {
field(DTYP, "stream")
field(PINI, "NO")
field(OUT, "@$(DB)command.proto set($(PARAMETER_ID)) $(PORT)")
field(OUT, "@$(DB)command.proto set($(AUTH_TOKEN), $(PARAMETER_ID)) $(PORT)")
}
record(stringin, "$(DEVICE_NAME)_get_$(PARAMETER_NAME)_$(PARAMETER_ID)") {
+11
View File
@@ -0,0 +1,11 @@
require ePowerSwitch,ponsin_h
epicsEnvSet("ASYN_PORT", "myDriverPort")
epicsEnvSet("DB", "$(ePowerSwitch_DB)")
# I use HTTP to use TCP and disconnect after, but no disconnection is done, so I disconnect manually.
drvAsynIPPortConfigure("$(ASYN_PORT)","127.0.0.1:55555 http", 0, 0, 0)
dbLoadTemplate("$(DB)template$(EPOWERSWITCH_SOCKET_NUMBER).substitutions", "PORT=$(ASYN_PORT), DEVICE_NAME=$(DEVICE_NAME), DB=$(DB), AUTH_TOKEN=$(AUTH_TOKEN)")
iocInit()
+4 -13
View File
@@ -1,15 +1,6 @@
#!/bin/bash
source .env #see .env_exemple
echo $DEVICE_NAME
echo "Starting ePowerSwitch drivers"
iocsh st.cmd
if [ $1 -eq 4 -o $1 -eq 8 ]
then
source .env
export DEVICE_NAME="ePowerSwitch"
export EPOWERSWITCH_SOCKET_NUMBER=$1
export
echo "Starting ePowerSwitch drivers with $1 outlets"
iocsh st.cmd
else
echo "invalid argument"
echo "$0 4 for 4 outlets"
echo "$0 8 for 8 outlets"
fi