|
Post by msimmering on Dec 21, 2023 19:12:30 GMT
Hello,
What is the intended relation between the State property of a sensor and its current reading values? Currently in OpenBMC the State of a sensor is only tied to its presence. So if it's present the State will be "Enabled" otherwise it's "Absent". However if someone turns off the power to a given sensor it'll have null readings, but the State will still be "Enabled". Is the intent of the state property to help reflect the current state of the sensor? If so, would a value of "StandbyOffline" or "UnavailableOffline" be more appropriate?
Thanks.
|
|
|
Post by mraineri on Dec 27, 2023 1:25:15 GMT
First, it's worth pointing out the "Absent" case is expected to have special handling. In the "Special resource situations" clause of the Redfish spec, there is documentation specifically for "absent resources". In this case, since the sensor is not present, I would expect Reading to be omitted from the response entirely (and not use a null value). Null is typically used to let the client know that the value is currently unavailable, and they should check back later. However, when a device is absent, there is no "later" case where the value will become available (unless someone inserts the device).
For other states, there's no concrete rule for tying the state to show a null reading. I would think it's pretty common that the "unavailable" states would return null. However, I can see situations where "Enabled" could also return null; perhaps there's a single I2C transaction that failed, and the service wants to show it's still actively polling the sensor (State is Enabled), but the last polling cycle failed (Reading is null). I would recommend trying to think about "State" and "Reading" as potentially two independent things (but they could have some strong ties between each other depending on the service's design). So, yes, State would reflect the current state of the sensor. Both of those "offline" states would be more accurate, but I would also potentially consider "Disabled" for the "device is powered off" case; "Absent" certainly does not sound correct since that would convey the sensor is physically removed from the system.
|
|