Update Associations For bmcweb changes

Updating according to
https://gerrit.openbmc-project.xyz/c/openbmc/docs/+/22976

Tested: Thermal had all fans, and presence worked.

Change-Id: I03e1e13b3a9c2f6d2ac4b7afc6e2723c04597931
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/include/TachSensor.hpp b/include/TachSensor.hpp
index 4588653..f79fb4d 100644
--- a/include/TachSensor.hpp
+++ b/include/TachSensor.hpp
@@ -73,6 +73,7 @@
     std::optional<RedundancySensor>* redundancy;
     std::unique_ptr<PresenceSensor> presence;
     std::shared_ptr<sdbusplus::asio::dbus_interface> itemIface;
+    std::shared_ptr<sdbusplus::asio::dbus_interface> itemAssoc;
     boost::asio::posix::stream_descriptor inputDev;
     boost::asio::deadline_timer waitTimer;
     boost::asio::streambuf readBuf;
diff --git a/include/Utils.hpp b/include/Utils.hpp
index 4f595c9..85b0665 100644
--- a/include/Utils.hpp
+++ b/include/Utils.hpp
@@ -37,6 +37,8 @@
     std::pair<std::string,
               boost::container::flat_map<std::string, BasicVariantType>>;
 
+using Association = std::tuple<std::string, std::string, std::string>;
+
 bool findFiles(const std::filesystem::path dirPath,
                const std::string& matchString,
                std::vector<std::filesystem::path>& foundPaths,
diff --git a/src/TachSensor.cpp b/src/TachSensor.cpp
index aeef7c5..45ac7ac 100644
--- a/src/TachSensor.cpp
+++ b/src/TachSensor.cpp
@@ -71,12 +71,21 @@
     if (presence)
     {
         itemIface =
-            objectServer.add_interface("/xyz/openbmc_project/Inventory/" + name,
+            objectServer.add_interface("/xyz/openbmc_project/inventory/" + name,
                                        "xyz.openbmc_project.Inventory.Item");
         itemIface->register_property("PrettyName",
                                      std::string()); // unused property
         itemIface->register_property("Present", true);
         itemIface->initialize();
+        itemAssoc =
+            objectServer.add_interface("/xyz/openbmc_project/inventory/" + name,
+                                       "org.openbmc.Associations");
+        itemAssoc->register_property(
+            "associations",
+            std::vector<Association>{
+                {"sensors", "inventory",
+                 "/xyz/openbmc_project/sensors/fan_tach/" + name}});
+        itemAssoc->initialize();
     }
     setInitialProperties(conn);
     setupPowerMatch(conn);
@@ -93,6 +102,7 @@
     objServer.remove_interface(sensorInterface);
     objServer.remove_interface(association);
     objServer.remove_interface(itemIface);
+    objServer.remove_interface(itemAssoc);
 }
 
 void TachSensor::setupRead(void)
diff --git a/src/Utils.cpp b/src/Utils.cpp
index e43d90e..fade0e6 100644
--- a/src/Utils.cpp
+++ b/src/Utils.cpp
@@ -230,10 +230,9 @@
     {
         std::filesystem::path p(path);
 
-        using Association = std::tuple<std::string, std::string, std::string>;
         std::vector<Association> associations;
         associations.push_back(
-            Association("inventory", "sensors", p.parent_path().string()));
+            Association("chassis", "all_sensors", p.parent_path().string()));
         association->register_property("associations", associations);
         association->initialize();
     }