mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
obuspa: Remove dependency of mosquitto_pub in init
This commit is contained in:
parent
f87742703b
commit
78c895f23a
2 changed files with 1 additions and 25 deletions
|
|
@ -5,7 +5,7 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=obuspa
|
PKG_NAME:=obuspa
|
||||||
PKG_VERSION:=4.0.0.9
|
PKG_VERSION:=4.0.0.10
|
||||||
|
|
||||||
LOCAL_DEV:=0
|
LOCAL_DEV:=0
|
||||||
ifneq ($(LOCAL_DEV),1)
|
ifneq ($(LOCAL_DEV),1)
|
||||||
|
|
|
||||||
|
|
@ -648,31 +648,7 @@ remove_db() {
|
||||||
}
|
}
|
||||||
|
|
||||||
service_running() {
|
service_running() {
|
||||||
local AgentEndpointID serial oui user pass
|
|
||||||
local opt=""
|
|
||||||
|
|
||||||
ubus -t 10 wait_for usp.raw
|
ubus -t 10 wait_for usp.raw
|
||||||
config_load obuspa
|
|
||||||
config_get AgentEndpointID localagent EndpointID ""
|
|
||||||
if [ -z "${AgentEndpointID}" ]; then
|
|
||||||
serial=$(ubus -t 1 call usp.raw get '{"path":"Device.DeviceInfo.SerialNumber"}'|jsonfilter -e '@["parameters"][0].value')
|
|
||||||
oui=$(ubus -t 1 call usp.raw get '{"path":"Device.DeviceInfo.ManufacturerOUI"}'|jsonfilter -e '@["parameters"][0].value')
|
|
||||||
AgentEndpointID="os::${oui}-${serial}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
config_get user localmqtt Username
|
|
||||||
if [ -n "${user}" ]; then
|
|
||||||
opt="-u ${user}"
|
|
||||||
fi
|
|
||||||
config_get pass localmqtt Password
|
|
||||||
if [ -n "${pass}" ]; then
|
|
||||||
opt="${opt} -P ${pass}"
|
|
||||||
fi
|
|
||||||
# publish Agent's EndpointID in mosquito broker for discovery
|
|
||||||
# This is a work around till obuspa does not support advertising
|
|
||||||
log "Publishing EndpointID ${AgentEndpointID} to local mqtt broker"
|
|
||||||
mosquitto_pub -r -t "obuspa/EndpointID" -m "${AgentEndpointID}" ${opt}
|
|
||||||
|
|
||||||
procd_running ${CONFIGURATION}
|
procd_running ${CONFIGURATION}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue