Les regex et Jsonata

Bonjour la communauté.

Je toque à la porte de vos lumières car je me débats avec l’utilisation d’expressions régulières.

Voici ce que je tente de faire:
dans un node de récupération d’état d’entité, j’ai en propriété ce que j’ai trouvé grâce à vos partage à savoir

$contains(
   $entity().entity_id,
   "volets_"
)

j’obtient des valeurs du style:

« input_number.volets_niveau_bureau »,
« input_number.volets_niveau_sam »,
« input_number.volets_niveau_salon »,
« input_number.volets_niveau_cuisine »,
« input_number.volets_niveau_ch1 »,
« input_number.volets_niveau_ch2 »,
« input_number.volets_niveau_ch3 »,
« input_number.volets_auto_offset_ouvre_bureau »,
« input_number.volets_auto_offset_ferme_bureau »,
« input_number.volets_auto_offset_ouvre_sam »,
« input_number.volets_auto_offset_ferme_sam »,
« input_number.volets_auto_offset_ouvre_salon »,
« input_number.volets_auto_offset_ferme_salon »,
« input_number.volets_auto_offset_ouvre_cuisine »,
« input_number.volets_auto_offset_ferme_cuisine »,
« input_number.volets_auto_offset_ouvre_ch1 »,
« input_number.volets_auto_offset_ferme_ch1 »
« input_boolean.volets_auto_matin_etat_bureau »,
« input_boolean.volets_auto_soir_etat_bureau »,
« input_boolean.volets_auto_azimut_bureau »,
« input_boolean.volets_auto_matin_etat_sam »,
« input_boolean.volets_auto_soir_etat_sam »,
« input_boolean.volets_auto_azimut_sam »,
« input_boolean.volets_auto_matin_etat_salon »,
« input_boolean.volets_auto_soir_etat_salon »,
« input_boolean.volets_auto_azimut_salon »,
« input_boolean.volets_auto_matin_etat_cuisine »,

mais je souhaiterai avoir seulement les entités dont le nom contient volet et ce termine par le contenu d’un msg.id

j’ai tenté ça:

$contains(
   $entity().entity_id,
   "volets_" & msg.id
)

Mais j’ai carrément une erreur.

J’ai tenté plusieurs choses par la suite mais je dois avouer que les expressions régulières ont toujours été une bête noir pour moi :slight_smile: :smiley:

Je vous remercie une nouvelle fois pour vos lumières

La syntaxe est correcte si msg.id est une chaine de caractères.
Sinon, ça va coincer.
Quel genre de chose vas-tu avoir dans msg.id ?

J’injecte effectivement une chaine

image

je ne comprends pas pourquoi cela ne filtre pas. On dirait qu’il n’interprète pas la variable comme si elle n’était pas là

Il faudrait partager le flot. J’ai fait un test et cette syntaxe marche.

Voici le flow:

