thanks already for your script implementation.
Where do you run this bash script ?
On Home Assistant itself or another Linux PC/Pi ?
I can run the script for ex. under my /config/shell/ folder where I put the .sh file. (triggered by a HA script)
mosquitto_pub can be run from HA shell.
But where do you put the binaries then of plctool ?
- How do I ciompile these to binary from source on the HA host ? (I currently only have windows EXE binaries op openplc tools)
- Where to put these on the HA host.?
I run HA (OS) on a ESXi host.
If I type which mosquitto_pub then it says /usr/bin/mosquitto_pub
But I think /usr/bin is readonly and overwritten each time HA is updated.
I can put it in the /config/ branch which is custom and won’t be overwritten.
Or do we have to make a seperate docker to store these open-plc-utils ?
edit: I’ve found a solution already myself.
I’ve found windows and Linux 64bit binary files on: https://docs.insys-icom.de/pages/en_pl_config_slac.html
this contains “plctool”
I copied the Linux 64 bit binaries to a directory on my HA confg : /config/shell/
I mades these files executable with chmod 755
if I go into HA shell and now try:
shell: ./plctool -I -i enp2s1 18:A6:F7:57:B6:AA
PIB 0-0 21384 bytes
MAC 18:A6:F7:57:B6:AA
DAK CA:DF:8D:C3:76:AA:97:5C:4C:18:92:D7:96:E6:04:D4
NMK 4A:68:F8:36:92:AC:36:75:AC:C9:43:EF:CE:73:91:27
NID 71:2F:7B:69:26:4A:07
Security level 0
NET Qualcomm Atheros Enabled Network
MFG Qualcomm Atheros HomePlug AV Device
USR tpver_801191_180709_915
CCo Auto
MDU N/A
using the -m parameter I can show the network info viewed from the specifiek source MAC adress/PLC.
for ex/
shell: ./plctool -m -i enp2s1 18:A6:F7:57:B6:AA
enp2s1 18:A6:F7:57:B6:AA Fetch Network Information
enp2s1 18:A6:F7:57:B6:AA Found 1 Network(s)
source address = 18:A6:F7:57:B6:AA
network->NID = 71:2F:7B:69:26:4A:07
network->SNID = 1
network->TEI = 1
network->ROLE = 0x00 (STA)
network->CCO_DA = 18:A6:F7:A2:3D:74
network->CCO_TEI = 6
network->STATIONS = 2
station->MAC = 18:A6:F7:A2:3D:74
station->TEI = 6
station->BDA = 24:A1:60:37:86:58
station->AvgPHYDR_TX = 056 mbps Primary
station->AvgPHYDR_RX = 020 mbps Primary
station->MAC = 84:16:F9:F3:BF:28
station->TEI = 13
station->BDA = 7C:64:56:F7:BC:A9
station->AvgPHYDR_TX = 216 mbps Alternate
station->AvgPHYDR_RX = 296 mbps Alternate
here is also TX and RX visible
So now I can adapt your bash script for use with “plctool” instead of “plcstat_output” since the last one is not contained in the download package above.
thx again for your script, this will help me a lot for the bash script to process all regexped info and publish it with mqtt