xref: /openbmc/dbus-sensors/README.md (revision 1d7b4788943d5450e2c72965bb972369ae908b2c)
1# dbus-sensors
2
3dbus-sensors is a collection of sensor applications that provide the
4xyz.openbmc_project.Sensor collection of interfaces. They read sensor values
5from hwmon, d-bus, or direct driver access to provide readings. Some advance
6non-sensor features such as fan presence, pwm control, and automatic cpu
7detection (x86) are also supported.
8
9## key features
10
11- runtime re-configurable from d-bus (entity-manager or the like)
12
13- isolated: each sensor type is isolated into its own daemon, so a bug in one
14  sensor is unlikely to affect another, and single sensor modifications are
15  possible
16
17- async single-threaded: uses sdbusplus/asio bindings
18
19- multiple data inputs: hwmon, d-bus, direct driver access
20
21## dbus interfaces
22
23A typical dbus-sensors object support the following dbus interfaces:
24
25```
26Path        /xyz/openbmc_project/sensors/<type>/<sensor_name>
27
28Interfaces  xyz.openbmc_project.Sensor.Value
29            xyz.openbmc_project.Sensor.Threshold.Critical
30            xyz.openbmc_project.Sensor.Threshold.Warning
31            xyz.openbmc_project.State.Decorator.Availability
32            xyz.openbmc_project.State.Decorator.OperationalStatus
33            xyz.openbmc_project.Association.Definitions
34
35```
36
37Sensor interfaces collection are described
38[here](https://github.com/openbmc/phosphor-dbus-interfaces/tree/master/yaml/xyz/openbmc_project/Sensor).
39
40Consumer examples of these interfaces are
41[Redfish](https://github.com/openbmc/bmcweb/blob/master/redfish-core/lib/sensors.hpp),
42[Phosphor-Pid-Control](https://github.com/openbmc/phosphor-pid-control),
43[IPMI SDR](https://github.com/openbmc/phosphor-host-ipmid/blob/master/dbus-sdr/sensorcommands.cpp).
44
45## Reactor
46
47dbus-sensor daemons are [reactors](https://github.com/openbmc/entity-manager)
48that dynamically create and update sensors configuration when system
49configuration gets updated.
50
51Using asio timers and async calls, dbus-sensor daemons read sensor values and
52check thresholds periodically. PropertiesChanged signals will be broadcasted for
53other services to consume when value or threshold status change. OperationStatus
54is set to false if the sensor is determined to be faulty.
55
56A simple sensor example can be found
57[here](https://github.com/openbmc/entity-manager/blob/master/docs/my_first_sensors.md).
58
59## configuration
60
61Sensor devices are described using Exposes records in configuration file. Name
62and Type fields are required. Different sensor types have different fields.
63Refer to entity manager
64[schema](https://github.com/openbmc/entity-manager/blob/master/schemas/legacy.json)
65for complete list.
66
67## sensor documentation
68
69- [ExternalSensor](https://github.com/openbmc/docs/blob/master/designs/external-sensor.md)
70  virtual sensor
71