[{"id":"48f18c6642d210f2","type":"tab","label":"Flow 4","disabled":false,"info":"","env":[]},{"id":"80e7d7cc720c2f79","type":"inject","z":"48f18c6642d210f2","name":"","props":[{"p":"id","v":"bureau","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":110,"y":140,"wires":[["4123d243ce740946"]]},{"id":"4123d243ce740946","type":"ha-get-entities","z":"48f18c6642d210f2","name":"Liste entitées","server":"8ba7aec4.1022e","version":0,"rules":[{"property":"entity_id","logic":"jsonata","value":"$contains(\t   $entity().entity_id,\t   \"volets_\" & id\t)\t","valueType":"jsonata"}],"output_type":"array","output_empty_results":false,"output_location_type":"msg","output_location":"payload","output_results_count":1,"x":310,"y":140,"wires":[["b2b8d25afc7b7655"]]},{"id":"b2b8d25afc7b7655","type":"debug","z":"48f18c6642d210f2","name":"debug 125","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":590,"y":140,"wires":[]},{"id":"8ba7aec4.1022e","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]

lors de l’injection le nœud affiche: No Result

si je change par:

$contains(
   $entity().entity_id,
   "volets_"
)

j’obtiens les valeurs suivantes:

[{"entity_id":"input_number.volets_niveau_bureau","state":"100.0","attributes":{"initial":null,"editable":false,"min":0,"max":100,"step":1,"mode":"box","friendly_name":"volets_niveau_bureau"},"last_changed":"2023-09-02T04:30:18.303Z","last_updated":"2023-09-02T04:30:18.303Z","context":{"id":"01H9A2FW5YJ2Q7DN5GF189Z2J2","parent_id":null,"user_id":"35f00be49c604648bbb88667afdc8327"},"timeSinceChangedMs":8240852},{"entity_id":"input_number.volets_niveau_sam","state":"100.0","attributes":{"initial":null,"editable":false,"min":0,"max":100,"step":1,"mode":"slider","friendly_name":"volets_niveau_sam"},"context":{"id":"01H99PMQMVGC9JK41DQP1ZERZY","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.587Z","last_updated":"2023-09-02T01:03:14.587Z","timeSinceChangedMs":20664569},{"entity_id":"input_number.volets_niveau_salon","state":"100.0","attributes":{"initial":null,"editable":false,"min":0,"max":100,"step":1,"mode":"slider","friendly_name":"Pourcentage_salon"},"last_changed":"2023-09-02T04:30:18.619Z","last_updated":"2023-09-02T04:30:18.619Z","context":{"id":"01H9A2FWFSA4ZGQXVFXHQMMNTT","parent_id":null,"user_id":"35f00be49c604648bbb88667afdc8327"},"timeSinceChangedMs":8240539},{"entity_id":"input_number.volets_niveau_cuisine","state":"100.0","attributes":{"initial":null,"editable":false,"min":0,"max":100,"step":1,"mode":"slider","friendly_name":"Pourcentage_cuisine"},"last_changed":"2023-09-02T04:30:18.783Z","last_updated":"2023-09-02T04:30:18.783Z","context":{"id":"01H9A2FWMY2JFKNZHD14XNX6KX","parent_id":null,"user_id":"35f00be49c604648bbb88667afdc8327"},"timeSinceChangedMs":8240376},{"entity_id":"input_number.volets_niveau_ch1","state":"0.0","attributes":{"initial":null,"editable":false,"min":0,"max":100,"step":1,"mode":"slider","friendly_name":"Pourcentage_ch1"},"context":{"id":"01H99PMQMV19VH2CCE3CF7V55K","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.587Z","last_updated":"2023-09-02T01:03:14.587Z","timeSinceChangedMs":20664573},{"entity_id":"input_number.volets_niveau_ch2","state":"0.0","attributes":{"initial":null,"editable":false,"min":0,"max":100,"step":1,"mode":"slider","friendly_name":"Pourcentage_ch2"},"context":{"id":"01H99PMQMVPNX9HW2H8Y9ZDK4Z","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.587Z","last_updated":"2023-09-02T01:03:14.587Z","timeSinceChangedMs":20664574},{"entity_id":"input_number.volets_niveau_ch3","state":"0.0","attributes":{"initial":null,"editable":false,"min":0,"max":100,"step":1,"mode":"slider","friendly_name":"Pourcentage_ch3"},"context":{"id":"01H99PMQMWS5HFNA1VR1BF41VJ","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.588Z","last_updated":"2023-09-02T01:03:14.588Z","timeSinceChangedMs":20664574},{"entity_id":"input_number.volets_auto_offset_ouvre_bureau","state":"-49.0","attributes":{"initial":null,"editable":false,"min":-90,"max":90,"step":1,"mode":"slider","friendly_name":"Volets Offset bureau matin"},"context":{"id":"01H99PMQMW9AZ2HRQD5Y0592FB","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.588Z","last_updated":"2023-09-02T01:03:14.588Z","timeSinceChangedMs":20664575},{"entity_id":"input_number.volets_auto_offset_ferme_bureau","state":"25.0","attributes":{"initial":null,"editable":false,"min":-90,"max":90,"step":1,"mode":"slider","friendly_name":"Offset bureau soir"},"context":{"id":"01H99PMQMW0N92R47YEQE8N2A0","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.588Z","last_updated":"2023-09-02T01:03:14.588Z","timeSinceChangedMs":20664576},{"entity_id":"input_number.volets_auto_offset_ouvre_sam","state":"-47.0","attributes":{"initial":null,"editable":false,"min":-90,"max":90,"step":1,"mode":"slider","friendly_name":"Offset sam matin"},"context":{"id":"01H99PMQMWGWXGNE95K5HTBTK7","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.588Z","last_updated":"2023-09-02T01:03:14.588Z","timeSinceChangedMs":20664577},{"entity_id":"input_number.volets_auto_offset_ferme_sam","state":"45.0","attributes":{"initial":null,"editable":false,"min":-90,"max":90,"step":1,"mode":"slider","friendly_name":"Offset sam soir"},"context":{"id":"01H99PMQMXK2S0KYWREWCZNKNY","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.589Z","last_updated":"2023-09-02T01:03:14.589Z","timeSinceChangedMs":20664577},{"entity_id":"input_number.volets_auto_offset_ouvre_salon","state":"-49.0","attributes":{"initial":null,"editable":false,"min":-90,"max":90,"step":1,"mode":"slider","friendly_name":"Offset sam matin"},"context":{"id":"01H99PMQMX11Q7CJA3GCWQYEVG","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.589Z","last_updated":"2023-09-02T01:03:14.589Z","timeSinceChangedMs":20664582},{"entity_id":"input_number.volets_auto_offset_ferme_salon","state":"26.0","attributes":{"initial":null,"editable":false,"min":-90,"max":90,"step":1,"mode":"slider","friendly_name":"Offset sam soir"},"context":{"id":"01H99PMQMXEY56ASGXA8PCE2S1","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.589Z","last_updated":"2023-09-02T01:03:14.589Z","timeSinceChangedMs":20664583},{"entity_id":"input_number.volets_auto_offset_ouvre_cuisine","state":"-49.0","attributes":{"initial":null,"editable":false,"min":-90,"max":90,"step":1,"mode":"slider","friendly_name":"Offset sam matin"},"context":{"id":"01H99PMQMXCEKHS40Y6F32ARNP","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.589Z","last_updated":"2023-09-02T01:03:14.589Z","timeSinceChangedMs":20664584},{"entity_id":"input_number.volets_auto_offset_ferme_cuisine","state":"26.0","attributes":{"initial":null,"editable":false,"min":-90,"max":90,"step":1,"mode":"slider","friendly_name":"Offset sam soir"},"context":{"id":"01H99PMQMXA6N20A5A3GZ0WK57","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.589Z","last_updated":"2023-09-02T01:03:14.589Z","timeSinceChangedMs":20664585},{"entity_id":"input_number.volets_auto_offset_ouvre_ch1","state":"65.0","attributes":{"initial":null,"editable":false,"min":-90,"max":90,"step":1,"mode":"slider","friendly_name":"Offset sam matin"},"context":{"id":"01H99PMQMYJAW1SESXZRHG7YH7","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.590Z","last_updated":"2023-09-02T01:03:14.590Z","timeSinceChangedMs":20664585},{"entity_id":"input_number.volets_auto_offset_ferme_ch1","state":"30.0","attributes":{"initial":null,"editable":false,"min":-90,"max":90,"step":1,"mode":"slider","friendly_name":"Offset sam soir"},"context":{"id":"01H99PMQMYEWMFDVG5TKYEFD51","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.590Z","last_updated":"2023-09-02T01:03:14.590Z","timeSinceChangedMs":20664587},{"entity_id":"input_number.volets_auto_offset_ouvre_ch2","state":"60.0","attributes":{"initial":null,"editable":false,"min":-90,"max":90,"step":1,"mode":"slider","friendly_name":"Offset sam matin"},"context":{"id":"01H99PMQMY5R2W6CPTSCNXZNJX","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.590Z","last_updated":"2023-09-02T01:03:14.590Z","timeSinceChangedMs":20664588},{"entity_id":"input_number.volets_auto_offset_ferme_ch2","state":"30.0","attributes":{"initial":null,"editable":false,"min":-90,"max":90,"step":1,"mode":"slider","friendly_name":"Offset sam soir"},"context":{"id":"01H99PMQMZN1TZH3KEV6K0KB3R","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.591Z","last_updated":"2023-09-02T01:03:14.591Z","timeSinceChangedMs":20664588},{"entity_id":"input_number.volets_auto_offset_ouvre_ch3","state":"60.0","attributes":{"initial":null,"editable":false,"min":-90,"max":90,"step":1,"mode":"slider","friendly_name":"Offset sam matin"},"context":{"id":"01H99PMQMZXKQ1Z01XW493XMZY","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.591Z","last_updated":"2023-09-02T01:03:14.591Z","timeSinceChangedMs":20664589},{"entity_id":"input_number.volets_auto_offset_ferme_ch3","state":"30.0","attributes":{"initial":null,"editable":false,"min":-90,"max":90,"step":1,"mode":"slider","friendly_name":"Offset sam soir"},"context":{"id":"01H99PMQMZQETRSJW1FN47845V","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.591Z","last_updated":"2023-09-02T01:03:14.591Z","timeSinceChangedMs":20664590},{"entity_id":"input_boolean.volets_auto_matin_etat_bureau","state":"on","attributes":{"editable":false,"icon":"mdi:window-shutter","friendly_name":"volets_auto_matin_etat_bureau"},"context":{"id":"01H99PMQNAER1HG243KSQVZ2WQ","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.602Z","last_updated":"2023-09-02T01:03:14.602Z","timeSinceChangedMs":20664580},{"entity_id":"input_boolean.volets_auto_soir_etat_bureau","state":"on","attributes":{"editable":false,"icon":"mdi:window-shutter","friendly_name":"volets_auto_soir_etat_bureau"},"context":{"id":"01H99PMQNAES15MRGVA3KJWN9M","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.602Z","last_updated":"2023-09-02T01:03:14.602Z","timeSinceChangedMs":20664581},{"entity_id":"input_boolean.volets_auto_azimut_bureau","state":"on","attributes":{"editable":false,"icon":"mdi:window-shutter","friendly_name":"volets_auto_azimut_bureau"},"last_changed":"2023-09-02T04:30:18.315Z","last_updated":"2023-09-02T04:30:18.315Z","context":{"id":"01H9A2FW6AGJ04YHR26EFXEM6R","parent_id":null,"user_id":"35f00be49c604648bbb88667afdc8327"},"timeSinceChangedMs":8240869},{"entity_id":"input_boolean.volets_auto_matin_etat_sam","state":"on","attributes":{"editable":false,"icon":"mdi:window-shutter","friendly_name":"volets_auto_etat_sam"},"context":{"id":"01H99PMQNBQPAYKS23C44XJCGH","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.603Z","last_updated":"2023-09-02T01:03:14.603Z","timeSinceChangedMs":20664582},{"entity_id":"input_boolean.volets_auto_soir_etat_sam","state":"off","attributes":{"editable":false,"icon":"mdi:window-shutter","friendly_name":"volets_auto_soir_etat_sam"},"context":{"id":"01H99PMQNBT0575WRMQXQZC7CF","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.603Z","last_updated":"2023-09-02T01:03:14.603Z","timeSinceChangedMs":20664583},{"entity_id":"input_boolean.volets_auto_azimut_sam","state":"on","attributes":{"editable":false,"icon":"mdi:window-shutter","friendly_name":"volets_auto_azimut_sam"},"context":{"id":"01H99PMQNB23B983C9202SKYWC","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.603Z","last_updated":"2023-09-02T01:03:14.603Z","timeSinceChangedMs":20664584},{"entity_id":"input_boolean.volets_auto_matin_etat_salon","state":"on","attributes":{"editable":false,"icon":"mdi:window-shutter","friendly_name":"volets_auto_etat_salon"},"context":{"id":"01H99PMQNCT1FNGKQR8H087PYQ","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.604Z","last_updated":"2023-09-02T01:03:14.604Z","timeSinceChangedMs":20664584},{"entity_id":"input_boolean.volets_auto_soir_etat_salon","state":"on","attributes":{"editable":false,"icon":"mdi:window-shutter","friendly_name":"volets_auto_soir_etat_salon"},"context":{"id":"01H99PMQNCESTMMEBRAA8EAYAD","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.604Z","last_updated":"2023-09-02T01:03:14.604Z","timeSinceChangedMs":20664585},{"entity_id":"input_boolean.volets_auto_azimut_salon","state":"on","attributes":{"editable":false,"icon":"mdi:window-shutter","friendly_name":"volets_auto_azimut_salon"},"context":{"id":"01H99PMQNCD1MKFXJZTTKZ8CRX","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.604Z","last_updated":"2023-09-02T01:03:14.604Z","timeSinceChangedMs":20664592},{"entity_id":"input_boolean.volets_auto_matin_etat_cuisine","state":"on","attributes":{"editable":false,"icon":"mdi:window-shutter","friendly_name":"volets_auto_etat_cuisine"},"context":{"id":"01H99PMQNCYQYGEW4GJRSVXB9E","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.604Z","last_updated":"2023-09-02T01:03:14.604Z","timeSinceChangedMs":20664593},{"entity_id":"input_boolean.volets_auto_soir_etat_cuisine","state":"on","attributes":{"editable":false,"icon":"mdi:window-shutter","friendly_name":"volets_auto_soir_etat_cuisine"},"context":{"id":"01H99PMQNCTGMAQR7JA56HTP0P","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.604Z","last_updated":"2023-09-02T01:03:14.604Z","timeSinceChangedMs":20664594},{"entity_id":"input_boolean.volets_auto_azimut_cuisine","state":"on","attributes":{"editable":false,"icon":"mdi:window-shutter","friendly_name":"volets_auto_azimut_cuisine"},"context":{"id":"01H99PMQNDS7145QXRPASE6TKG","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.605Z","last_updated":"2023-09-02T01:03:14.605Z","timeSinceChangedMs":20664594},{"entity_id":"input_boolean.volets_auto_matin_etat_ch1","state":"off","attributes":{"editable":false,"icon":"mdi:window-shutter","friendly_name":"volets_auto_etat_ch1"},"context":{"id":"01H99PMQNDD417XC4YJTG8QJWB","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.605Z","last_updated":"2023-09-02T01:03:14.605Z","timeSinceChangedMs":20664595},{"entity_id":"input_boolean.volets_auto_soir_etat_ch1","state":"on","attributes":{"editable":false,"icon":"mdi:window-shutter","friendly_name":"volets_auto_soir_etat_ch1"},"context":{"id":"01H99PMQND5JFB7QZEZ8WYMRRP","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.605Z","last_updated":"2023-09-02T01:03:14.605Z","timeSinceChangedMs":20664596},{"entity_id":"input_boolean.volets_auto_azimut_ch1","state":"on","attributes":{"editable":false,"icon":"mdi:window-shutter","friendly_name":"volets_auto_azimut_ch1"},"context":{"id":"01H99PMQND86ECWST8KYMJKHTD","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.605Z","last_updated":"2023-09-02T01:03:14.605Z","timeSinceChangedMs":20664597},{"entity_id":"input_boolean.volets_auto_matin_etat_ch2","state":"off","attributes":{"editable":false,"icon":"mdi:window-shutter","friendly_name":"volets_auto_etat_ch2"},"context":{"id":"01H99PMQNDPQ236CDJ6X7C6E60","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.605Z","last_updated":"2023-09-02T01:03:14.605Z","timeSinceChangedMs":20664598},{"entity_id":"input_boolean.volets_auto_soir_etat_ch2","state":"on","attributes":{"editable":false,"icon":"mdi:window-shutter","friendly_name":"volets_auto_soir_etat_ch2"},"context":{"id":"01H99PMQNDMFVN2K47D9ASA32P","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.605Z","last_updated":"2023-09-02T01:03:14.605Z","timeSinceChangedMs":20664599},{"entity_id":"input_boolean.volets_auto_azimut_ch2","state":"on","attributes":{"editable":false,"icon":"mdi:window-shutter","friendly_name":"volets_auto_azimut_ch2"},"context":{"id":"01H99PMQNEE2KKRRK2Q78AJ4WK","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.606Z","last_updated":"2023-09-02T01:03:14.606Z","timeSinceChangedMs":20664599},{"entity_id":"input_boolean.volets_auto_matin_etat_ch3","state":"off","attributes":{"editable":false,"icon":"mdi:window-shutter","friendly_name":"volets_auto_etat_ch3"},"context":{"id":"01H99PMQNEMJHS79XEGRC06QVM","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.606Z","last_updated":"2023-09-02T01:03:14.606Z","timeSinceChangedMs":20664600},{"entity_id":"input_boolean.volets_auto_soir_etat_ch3","state":"on","attributes":{"editable":false,"icon":"mdi:window-shutter","friendly_name":"volets_auto_soir_etat_ch3"},"context":{"id":"01H99PMQNERRNRZWNH189GDHBT","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.606Z","last_updated":"2023-09-02T01:03:14.606Z","timeSinceChangedMs":20664601},{"entity_id":"input_boolean.volets_auto_azimut_ch3","state":"on","attributes":{"editable":false,"icon":"mdi:window-shutter","friendly_name":"volets_auto_azimut_ch3"},"context":{"id":"01H99PMQNE20DA0PE9VCFJRE14","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.606Z","last_updated":"2023-09-02T01:03:14.606Z","timeSinceChangedMs":20664602},{"entity_id":"input_boolean.volets_up_bureau","state":"off","attributes":{"editable":false,"icon":"mdi:arrow-up-bold","friendly_name":"volets_up_bureau"},"context":{"id":"01H99PMQNF39K2M79B787Y0G1A","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.607Z","last_updated":"2023-09-02T01:03:14.607Z","timeSinceChangedMs":20664602},{"entity_id":"input_boolean.volets_up_sam","state":"off","attributes":{"editable":false,"icon":"mdi:arrow-up-bold","friendly_name":"volets_up_sam"},"context":{"id":"01H99PMQNFYCMH0C3VQKXVGTAJ","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.607Z","last_updated":"2023-09-02T01:03:14.607Z","timeSinceChangedMs":20664604},{"entity_id":"input_boolean.volets_up_salon","state":"off","attributes":{"editable":false,"icon":"mdi:arrow-up-bold","friendly_name":"volets_up_salon"},"context":{"id":"01H99PMQNFSRYBCWK0MAWWWWW5","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.607Z","last_updated":"2023-09-02T01:03:14.607Z","timeSinceChangedMs":20664606},{"entity_id":"input_boolean.volets_up_cuisine","state":"off","attributes":{"editable":false,"icon":"mdi:arrow-up-bold","friendly_name":"volets_up_cuisine"},"context":{"id":"01H99PMQNGTRFVKB5TWZR050SG","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.608Z","last_updated":"2023-09-02T01:03:14.608Z","timeSinceChangedMs":20664606},{"entity_id":"input_boolean.volets_up_ch1","state":"off","attributes":{"editable":false,"icon":"mdi:arrow-up-bold","friendly_name":"volets_up_ch1"},"context":{"id":"01H99PMQNGGW129NV7WY8MMG1E","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.608Z","last_updated":"2023-09-02T01:03:14.608Z","timeSinceChangedMs":20664608},{"entity_id":"input_boolean.volets_up_ch2","state":"off","attributes":{"editable":false,"icon":"mdi:arrow-up-bold","friendly_name":"volets_up_ch2"},"context":{"id":"01H99PMQNGW34BP3R20RJ09CVZ","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.608Z","last_updated":"2023-09-02T01:03:14.608Z","timeSinceChangedMs":20664609},{"entity_id":"input_boolean.volets_up_ch3","state":"off","attributes":{"editable":false,"icon":"mdi:arrow-up-bold","friendly_name":"volets_up_ch3"},"context":{"id":"01H99PMQNG43FF1R6FX0QEE4Z6","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.608Z","last_updated":"2023-09-02T01:03:14.608Z","timeSinceChangedMs":20664610},{"entity_id":"input_boolean.volets_down_bureau","state":"off","attributes":{"editable":false,"icon":"mdi:arrow-down-bold","friendly_name":"volets_down_bureau"},"context":{"id":"01H99PMQNG7BK003CH3AYYVXCB","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.608Z","last_updated":"2023-09-02T01:03:14.608Z","timeSinceChangedMs":20664612},{"entity_id":"input_boolean.volets_down_sam","state":"off","attributes":{"editable":false,"icon":"mdi:arrow-down-bold","friendly_name":"volets_down_sam"},"context":{"id":"01H99PMQNHM9Y3SRQTFJ5CVK6H","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.609Z","last_updated":"2023-09-02T01:03:14.609Z","timeSinceChangedMs":20664617},{"entity_id":"input_boolean.volets_down_salon","state":"off","attributes":{"editable":false,"icon":"mdi:arrow-down-bold","friendly_name":"volets_down_salon"},"context":{"id":"01H99PMQNHS5B586JJ7VFH10SX","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.609Z","last_updated":"2023-09-02T01:03:14.609Z","timeSinceChangedMs":20664618},{"entity_id":"input_boolean.volets_down_cuisine","state":"off","attributes":{"editable":false,"icon":"mdi:arrow-down-bold","friendly_name":"volets_down_cuisine"},"context":{"id":"01H99PMQNHFTSZR1M5XAK7XSR8","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.609Z","last_updated":"2023-09-02T01:03:14.609Z","timeSinceChangedMs":20664619},{"entity_id":"input_boolean.volets_down_ch1","state":"off","attributes":{"editable":false,"icon":"mdi:arrow-down-bold","friendly_name":"volets_down_ch1"},"context":{"id":"01H99PMQNHRKJ9T2KV1JNER5KQ","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.609Z","last_updated":"2023-09-02T01:03:14.609Z","timeSinceChangedMs":20664621},{"entity_id":"input_boolean.volets_down_ch2","state":"off","attributes":{"editable":false,"icon":"mdi:arrow-down-bold","friendly_name":"volets_down_ch2"},"context":{"id":"01H99PMQNHK3WCDRZQADJVMDRH","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.609Z","last_updated":"2023-09-02T01:03:14.609Z","timeSinceChangedMs":20664623},{"entity_id":"input_boolean.volets_down_ch3","state":"off","attributes":{"editable":false,"icon":"mdi:arrow-down-bold","friendly_name":"volets_down_ch3"},"context":{"id":"01H99PMQNH8DTYRM3NJ9RA8MWG","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.609Z","last_updated":"2023-09-02T01:03:14.609Z","timeSinceChangedMs":20664624},{"entity_id":"input_boolean.volets_stop_bureau","state":"off","attributes":{"editable":false,"icon":"mdi:stop","friendly_name":"volets_stop_bureau"},"context":{"id":"01H99PMQNJ4834FD6F7MYG56BG","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.610Z","last_updated":"2023-09-02T01:03:14.610Z","timeSinceChangedMs":20664625},{"entity_id":"input_boolean.volets_stop_sam","state":"off","attributes":{"editable":false,"icon":"mdi:stop","friendly_name":"volets_stop_sam"},"context":{"id":"01H99PMQNJJC17N1C0FW2738EX","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.610Z","last_updated":"2023-09-02T01:03:14.610Z","timeSinceChangedMs":20664627},{"entity_id":"input_boolean.volets_stop_salon","state":"off","attributes":{"editable":false,"icon":"mdi:stop","friendly_name":"volets_stop_salon"},"context":{"id":"01H99PMQNJF25ESYKV9K0EFXXG","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.610Z","last_updated":"2023-09-02T01:03:14.610Z","timeSinceChangedMs":20664629},{"entity_id":"input_boolean.volets_stop_cuisine","state":"off","attributes":{"editable":false,"icon":"mdi:stop","friendly_name":"volets_stop_cuisine"},"context":{"id":"01H99PMQNJBNXC3KSBH487VZ35","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.610Z","last_updated":"2023-09-02T01:03:14.610Z","timeSinceChangedMs":20664631},{"entity_id":"input_boolean.volets_stop_ch1","state":"off","attributes":{"editable":false,"icon":"mdi:stop","friendly_name":"volets_stop_ch1"},"context":{"id":"01H99PMQNJGWYEMND056P3VYKB","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.610Z","last_updated":"2023-09-02T01:03:14.610Z","timeSinceChangedMs":20664632},{"entity_id":"input_boolean.volets_stop_ch2","state":"off","attributes":{"editable":false,"icon":"mdi:stop","friendly_name":"volets_stop_ch2"},"context":{"id":"01H99PMQNK693ASD0ZR45W0RKK","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.611Z","last_updated":"2023-09-02T01:03:14.611Z","timeSinceChangedMs":20664633},{"entity_id":"input_boolean.volets_stop_ch3","state":"off","attributes":{"editable":false,"icon":"mdi:stop","friendly_name":"volets_stop_ch3"},"context":{"id":"01H99PMQNKH5DV00BCG21EE0V8","parent_id":null,"user_id":null},"last_changed":"2023-09-02T01:03:14.611Z","last_updated":"2023-09-02T01:03:14.611Z","timeSinceChangedMs":20664634},{"entity_id":"cover.volets_centrals","state":"closed","attributes":{"current_position":0,"entity_id":["cover.commutateur_de_rideau_3_curtain","cover.commutateur_de_rideau_2_curtain","cover.commutateur_de_rideau_curtain"],"friendly_name":"Volets centrals","supported_features":15},"last_changed":"2023-09-02T04:30:18.456Z","last_updated":"2023-09-02T04:30:18.456Z","context":{"id":"01H9A2FWAMA6WKECHBYNCMCNHH","parent_id":null,"user_id":null},"timeSinceChangedMs":8240843}]

Je souhaiterai que l’objet ne contienne que les entités répondant aux critères [a-z_a-z].volet_*id ou id =« bureau » par exemple.

Je sais pas si ma demande est plus claire mais merci pour ton aide

Euh… Pas vraiment.
Ca, ça marche:

Avec msg.id contenant cuisine (ca fait une entité qui existe chez moi)

Dans ton exemple, je ne vois pas d’ou vient:

ni à quoi ça sert…

Oui effectivement pas facile à expliquer

Supposons que j’ai en entrée le JSON suivant

[
  {
    "entity_id": "input_number.volets_niveau_bureau",
    "state": "100.0",
    "attributes": {
      "initial": null,
      "editable": false,
      "min": 0,
      "max": 100,
      "step": 1,
      "mode": "box",
      "friendly_name": "volets_niveau_bureau"
    },
    "last_changed": "2023-09-02T04:30:18.303Z",
    "last_updated": "2023-09-02T04:30:18.303Z",
    "context": {
      "id": "01H9A2FW5YJ2Q7DN5GF189Z2J2",
      "parent_id": null,
      "user_id": "35f00be49c604648bbb88667afdc8327"
    },
    "timeSinceChangedMs": 14352941
  },
  {
    "entity_id": "input_number.volets_niveau_sam",
    "state": "100.0",
    "attributes": {
      "initial": null,
      "editable": false,
      "min": 0,
      "max": 100,
      "step": 1,
      "mode": "slider",
      "friendly_name": "volets_niveau_sam"
    },
    "context": {
      "id": "01H99PMQMVGC9JK41DQP1ZERZY",
      "parent_id": null,
      "user_id": null
    },
    "last_changed": "2023-09-02T01:03:14.587Z",
    "last_updated": "2023-09-02T01:03:14.587Z",
    "timeSinceChangedMs": 26776657
  }
]

je souhaite extraire en sortie l’objet dont « entity_id » vaut « volets_niveau_bureau » impossible

Si, c’est possible :slight_smile:

Vu que ton entité s’appelle volets_niveau_bureau, si msg.id vaut bureau, alors l’expression jsonata $contains( $entity().entity_id, "volets_niveau_" & id ) donnera ce que tu veux…

oui effectivement j’ai bien qu’une sortie je pensais pouvoir extraire volets_[n’importe quelle chaine]id
ce qui m’aurait sorti
les objets:
input_number.volets_niveau_bureau
input_number.volets_auto_offset_ouvre_bureau
input_number.volets_auto_offset_ferme_bureau
input_boolean.volets_auto_matin_etat_bureau

Merci je vais regarder comment m’en sortir avec ça

et

Ce n’est pas la même chose.

On peut faire ce que tu veux. Il faut faire ça:

$contains(
   $entity().entity_id,
   $eval("/.*" & piece & ".*/")
)

Avec msg.piece=bureau, tu vas récupérer toutes les entités qui ont « bureau » dedans.

Bonjour et merci @golfvert , j’ai pu avancer avec ton aide