#######################################################################
** ATUALIZAÇÃO**
- Adicionado a função de remover o objeto através de um input_select
#######################################################################
AÇÕES NECESSÁRIAS
- Importar novo código abaixo:
[{"id":"0dace93f1c62e709","type":"tab","label":"-Correios","disabled":false,"info":"","env":[]},{"id":"ea071e8da9d39124","type":"group","z":"0dace93f1c62e709","name":"Incluir rastreio","style":{"label":true},"nodes":["f215688aac7e67bb","404d5b69c1e40af2","a600ebca20c0968b","b5ee5028792ea8ba","237f67f2ca4ab536","79fba58b01c11c87","ff53093e2e9155d2","cc72f9f1b7fda6fd","6c040845867ff6a8","2733cd67e1978769","b1ed375c92445889","b8475e64f4b3cb63","22ce5d1975abff1a","2c6d126be43a048f","e12ea3e4b120efac","c288b536137d8b7f","9f2530ef2c9c5426","25d0d5e83406a5ed","fd08bd6356577e16"],"x":34,"y":199,"w":1572,"h":202},{"id":"adb353b90d4bbedb","type":"group","z":"0dace93f1c62e709","name":"Excluir rastreio","style":{"label":true},"nodes":["04f55063a767d56e","d77b94517384bea3","c8249e43b7705297","bdabd4c81e1309ef","b1a2204e1e301956","5ae184bfa0ef8c3e","6cdec18df7cd0e52","4e7c42d01a3f26d6","d26cd1f99381882b","df9ec96ad35274ab","4315c71adaa2ad30","e94f5ee3c580f66f","ca3f516e4f0ee95d","5f37254d17edc2b4","c1efd4a606eb9588","2cbf0fc39024983d","7d30202b0766f77c"],"x":34,"y":419,"w":1252,"h":222},{"id":"86677324bf9ac5d5","type":"group","z":"0dace93f1c62e709","name":"DEV","style":{"label":true},"nodes":["8d3062d99d027706","d7c5785ecede29b7","6548be5899f59b91","0a7db1c063cfa5d7","c174c3b3101d4262","a947da941e97c655","7c62383f8de137ae","6094c75c2b4ea31c","46f3c22ae5e38e3a","b9737211cc4333fb","7883a2e578eb7ada","6b51a82b7083077f","12b9b0629c827122"],"x":34,"y":959,"w":752,"h":262},{"id":"91ea8b8ecc076fd8","type":"group","z":"0dace93f1c62e709","name":"Atualizações dos rastreios ","style":{"label":true},"nodes":["1600e2e5189d4151","9024c307453b89df","996091b7f3bec5b6","a614af9e407b0f79","62310de63bee4094","b517f75bbda0a73b","02a520b2ac3ae3c6","0afd745cb7d74494","75f4be3092a5efd8","ae75eeea82e9e31e","030dbae2bd6af67b"],"x":24,"y":859,"w":1462,"h":82},{"id":"e1c505609255ef96","type":"group","z":"0dace93f1c62e709","name":"Mudança de status","style":{"label":true},"nodes":["987d968b888972f4","4acf0b6e86c06cff","ece02265c4aba933","40467c538ceb786a","8bf30de06077ee63","93e3da0b98a668d1","a58efac89ff2450d","4215b6ab806a9d83","8382b3978128ee31","fa556b1a46bca79e","deabae80d553e27d"],"x":34,"y":679,"w":1342,"h":162},{"id":"2fee2da68df7bc00","type":"inject","z":"0dace93f1c62e709","name":"Digitar Chave token e IP","props":[{"p":"payload"}],"repeat":"1800","crontab":"","once":true,"onceDelay":"2","topic":"","payload":"","payloadType":"date","x":75,"y":40,"wires":[["965a10599f527867"]],"l":false},{"id":"965a10599f527867","type":"change","z":"0dace93f1c62e709","name":"Digitar Chave token e IP","rules":[{"t":"set","p":"token","pt":"flow","to":"","tot":"str"},{"t":"set","p":"ip","pt":"flow","to":"192.168.0.140:8123","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":210,"y":40,"wires":[[]]},{"id":"f215688aac7e67bb","type":"function","z":"0dace93f1c62e709","g":"ea071e8da9d39124","name":"Headers","func":"msg.url = \"https://www.linkcorreios.com.br/?id=\" + msg.rastreio\nmsg.headers = {\n \"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, como Gecko) Chrome/50.0.2661.102 Safari/537.36\",\n}\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":620,"y":300,"wires":[["404d5b69c1e40af2"]]},{"id":"404d5b69c1e40af2","type":"http request","z":"0dace93f1c62e709","g":"ea071e8da9d39124","name":"Site","method":"GET","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":750,"y":300,"wires":[["a600ebca20c0968b"]]},{"id":"a600ebca20c0968b","type":"html","z":"0dace93f1c62e709","g":"ea071e8da9d39124","name":"Status","property":"payload","outproperty":"status","tag":"#page > main > div.container.margin_30_5 > div > div > div.singlepost > ul:nth-child(3) > li:nth-child(1) > b","ret":"text","as":"single","x":870,"y":300,"wires":[["6c040845867ff6a8"]]},{"id":"b5ee5028792ea8ba","type":"api-current-state","z":"0dace93f1c62e709","g":"ea071e8da9d39124","name":"Rastreio","server":"db1ab0af.caa65","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_text.correios_rastreio","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"rastreio","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":120,"y":300,"wires":[["79fba58b01c11c87","22ce5d1975abff1a"]]},{"id":"237f67f2ca4ab536","type":"server-state-changed","z":"0dace93f1c62e709","g":"ea071e8da9d39124","name":"SALVAR","server":"db1ab0af.caa65","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_button.correios_salvar","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"}],"x":120,"y":240,"wires":[["b5ee5028792ea8ba","e12ea3e4b120efac"]]},{"id":"79fba58b01c11c87","type":"api-call-service","z":"0dace93f1c62e709","g":"ea071e8da9d39124","name":"Limpar texto","server":"db1ab0af.caa65","version":5,"debugenabled":false,"domain":"input_text","service":"set_value","areaId":[],"deviceId":[],"entityId":["input_text.correios_nome_objeto","input_text.correios_rastreio"],"data":"{\"value\":\"\"}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":130,"y":360,"wires":[["2c6d126be43a048f"]]},{"id":"ff53093e2e9155d2","type":"function","z":"0dace93f1c62e709","g":"ea071e8da9d39124","name":"Criar sensor","func":"let arrayRastreio = flow.get(\"rastreio\") || [];\narrayRastreio.push(msg.rastreio);\nflow.set(\"rastreio\", arrayRastreio);\n\n\nlet arrayObjeto = flow.get(\"nome_objeto\") || [];\narrayObjeto.push(msg.nome_objeto);\nflow.set(\"nome_objeto\", arrayObjeto);\n\nlet arrayNotificacao = flow.get(\"notificacao\") || [];\narrayNotificacao.push(msg.notificacao);\nflow.set(\"notificacao\", arrayNotificacao);\n\nmsg.entity_id = 'sensor.correios_' + msg.rastreio.toUpperCase()\n\nmsg.payload = {\n data: {\n state: msg.status,\n attributes: {\n rastreio: msg.rastreio,\n status: msg.status,\n notificacao: msg.notificacao,\n data: msg.data,\n local: msg.local,\n destino: msg.destino,\n friendly_name: msg.nome_objeto.toUpperCase() + ' - ' + msg.rastreio.toUpperCase(),\n }\n }\n};\n\nreturn msg\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1390,"y":300,"wires":[["cc72f9f1b7fda6fd"]]},{"id":"cc72f9f1b7fda6fd","type":"ha-api","z":"0dace93f1c62e709","g":"ea071e8da9d39124","name":"","server":"db1ab0af.caa65","version":1,"debugenabled":false,"protocol":"http","method":"post","path":"/api/states/{{entity_id}}","data":"","dataType":"json","responseType":"json","outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"results"}],"x":1530,"y":300,"wires":[[]]},{"id":"6c040845867ff6a8","type":"html","z":"0dace93f1c62e709","g":"ea071e8da9d39124","name":"Data","property":"payload","outproperty":"data","tag":"#page > main > div.container.margin_30_5 > div > div > div.singlepost > ul:nth-child(3) > li:nth-child(2)","ret":"text","as":"single","x":990,"y":300,"wires":[["2733cd67e1978769"]]},{"id":"2733cd67e1978769","type":"html","z":"0dace93f1c62e709","g":"ea071e8da9d39124","name":"Local","property":"payload","outproperty":"local","tag":"#page > main > div.container.margin_30_5 > div > div > div.singlepost > ul:nth-child(3) > li:nth-child(3)","ret":"text","as":"single","x":1110,"y":300,"wires":[["b8475e64f4b3cb63"]]},{"id":"b1ed375c92445889","type":"api-current-state","z":"0dace93f1c62e709","g":"ea071e8da9d39124","name":"Nome objeto","server":"db1ab0af.caa65","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_text.correios_nome_objeto","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"nome_objeto","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":470,"y":300,"wires":[["f215688aac7e67bb"]]},{"id":"b8475e64f4b3cb63","type":"html","z":"0dace93f1c62e709","g":"ea071e8da9d39124","name":"Destino","property":"payload","outproperty":"destino","tag":"#page > main > div.container.margin_30_5 > div > div > div.singlepost > ul:nth-child(3) > li:nth-child(4)","ret":"text","as":"single","x":1240,"y":300,"wires":[["ff53093e2e9155d2"]]},{"id":"22ce5d1975abff1a","type":"api-current-state","z":"0dace93f1c62e709","g":"ea071e8da9d39124","name":"Notificação","server":"db1ab0af.caa65","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_select.correios_notificacao","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"notificacao","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":310,"y":300,"wires":[["b1ed375c92445889"]]},{"id":"2c6d126be43a048f","type":"api-call-service","z":"0dace93f1c62e709","g":"ea071e8da9d39124","name":"Limpar select","server":"db1ab0af.caa65","version":5,"debugenabled":false,"domain":"input_select","service":"select_option","areaId":[],"deviceId":[],"entityId":["input_select.correios_notificacao"],"data":"{\"option\":\"Sim\"}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":370,"y":360,"wires":[[]]},{"id":"e12ea3e4b120efac","type":"delay","z":"0dace93f1c62e709","g":"ea071e8da9d39124","name":"","pauseType":"delay","timeout":"6","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":235,"y":240,"wires":[["c288b536137d8b7f"]],"l":false},{"id":"c288b536137d8b7f","type":"ha-get-entities","z":"0dace93f1c62e709","g":"ea071e8da9d39124","name":"Pegar sensores","server":"db1ab0af.caa65","version":0,"rules":[{"property":"entity_id","logic":"starts_with","value":"sensor.correios_","valueType":"str"}],"output_type":"array","output_empty_results":false,"output_location_type":"msg","output_location":"sensores","output_results_count":1,"x":480,"y":240,"wires":[["9f2530ef2c9c5426"]]},{"id":"9f2530ef2c9c5426","type":"function","z":"0dace93f1c62e709","g":"ea071e8da9d39124","name":"function","func":"// Inicializar o array de opções\nvar options = [];\n\n// Loop através do array msg.sensores\nfor (var i = 0; i < msg.sensores.length; i++) {\n // Adicionar o valor atual de msg.sensores[i].entity_id ao array de opções\n options.push(msg.sensores[i].attributes.friendly_name);\n}\n\n// Definir as opções no objeto msg.payload.data\nmsg.payload = {\n data: {\n \"options\": options\n }\n}\n\n// Enviar a mensagem modificada para o próximo nó\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":640,"y":240,"wires":[["25d0d5e83406a5ed"]]},{"id":"25d0d5e83406a5ed","type":"api-call-service","z":"0dace93f1c62e709","g":"ea071e8da9d39124","name":"Criar lista","server":"db1ab0af.caa65","version":5,"debugenabled":false,"domain":"input_select","service":"set_options","areaId":[],"deviceId":[],"entityId":["input_select.rastreio"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":780,"y":240,"wires":[[]]},{"id":"fd08bd6356577e16","type":"link in","z":"0dace93f1c62e709","g":"ea071e8da9d39124","name":"link in 55","links":["e94f5ee3c580f66f","4315c71adaa2ad30"],"x":325,"y":240,"wires":[["c288b536137d8b7f"]]},{"id":"04f55063a767d56e","type":"http request","z":"0dace93f1c62e709","g":"adb353b90d4bbedb","name":"","method":"DELETE","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":570,"y":460,"wires":[["e94f5ee3c580f66f","7d30202b0766f77c"]]},{"id":"d77b94517384bea3","type":"function","z":"0dace93f1c62e709","g":"adb353b90d4bbedb","name":"Headers","func":"let partes = msg.rastreio.split('-');\nlet resultado = partes.pop().trim().toUpperCase();\nmsg.rastreio = resultado;\n\nmsg.headers = {\n \"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, como Gecko) Chrome/50.0.2661.102 Safari/537.36\",\n \"Authorization\": \"Bearer \"+flow.get(\"token\"),\n}\n\nmsg.url = 'http://'+flow.get(\"ip\")+'/api/states/sensor.correios_' + msg.rastreio\n\n\nvar index = flow.get(\"rastreio\").indexOf(msg.rastreio);\nvar rastreio = flow.get(\"rastreio\");\nvar nome_objeto = flow.get(\"nome_objeto\");\nvar notificacao = flow.get(\"notificacao\")\n\nif (index !== -1) {\n rastreio.splice(index, 1);\n flow.set(\"rastreio\", rastreio)\n nome_objeto.splice(index, 1);\n flow.set(\"nome_objeto\",nome_objeto)\n notificacao.splice(index, 1);\n flow.set(\"notificacao\", notificacao)\n}\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":420,"y":460,"wires":[["04f55063a767d56e"]]},{"id":"c8249e43b7705297","type":"server-state-changed","z":"0dace93f1c62e709","g":"adb353b90d4bbedb","name":"EXCLUIR","server":"db1ab0af.caa65","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_button.correios_excluir","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":120,"y":460,"wires":[["b1a2204e1e301956","bdabd4c81e1309ef"]]},{"id":"bdabd4c81e1309ef","type":"api-current-state","z":"0dace93f1c62e709","g":"adb353b90d4bbedb","name":"Rastreio","server":"db1ab0af.caa65","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_select.rastreio","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"rastreio","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":280,"y":460,"wires":[["d77b94517384bea3"]]},{"id":"b1a2204e1e301956","type":"api-call-service","z":"0dace93f1c62e709","g":"adb353b90d4bbedb","name":"Limpar texto","server":"db1ab0af.caa65","version":5,"debugenabled":false,"domain":"input_text","service":"set_value","areaId":[],"deviceId":[],"entityId":["input_text.correios_nome_objeto","input_text.correios_rastreio"],"data":"{\"value\":\"\"}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":130,"y":520,"wires":[[]]},{"id":"5ae184bfa0ef8c3e","type":"switch","z":"0dace93f1c62e709","g":"adb353b90d4bbedb","name":"= Objeto entregue ao destinatário","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"['Objeto entregue ao destinatário']","vt":"str"},{"t":"eq","v":"['Objeto entregue ao remetente']","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":440,"y":600,"wires":[["d26cd1f99381882b"],["d26cd1f99381882b"]]},{"id":"6cdec18df7cd0e52","type":"function","z":"0dace93f1c62e709","g":"adb353b90d4bbedb","name":"Headers","func":"msg.headers = {\n \"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, como Gecko) Chrome/50.0.2661.102 Safari/537.36\",\n \"Authorization\": \"Bearer \" + flow.get(\"token\"),\n}\n\nmsg.url = 'http://' + flow.get(\"ip\") + '/api/states/sensor.correios_' + msg.data.new_state.attributes.rastreio\n\nvar index = flow.get(\"rastreio\").indexOf(msg.data.new_state.attributes.rastreio);\nvar rastreio = flow.get(\"rastreio\");\nvar nome_objeto = flow.get(\"nome_objeto\");\nvar notificacao = flow.get(\"notificacao\");\n\nif (index !== -1) {\n rastreio.splice(index, 1);\n flow.set(\"rastreio\", rastreio)\n nome_objeto.splice(index, 1);\n flow.set(\"nome_objeto\", nome_objeto)\n notificacao.splice(index, 1);\n flow.set(\"notificacao\", notificacao)\n}\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":720,"y":600,"wires":[["4e7c42d01a3f26d6"]]},{"id":"4e7c42d01a3f26d6","type":"http request","z":"0dace93f1c62e709","g":"adb353b90d4bbedb","name":"","method":"DELETE","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":870,"y":600,"wires":[["4315c71adaa2ad30"]]},{"id":"d26cd1f99381882b","type":"delay","z":"0dace93f1c62e709","g":"adb353b90d4bbedb","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"minutes","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":625,"y":600,"wires":[["6cdec18df7cd0e52"]],"l":false},{"id":"df9ec96ad35274ab","type":"server-state-changed","z":"0dace93f1c62e709","g":"adb353b90d4bbedb","name":"Excluir automaticamente","server":"db1ab0af.caa65","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.correios_","entityidfiltertype":"regex","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":false,"for":"0","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":170,"y":600,"wires":[["5ae184bfa0ef8c3e"]]},{"id":"4315c71adaa2ad30","type":"link out","z":"0dace93f1c62e709","g":"adb353b90d4bbedb","name":"link out 74","mode":"link","links":["392e29fa7c841991","4889d89cd6c1f2c0","fd08bd6356577e16","6a50ed49d7a7d474"],"x":975,"y":600,"wires":[]},{"id":"e94f5ee3c580f66f","type":"link out","z":"0dace93f1c62e709","g":"adb353b90d4bbedb","name":"link out 73","mode":"link","links":["392e29fa7c841991","fd08bd6356577e16","6a50ed49d7a7d474"],"x":665,"y":460,"wires":[]},{"id":"ca3f516e4f0ee95d","type":"ha-get-entities","z":"0dace93f1c62e709","g":"adb353b90d4bbedb","name":"Pegar sensores","server":"db1ab0af.caa65","version":0,"rules":[{"property":"entity_id","logic":"starts_with","value":"sensor.correios_","valueType":"str"}],"output_type":"array","output_empty_results":true,"output_location_type":"msg","output_location":"sensores","output_results_count":1,"x":820,"y":460,"wires":[["2cbf0fc39024983d"]]},{"id":"5f37254d17edc2b4","type":"function","z":"0dace93f1c62e709","g":"adb353b90d4bbedb","name":"function","func":"// Inicializar o array de opções\nvar options = [];\n\nif (msg.sensores[0] != ''){\n // Loop através do array msg.sensores\n for (var i = 0; i < msg.sensores.length; i++) {\n // Adicionar o valor atual de msg.sensores[i].entity_id ao array de opções\n options.push(msg.sensores[i].attributes.friendly_name);\n }\n}\nelse {\n options = msg.sensores[0];\n}\n\n// Definir as opções no objeto msg.payload.data\nmsg.payload = {\n data: {\n \"options\": options\n }\n}\n\n// Enviar a mensagem modificada para o próximo nó\nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1060,"y":460,"wires":[["c1efd4a606eb9588"]]},{"id":"c1efd4a606eb9588","type":"api-call-service","z":"0dace93f1c62e709","g":"adb353b90d4bbedb","name":"Criar lista","server":"db1ab0af.caa65","version":5,"debugenabled":false,"domain":"input_select","service":"set_options","areaId":[],"deviceId":[],"entityId":["input_select.rastreio"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1200,"y":460,"wires":[[]]},{"id":"2cbf0fc39024983d","type":"function","z":"0dace93f1c62e709","g":"adb353b90d4bbedb","name":"function 33","func":"if (msg.sensores.length === 0) {\n msg.sensores[0] = \"\";\n return [msg, null];\n}\nelse {\n return [null, msg];\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":935,"y":460,"wires":[["5f37254d17edc2b4"]],"l":false},{"id":"7d30202b0766f77c","type":"delay","z":"0dace93f1c62e709","g":"adb353b90d4bbedb","name":"","pauseType":"delay","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":705,"y":460,"wires":[["ca3f516e4f0ee95d"]],"l":false},{"id":"8d3062d99d027706","type":"inject","z":"0dace93f1c62e709","g":"86677324bf9ac5d5","name":"Revemor Rastreio","props":[{"p":"rastreio","v":"","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":170,"y":1000,"wires":[["d7c5785ecede29b7"]]},{"id":"d7c5785ecede29b7","type":"function","z":"0dace93f1c62e709","g":"86677324bf9ac5d5","name":"Remover do array","func":"var index = flow.get(\"rastreio\").indexOf(msg.rastreio);\nvar rastreio = flow.get(\"rastreio\")\n\n\nif (index !== -1) {\n rastreio.splice(index, 1);\n flow.set(\"rastreio\",rastreio)\n}\nreturn msg;\n\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":370,"y":1000,"wires":[["6548be5899f59b91"]]},{"id":"6548be5899f59b91","type":"debug","z":"0dace93f1c62e709","g":"86677324bf9ac5d5","name":"remover array","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":560,"y":1000,"wires":[]},{"id":"0a7db1c063cfa5d7","type":"inject","z":"0dace93f1c62e709","g":"86677324bf9ac5d5","name":"Listar","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":130,"y":1060,"wires":[["c174c3b3101d4262"]]},{"id":"c174c3b3101d4262","type":"template","z":"0dace93f1c62e709","g":"86677324bf9ac5d5","name":"Listar array","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{flow.rastreio}}\n{{flow.nome_objeto}}\n{{flow.notificacao}}","output":"str","x":290,"y":1060,"wires":[["a947da941e97c655"]]},{"id":"a947da941e97c655","type":"debug","z":"0dace93f1c62e709","g":"86677324bf9ac5d5","name":"listar array","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":470,"y":1060,"wires":[]},{"id":"7c62383f8de137ae","type":"inject","z":"0dace93f1c62e709","g":"86677324bf9ac5d5","name":"Zerar Array","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":140,"y":1120,"wires":[["6094c75c2b4ea31c"]]},{"id":"6094c75c2b4ea31c","type":"function","z":"0dace93f1c62e709","g":"86677324bf9ac5d5","name":"Limpar array","func":"var clear_rastreio = flow.get(\"rastreio\");\nclear_rastreio = [] || [];\nflow.set(\"rastreio\", clear_rastreio);\n\nvar clear_nome_objeto = flow.get(\"nome_objeto\");\nclear_nome_objeto = [] || [];\nflow.set(\"nome_objeto\", clear_nome_objeto);\n\nvar clear_notificacao = flow.get(\"notificacao\");\nclear_notificacao = [] || [];\nflow.set(\"notificacao\", clear_notificacao);\n\nreturn msg;\n\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":290,"y":1120,"wires":[["46f3c22ae5e38e3a"]]},{"id":"46f3c22ae5e38e3a","type":"debug","z":"0dace93f1c62e709","g":"86677324bf9ac5d5","name":"array limpo","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":470,"y":1120,"wires":[]},{"id":"b9737211cc4333fb","type":"function","z":"0dace93f1c62e709","g":"86677324bf9ac5d5","name":"Headers","func":"msg.headers = {\n \"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, como Gecko) Chrome/50.0.2661.102 Safari/537.36\",\n \"Authorization\": \"Bearer \"+flow.get(\"token\"),\n}\n\nmsg.url = 'http://'+flow.get(\"ip\")+'/api/states/sensor.correios_' + msg.rastreio\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":320,"y":1180,"wires":[["7883a2e578eb7ada"]]},{"id":"7883a2e578eb7ada","type":"http request","z":"0dace93f1c62e709","g":"86677324bf9ac5d5","name":"","method":"DELETE","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":490,"y":1180,"wires":[["6b51a82b7083077f"]]},{"id":"6b51a82b7083077f","type":"debug","z":"0dace93f1c62e709","g":"86677324bf9ac5d5","name":"remover sensor","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":660,"y":1180,"wires":[]},{"id":"12b9b0629c827122","type":"inject","z":"0dace93f1c62e709","g":"86677324bf9ac5d5","name":"Deletar sensor","props":[{"p":"rastreio","v":"NL658154191BR","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":160,"y":1180,"wires":[["b9737211cc4333fb"]]},{"id":"1600e2e5189d4151","type":"function","z":"0dace93f1c62e709","g":"91ea8b8ecc076fd8","name":"Headers","func":"for (var i = 0; i < flow.get(\"rastreio\").length; i++) {\n msg.url = \"https://www.linkcorreios.com.br/?id=\" + flow.get(\"rastreio\")[i]\n msg.headers = {\n \"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, como Gecko) Chrome/50.0.2661.102 Safari/537.36\",\n }\n\n msg.rastreio = flow.get(\"rastreio\")[i]\n msg.nome_objeto = flow.get(\"nome_objeto\")[i]\n msg.notificacao = flow.get(\"notificacao\")[i]\n\n flow.get(\"rastreio\")[i] + 1;\n\n node.send([msg]); \n}\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":180,"y":900,"wires":[["9024c307453b89df"]]},{"id":"9024c307453b89df","type":"http request","z":"0dace93f1c62e709","g":"91ea8b8ecc076fd8","name":"Site","method":"GET","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":310,"y":900,"wires":[["ae75eeea82e9e31e"]]},{"id":"996091b7f3bec5b6","type":"html","z":"0dace93f1c62e709","g":"91ea8b8ecc076fd8","name":"Status","property":"payload","outproperty":"status","tag":"#page > main > div.container.margin_30_5 > div > div > div.singlepost > ul:nth-child(3) > li:nth-child(1) > b","ret":"text","as":"single","x":610,"y":900,"wires":[["a614af9e407b0f79"]]},{"id":"a614af9e407b0f79","type":"html","z":"0dace93f1c62e709","g":"91ea8b8ecc076fd8","name":"Data","property":"payload","outproperty":"data","tag":"#page > main > div.container.margin_30_5 > div > div > div.singlepost > ul:nth-child(3) > li:nth-child(2)","ret":"text","as":"single","x":730,"y":900,"wires":[["62310de63bee4094"]]},{"id":"62310de63bee4094","type":"html","z":"0dace93f1c62e709","g":"91ea8b8ecc076fd8","name":"Local","property":"payload","outproperty":"local","tag":"#page > main > div.container.margin_30_5 > div > div > div.singlepost > ul:nth-child(3) > li:nth-child(3)","ret":"text","as":"single","x":850,"y":900,"wires":[["b517f75bbda0a73b"]]},{"id":"b517f75bbda0a73b","type":"html","z":"0dace93f1c62e709","g":"91ea8b8ecc076fd8","name":"Destino","property":"payload","outproperty":"destino","tag":"#page > main > div.container.margin_30_5 > div > div > div.singlepost > ul:nth-child(3) > li:nth-child(4)","ret":"text","as":"single","x":980,"y":900,"wires":[["030dbae2bd6af67b"]]},{"id":"02a520b2ac3ae3c6","type":"ha-api","z":"0dace93f1c62e709","g":"91ea8b8ecc076fd8","name":"","server":"db1ab0af.caa65","version":1,"debugenabled":false,"protocol":"http","method":"post","path":"/api/states/{{entity_id}}","data":"","dataType":"json","responseType":"json","outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"results"}],"x":1410,"y":900,"wires":[[]]},{"id":"0afd745cb7d74494","type":"inject","z":"0dace93f1c62e709","g":"91ea8b8ecc076fd8","name":"Atualiza de 1 em 1 min ","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"60","crontab":"","once":true,"onceDelay":"5","topic":"","payload":"","payloadType":"date","x":85,"y":900,"wires":[["1600e2e5189d4151"]],"l":false},{"id":"75f4be3092a5efd8","type":"function","z":"0dace93f1c62e709","g":"91ea8b8ecc076fd8","name":"Atualizar sensor","func":"msg.entity_id = 'sensor.correios_' + msg.rastreio.toUpperCase();\n\nmsg.payload = {\n data: {\n state: msg.status,\n attributes: {\n rastreio: msg.rastreio,\n status: msg.status,\n data: msg.data,\n notificacao: msg.notificacao,\n local: msg.local,\n destino: msg.destino,\n friendly_name: msg.nome_objeto.toUpperCase() + ' - ' + msg.rastreio.toUpperCase(),\n }\n }\n};\n\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1260,"y":900,"wires":[["02a520b2ac3ae3c6"]]},{"id":"ae75eeea82e9e31e","type":"delay","z":"0dace93f1c62e709","g":"91ea8b8ecc076fd8","name":"","pauseType":"rate","timeout":"2","timeoutUnits":"seconds","rate":"1","nbRateUnits":"3","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":460,"y":900,"wires":[["996091b7f3bec5b6"]]},{"id":"030dbae2bd6af67b","type":"function","z":"0dace93f1c62e709","g":"91ea8b8ecc076fd8","name":"!= Null","func":"if (msg.data.length === 0) {\n msg.data[0] = null;\n return [msg, null];\n}\nelse {\n return [null, msg];\n}\n","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1110,"y":900,"wires":[[],["75f4be3092a5efd8"]]},{"id":"987d968b888972f4","type":"server-state-changed","z":"0dace93f1c62e709","g":"e1c505609255ef96","name":"Aviso mudança de status","server":"db1ab0af.caa65","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sensor.correios_","entityidfiltertype":"regex","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"for":"","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":170,"y":760,"wires":[["a58efac89ff2450d"]]},{"id":"4acf0b6e86c06cff","type":"switch","z":"0dace93f1c62e709","g":"e1c505609255ef96","name":"Notificacao = Sim / Saiu para entrega","property":"data.new_state.attributes.notificacao","propertyType":"msg","rules":[{"t":"eq","v":"Sim","vt":"str"},{"t":"eq","v":"Saiu para entrega","vt":"str"},{"t":"eq","v":"Objeto entregue","vt":"str"}],"checkall":"true","repair":false,"outputs":3,"x":570,"y":760,"wires":[["40467c538ceb786a"],["8bf30de06077ee63"],["4215b6ab806a9d83"]]},{"id":"ece02265c4aba933","type":"link out","z":"0dace93f1c62e709","g":"e1c505609255ef96","name":"link out 19","mode":"link","links":["0d20d93e76ce11d7","f04403206e76f318"],"x":975,"y":720,"wires":[]},{"id":"40467c538ceb786a","type":"template","z":"0dace93f1c62e709","g":"e1c505609255ef96","name":"Todas notificações","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"📦 {{{data.new_state.attributes.friendly_name}}} \n__\n\n{{{data.new_state.attributes.status}}}\n\n{{{data.new_state.attributes.data}}}\n\n{{{data.new_state.attributes.destino}}}\n\n{{{data.new_state.attributes.local}}}\n\n\n","output":"str","x":850,"y":720,"wires":[["ece02265c4aba933"]]},{"id":"8bf30de06077ee63","type":"switch","z":"0dace93f1c62e709","g":"e1c505609255ef96","name":"= Objeto saiu para entrega ao destinatário","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"['Objeto saiu para entrega ao destinatário']","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":920,"y":760,"wires":[["93e3da0b98a668d1"]]},{"id":"93e3da0b98a668d1","type":"template","z":"0dace93f1c62e709","g":"e1c505609255ef96","name":"Saiu para entrega","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"📦 {{{data.new_state.attributes.friendly_name}}} \n__\n\n{{{data.new_state.attributes.status}}}\n\n{{{data.new_state.attributes.data}}}\n\n{{{data.new_state.attributes.destino}}}\n\n{{{data.new_state.attributes.local}}}\n\n\n","output":"str","x":1210,"y":760,"wires":[["fa556b1a46bca79e"]]},{"id":"a58efac89ff2450d","type":"function","z":"0dace93f1c62e709","g":"e1c505609255ef96","name":"!= Null","func":"if (msg.data.new_state.attributes.data.length === 0) {\n msg.data.new_state.attributes.data[0] = null;\n return [msg, null];\n}\nelse {\n return [null, msg];\n}\n","outputs":2,"noerr":0,"initialize":"","finalize":"","libs":[],"x":350,"y":760,"wires":[[],["4acf0b6e86c06cff"]]},{"id":"4215b6ab806a9d83","type":"switch","z":"0dace93f1c62e709","g":"e1c505609255ef96","name":"= Objeto entregue ao destinatário","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"['Objeto entregue ao destinatário']","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":900,"y":800,"wires":[["8382b3978128ee31"]]},{"id":"8382b3978128ee31","type":"template","z":"0dace93f1c62e709","g":"e1c505609255ef96","name":"Objeto entregue","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"📦 {{{data.new_state.attributes.friendly_name}}} \n__\n\n{{{data.new_state.attributes.status}}}\n\n{{{data.new_state.attributes.data}}}\n\n{{{data.new_state.attributes.destino}}}\n\n{{{data.new_state.attributes.local}}}\n\n\n","output":"str","x":1200,"y":800,"wires":[["deabae80d553e27d"]]},{"id":"fa556b1a46bca79e","type":"link out","z":"0dace93f1c62e709","g":"e1c505609255ef96","name":"link out 76","mode":"link","links":["0d20d93e76ce11d7","f04403206e76f318"],"x":1335,"y":760,"wires":[]},{"id":"deabae80d553e27d","type":"link out","z":"0dace93f1c62e709","g":"e1c505609255ef96","name":"link out 77","mode":"link","links":["0d20d93e76ce11d7","f04403206e76f318"],"x":1335,"y":800,"wires":[]},{"id":"db1ab0af.caa65","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}]
OBS: o código acima já esta com o nó do token, então se forem atualizar o código façam um backup do token de vocês para não precisar gerar um novo.
-
Ir em Configurações > Dispositivos > Entidades Ajudantes e criar um select com o nome de rastreio, a entidade tem que ficar input_select.correios
-
Importar o novo código do cartão:
type: vertical-stack
cards:
- type: horizontal-stack
cards:
- type: custom:mushroom-template-card
primary: Novo
badge_icon: mdi:plus
secondary: Rastreamento
icon: mdi:package-variant-closed-plus
fill_container: true
layout: horizontal
icon_color: green
tap_action:
action: fire-dom-event
browser_mod:
service: browser_mod.popup
data:
title: Adicionar Rastreio
right_button: Salvar
right_button_action:
service: input_button.press
data:
entity_id: input_button.correios_salvar
content:
type: entities
entities:
- entity: input_select.correios_notificacao
name: Deseja receber notificações?
icon: mdi:bell-ring
- entity: input_text.correios_rastreio
name: Qual o Código de Rastreamento?
icon: mdi:package-variant-closed
- entity: input_text.correios_nome_objeto
name: Qual nome do Objeto?
icon: mdi:form-textbox
card_mod:
style: |
ha-card {
--ha-card-background: white;
}
- type: custom:mushroom-template-card
primary: Excluir
secondary: Rastreamento
icon: mdi:package-variant-closed-remove
icon_color: red
badge_icon: mdi:delete
layout: horizontal
multiline_secondary: false
tap_action:
action: fire-dom-event
browser_mod:
service: browser_mod.popup
data:
title: Excluir Rastreio
right_button: Excluir
right_button_action:
service: input_button.press
data:
entity_id: input_button.correios_excluir
content:
type: entities
entities:
- entity: input_select.rastreio
name: Qual o Código de Rastreamento?
icon: mdi:package-variant-closed
card_mod:
style: |
ha-card {
height: 200px !important;
}
card_mod:
style: |
ha-card {
--ha-card-background: white;
}
- type: custom:button-card
layout: icon_name
name: Objetos Cadastrados
icon: mdi:package-variant-closed
styles:
grid:
- grid-template-areas: '"n i"'
- grid-template-columns: 1fr 20%
icon:
- align-self: end
- color: var(--text-primary-color)
- height: 35px
card:
- padding: 4px
- height: 40px
- background: var(--primary-color)
name:
- color: var(--text-primary-color)
- justify-self: start
- padding-left: 10%
- font-weight: 400
- font-size: 18px
- type: custom:auto-entities
card:
type: grid
columns: 1
square: false
card_param: cards
show_empty: false
filter:
include:
- entity_id: sensor.correios_*
options:
type: custom:mushroom-template-card
card_mod:
style: |
ha-card {
--ha-card-background: white ;
}
entity: this.entity_id
primary: '{{ state_attr(''this.entity_id'', ''friendly_name'') }}'
secondary: >-
{% if states['this.entity_id'].state == '[]' %} Objeto aguardando
postagem nos Correios. {% elif states['this.entity_id'].state ==
"[{}]" %}Sincronizando com sistema dos correios {% else
%} {{ state_attr('this.entity_id', 'status')|join()
}}
{{ state_attr('this.entity_id', 'data')|join() }}
{{ state_attr('this.entity_id', 'local')|join() }}
{{ state_attr('this.entity_id', 'destino')|join() }}
{% endif %}
icon: >-
{% if states['this.entity_id'].state == "['Objeto entregue ao
destinatário']" %} mdi:package-variant-closed-check {% elif
states['this.entity_id'].state == "['Objeto entregue ao
remetente']"%} mdi:package-variant-closed-check {% elif
states['this.entity_id'].state == "['Objeto postado']"%}
mdi:store-plus {% elif states['this.entity_id'].state == "[]"
%}mdi:package-variant-closed-remove {% elif
states['this.entity_id'].state == "[{}]" %}mdi:refresh {% elif
states['this.entity_id'].state == "['Objeto saiu para entrega ao
destinatário']" %}mdi:human-dolly {% elif
states['this.entity_id'].state == "['Objeto está em rota de
entrega']" %}mdi:human-dolly {% elif
states['this.entity_id'].state == "['Objeto recebido pelos
Correios do Brasil']" %}mdi:flag-variant {% elif
states['this.entity_id'].state == "['Objeto em trânsito - por
favor aguarde']" %}mdi:truck {% endif %}
icon_color: >-
{% if states['this.entity_id'].state == "['Objeto entregue ao
destinatário']" %}green {% elif states['this.entity_id'].state
== "[]" %}red {% elif states['this.entity_id'].state == "[{}]"
%}red {% elif states['this.entity_id'].state == "['Objeto saiu
para entrega ao destinatário']" %}orange {% elif
states['this.entity_id'].state == "['Objeto está em rota de
entrega']" %}orange {% elif states['this.entity_id'].state ==
"['Objeto entregue ao remetente']" %}black {% elif
states['this.entity_id'].state != "['Objeto entregue ao
destinatário']" %}yellow {% endif %}
multiline_secondary: true
badge_icon: >-
{% if states['this.entity_id'].state == "['Objeto entregue ao
destinatário']" %}mdi:check-bold {% elif
states['this.entity_id'].state == "['Objeto postado']"
%}mdi:share {% elif states['this.entity_id'].state == "['Objeto
entregue ao remetente']" %}mdi:share {% elif
states['this.entity_id'].state == "[]" %}mdi:alert-box {% elif
states['this.entity_id'].state == "['Objeto saiu para entrega ao
destinatário']" %}mdi:share {% elif states['this.entity_id'].state
== "['Objeto está em rota de entrega']" %}mdi:share {% elif
states['this.entity_id'].state == "['Objeto recebido pelos
Correios do Brasil']" %}mdi:map-marker {% elif
states['this.entity_id'].state == "['Objeto em trânsito - por
favor aguarde']" %}mdi:share {% endif %}
badge_color: >-
{% if states['this.entity_id'].state == "['Objeto entregue ao
destinatário']" %}green {% elif states['this.entity_id'].state ==
"['Objeto entregue ao remetente']" %}green {% elif
states['this.entity_id'].state != "['Objeto entregue ao
destinatário']" %}grey {% endif %}
tap_action:
action: more-info
order_by:
last_changed: asc
sort:
method: last_changed
count: 10
reverse: true