LORD-MicroStrain / MSCL

MicroStrain Communication Library
https://www.microstrain.com/software/mscl
MIT License
78 stars 57 forks source link

WSDA-2000 Internal Temperature #203

Closed christophjurczyk closed 2 years ago

christophjurczyk commented 2 years ago

Hi,

Is there any way to get the internal temperature of the WSDA-2000 gateway via MSCL?

Thanks in advance!

msclissa commented 2 years ago

Yes, the WSDA-2000 reports its internal temperature as part of the diagnostics packet. To identify the internal temperature value when reading in data with BaseStation::getData() check the following:

Hope this helps!

christophjurczyk commented 2 years ago

Hi @mglord, Thanks for the answer. I am not yet successful. Just to be sure...I would like to read the internal temperature of the WSDA-2000 which I can see in the WSDA Control Panel. Not the internal temperature of a node.

My code:

import sys
sys.path.append('/usr/share/python3-mscl/')
import mscl

base_address = "192.168.0.20"
base_port = 5000

connection = mscl.Connection.TcpIp(base_address, base_port)

baseStation = mscl.BaseStation(connection)

print("Connected to base station!")

while True:
    sweeps = baseStation.getData(500)

    for sweep in sweeps:
        if sweep.samplingType() == mscl.DataSweep.samplingType_Diagnostic:
            print("Packet Received")
            print("Node", sweep.nodeAddress())
            print("Timestamp", sweep.timestamp())
            print("DATA:")

            for dataPoint in sweep.data():
                if dataPoint.channelId() == mscl.WirelessChannel.channel_diag_internalTemp:
                    print(dataPoint.channelName(), ":", dataPoint.as_string())
                # end if
            # end for
        # end if
    # end for
# end while

Output:

Connected to base station!
Packet Received
Node 38099
Timestamp 2022-01-14 22:33:48.852368156
DATA:
diagnostic_internalTemp : 23.280001
Packet Received
Node 38099
Timestamp 2022-01-14 22:34:18.852170424
DATA:
diagnostic_internalTemp : 23.480000

Node address 38099 is one of my nodes. No other address is coming up.

What is the misunderstanding on my side?

msclissa commented 2 years ago

Apologies, my mistake! Looking into this now.

msclissa commented 2 years ago

Unfortunately there is not currently a way to read the WSDA diagnostic information, including internal temp, directly from the device. The WSDA-2000 does send this information directly to SensorCloud when it is connected - if you wanted you could use the SensorCloud API to read the latest value from the device's internalTemperature channel. More information on the SensorCloud API can be found here: SensorCloud API

Sorry for the inconvenience! If you decide to read from SensorCloud and run into any issues let us know!

christophjurczyk commented 2 years ago

No problem. Thanks for the information. Unfortunately, I have to use the WSDA without any cloud connection. I am using a web scraper Python library to read the internal temperature from the Control Panel. Works very reliable.