From c6b58f40e669e112f3472198b0fe1c7bd22c291d Mon Sep 17 00:00:00 2001 From: randhid <35934754+randhid@users.noreply.github.com> Date: Tue, 11 Jul 2023 12:33:58 -0400 Subject: [PATCH] Add name to merged movement sensor in creator (#2625) --- components/movementsensor/merged/merged.go | 1 + components/movementsensor/merged/merged_test.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/components/movementsensor/merged/merged.go b/components/movementsensor/merged/merged.go index bed2be92253..71d94d070b8 100644 --- a/components/movementsensor/merged/merged.go +++ b/components/movementsensor/merged/merged.go @@ -71,6 +71,7 @@ func newMergedModel(ctx context.Context, deps resource.Dependencies, conf resour ) { m := merged{ logger: logger, + Named: conf.ResourceName().AsNamed(), } if err := m.Reconfigure(ctx, deps, conf); err != nil { diff --git a/components/movementsensor/merged/merged_test.go b/components/movementsensor/merged/merged_test.go index b46a6c727ee..0cea9f9590c 100644 --- a/components/movementsensor/merged/merged_test.go +++ b/components/movementsensor/merged/merged_test.go @@ -275,6 +275,9 @@ func TestCreation(t *testing.T) { err = ms.Reconfigure(ctx, deps, conf) test.That(t, err, test.ShouldBeNil) + res := ms.Name() + test.That(t, res, test.ShouldNotBeNil) + pos, alt, err = ms.Position(ctx, nil) test.That(t, err, test.ShouldBeNil) test.That(t, pos, test.ShouldEqual, testgeopoint)