fermi-ad / parameter_page_app

Web application implementing the Parameter Page.
MIT License
2 stars 1 forks source link

Implement monitorDigitalStatusDevices(..) on GraphQLDPMService #146

Closed cnlklink closed 7 months ago

cnlklink commented 12 months ago

Right now monitorDigitalStatusDevices(..) just returns an empty stream - no live data. See the monitorDigitalStatusDevices(..) on MockDPMService for a reference implementation. This might not be trivial because the structure of the digital status information includes the basic status characters and their colors.

rneswold commented 12 months ago

We should be able to get the raw status streamed back to us using a DRF request. Although there would be some work in decoding the bits (the app would have to use the extended text to understand the bits.)

beauremus commented 12 months ago

Is this motivation to update the way DPM responds to this request? I imagine that updates to this would benefit other users as well.

cnlklink commented 12 months ago

I'm not sure what DPM makes available to you when you query status. If I read the status property of a device with ACL, for example, I get back the four basic status characters (or if I read it raw, then I get back bits):

ACL> read G|AMANDA

G|AMANDA = .TLT

ACL> read G|AMANDA.raw

G|AMANDA = 0003

The interface I defined for DPMService returns a stream of DigitalStatus which holds these characters and their colors. It would be ideal if all of this information was being provided by the DPM API.

cnlklink commented 12 months ago

Sorry, hit close with comment by mistake!

beauremus commented 12 months ago

Using acsys-python this is what I get for the request G:AMANDA.STATUS

{
    "tag": 0,
    "stamp": "2023-09-15 18:20:54.132000+00:00",
    "data": {
        "ref_id": 0,
        "timestamp": 1694802054132,
        "cycle": 1694802054081,
        "on": true,
        "ready": true,
        "remote": false,
        "positive": true
    },
    "meta": {
        "di": 253488,
        "name": "G:AMANDA",
        "desc": "Amanda catchall alarm!",
        "units": "None",
        "format_hint": "None"
    }
}

And for the request G:AMANDA.STATUS.RAW

{
    "tag": 0,
    "stamp": "2023-09-15 18:21:01.133000+00:00",
    "data": "\\x0b\\x00",
    "meta": {
        "di": 253488,
        "name": "G:AMANDA",
        "desc": "Amanda catchall alarm!",
        "units": "None",
        "format_hint": "None"
    }
}

And for the request G:AMANDA.STATUS.EXTENDED_TEXT

{
    "tag": 0,
    "stamp": "2023-09-15 18:27:52.098000+00:00",
    "data": [
        "Henk On/Off",
        "On",
        "Ready???",
        "Always",
        "Remote Henk",
        "L",
        "Polarity",
        "Bi",
        "test 2",
        "good",
        "testtest",
        "GOOD"
    ],
    "meta": {
        "di": 253488,
        "name": "G:AMANDA",
        "desc": "Amanda catchall alarm!",
        "units": "None",
        "format_hint": "None"
    }
}

And for the request G:AMANDA.STATUS.TEXT

{
    "tag": 0,
    "stamp": "2023-09-15 18:32:10.121000+00:00",
    "data": "...*",
    "meta": {
        "di": 253488,
        "name": "G:AMANDA",
        "desc": "Amanda catchall alarm!",
        "units": "None",
        "format_hint": "None"
    }
}

It looks like DPM doesn't need an update. I think all of this works for our needs.

rneswold commented 11 months ago

It's true that DPM currently returns the BASIC STATUS in various, correct ways: as power supply status; as extended strings, etc. But John was asking for an interface that takes DPM's information and maps it to the character/color pairs that the old parameter page used.

The downside it that the database only has this info for four status bits. Devices with more complicated status won't get all their values displayed until you go to the "details" view.

cnlklink commented 7 months ago

Confirmed that this is working now!