Set sensor initial value.
Set the initial value of the value property in the
Sensor.Value interface.
Change-Id: I1324d3172d1f69cf90f59a065327ab8f739243ed
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/mainloop.cpp b/mainloop.cpp
index 3ba365c..a6758d4 100644
--- a/mainloop.cpp
+++ b/mainloop.cpp
@@ -74,6 +74,15 @@
continue;
}
+ // Get the initial value for the value interface.
+ auto sysfsPath = make_sysfs_path(
+ _path,
+ i.first.first,
+ i.first.second,
+ hwmon::entry::input);
+ int val = 0;
+ read_sysfs(sysfsPath, val);
+
Object o;
std::string objectPath{_root};
@@ -83,6 +92,7 @@
objectPath.append(label);
auto iface = std::make_shared<ValueObject>(_bus, objectPath.c_str());
+ iface->value(val);
o.emplace(InterfaceType::VALUE, iface);
auto value = std::make_tuple(