@@ -715,7 +715,7 @@ describe('HaDiscovery', () => {
715715 expect ( payload . device . name ) . toBe ( 'Pond Pump' ) ;
716716 } ) ;
717717
718- it ( 'should inject object_id when entity_ids has an entry' , ( ) => {
718+ it ( 'should inject default_entity_id with domain prefix when entity_ids has an entry' , ( ) => {
719719 const labelData = {
720720 labels : new Map ( [ [ '254/56/10' , 'Kitchen' ] ] ) ,
721721 typeOverrides : new Map ( ) ,
@@ -730,10 +730,11 @@ describe('HaDiscovery', () => {
730730 ) ;
731731 expect ( call ) . toBeDefined ( ) ;
732732 const payload = JSON . parse ( call [ 1 ] ) ;
733- expect ( payload . object_id ) . toBe ( 'kitchen_light' ) ;
733+ expect ( payload . default_entity_id ) . toBe ( 'light.kitchen_light' ) ;
734+ expect ( payload . object_id ) . toBeUndefined ( ) ;
734735 } ) ;
735736
736- it ( 'should not include object_id when no entity_id is configured' , ( ) => {
737+ it ( 'should not include default_entity_id when no entity_id is configured' , ( ) => {
737738 const labelData = {
738739 labels : new Map ( ) ,
739740 typeOverrides : new Map ( ) ,
@@ -748,10 +749,10 @@ describe('HaDiscovery', () => {
748749 ) ;
749750 expect ( call ) . toBeDefined ( ) ;
750751 const payload = JSON . parse ( call [ 1 ] ) ;
751- expect ( payload . object_id ) . toBeUndefined ( ) ;
752+ expect ( payload . default_entity_id ) . toBeUndefined ( ) ;
752753 } ) ;
753754
754- it ( 'should inject object_id on type-overridden cover entities' , ( ) => {
755+ it ( 'should inject default_entity_id with domain prefix on type-overridden cover entities' , ( ) => {
755756 const labelData = {
756757 labels : new Map ( [ [ '254/56/10' , 'Main Blind' ] ] ) ,
757758 typeOverrides : new Map ( [ [ '254/56/10' , 'cover' ] ] ) ,
@@ -766,7 +767,8 @@ describe('HaDiscovery', () => {
766767 ) ;
767768 expect ( coverCall ) . toBeDefined ( ) ;
768769 const payload = JSON . parse ( coverCall [ 1 ] ) ;
769- expect ( payload . object_id ) . toBe ( 'main_blind' ) ;
770+ expect ( payload . default_entity_id ) . toBe ( 'cover.main_blind' ) ;
771+ expect ( payload . object_id ) . toBeUndefined ( ) ;
770772 expect ( payload . name ) . toBeNull ( ) ;
771773 expect ( payload . device . name ) . toBe ( 'Main Blind' ) ;
772774 } ) ;
@@ -816,7 +818,7 @@ describe('HaDiscovery', () => {
816818 const payload = JSON . parse ( extraCall [ 1 ] ) ;
817819 expect ( payload . name ) . toBeNull ( ) ;
818820 expect ( payload . device . name ) . toBe ( 'Extra Group Not In Tree' ) ;
819- expect ( payload . object_id ) . toBe ( 'extra_group' ) ;
821+ expect ( payload . default_entity_id ) . toBe ( 'light. extra_group' ) ;
820822
821823 const anotherCall = mockPublishFn . mock . calls . find (
822824 c => c [ 0 ] === 'testhomeassistant/light/cgateweb_254_56_201/config'
@@ -876,7 +878,7 @@ describe('HaDiscovery', () => {
876878 const payload = JSON . parse ( coverCall [ 1 ] ) ;
877879 expect ( payload . name ) . toBeNull ( ) ;
878880 expect ( payload . device . name ) . toBe ( 'Extra Blind' ) ;
879- expect ( payload . object_id ) . toBe ( 'extra_blind' ) ;
881+ expect ( payload . default_entity_id ) . toBe ( 'cover. extra_blind' ) ;
880882 } ) ;
881883 } ) ;
882884
@@ -1373,7 +1375,7 @@ describe('HaDiscovery', () => {
13731375 expect ( payload . device . name ) . toBe ( 'Movie Mode' ) ;
13741376 } ) ;
13751377
1376- it ( 'should apply entity_id suffix to scene object_id when entity ID is configured' , ( ) => {
1378+ it ( 'should apply entity_id suffix to scene default_entity_id when entity ID is configured' , ( ) => {
13771379 haDiscovery . updateLabels ( {
13781380 labels : new Map ( ) ,
13791381 typeOverrides : new Map ( ) ,
@@ -1388,7 +1390,8 @@ describe('HaDiscovery', () => {
13881390 ) ;
13891391 expect ( sceneCall ) . toBeDefined ( ) ;
13901392 const payload = JSON . parse ( sceneCall [ 1 ] ) ;
1391- expect ( payload . object_id ) . toBe ( 'entry_scene_scene' ) ;
1393+ expect ( payload . default_entity_id ) . toBe ( 'scene.entry_scene_scene' ) ;
1394+ expect ( payload . object_id ) . toBeUndefined ( ) ;
13921395 } ) ;
13931396 } ) ;
13941397} ) ;
0 commit comments