Récupération d'une info NR

Ok, j’etait pas sur d’avoir compris :slight_smile:
Comment je peux récupérer toutes les plages qui se succèderont dans la journée?
Faut récupérer le « topic » de chaque cron?

Au moment du déclenchement du cron, cron-plus envoie ce que tu as défini dans msg.topic. Cf. la doc :wink:
L’idée de ce que j’ai fait c’est d’y mettre l’info que tu veux et donc cet intervalle de temps.
Quand le msg.payload est à OFF, un texte libre dans le topic.
Après avec le ON, il faudra soit remettre la même chose, soit rien en filtrant en sortie pour éviter d’écraser l’info.

Comme la doc est en anglais en plus de parler de quelque chose de flou pour moi, c’est pas facile ^^

Pour moi, les deux sont pareil (topic et payload):
image

En fait je voudrais lorsque la pompe est déclenché par le cron, mettre dans un sensor « Marche » + la prochaine fois ou le cron sera déclenché (en ON).
Si la pompe est arrêté par le cron, mettre dans le sensor « Arret » + la prochaine fois ou le cron sera déclenché (en ON toujours).

Si tu regardes l’exemple que j’ai fait , c’est déjà presque ça. Pour les tests, tu réduis les périodes (ON dans 3 minutes et OFF 2 minutes plus tard par exemple, pour éviter d’attendre l’heure « réelle ») et tu testes.
Tester et comprendre, c’est la base du truc.
Tu veux faire quelque chose de pas si simple que ça. Commence par bien comprendre « comment ça marche » (ce qui sort du cron-plus n’est pas le même quand le cron s’exécute et quand on lui envoie un ordre de lister les programmations).

Bon j’avance tout doucement:


J’arrive a a voir mes ON ou OFF en sortie et donc commander la pompe.
J’ai ajouté dans le topic les séquence de filtration, comme ça je doit pouvoir récupérer l’info (pas testé encore):
image

J’ai un doute pour lancer le clean du cron lorsque je sélectionne le mode manuel du système.

Je ne sais pas trop de quel noeud vient la copie d’écran…
Mais, dans le « add » de cron-plus, tu peux y mettre le topic. C’est ce que j’ai fait dans mon exemple.

Je ne comprends pas… C’est quoi le mode manuel?

Oui je prends ton exemple :slight_smile:
image
image
C’est cohérant? Je suis peut-être pas obligé de mettre le node switch pour que le mqtt récupère le contenu du msg.topic ?

Quand je force ma pompe piscine a tourner, je veux pas que les cron continue de tourner derrière je veux les stopper et les réactiver que si je passe en auto.
image
Auto: le cron gère la filtration en fonction de la température relevé le matin.
Marche forcée: La simple commande d’allumage de la pompe.
Arrêt: La simple commande d’arrêt de la pompe.

Soit tu répètes le « topic » dans tous les programmations de cron (les ON et les OFF) avec ce que tu veux et pas de switch. Si tu mets un truc seulement dans le OFF, alors il faut un switch pour éviter que ça couine…

Ah. Il faut envoyer à cron-plus les « bons » messages pour suspendre et activer les programmations:

Full flexibility & dynamic control.
Ability to control via simple topic commands. Examples include...
remove, remove-all, remove-all-dynamic, remove-all-static, remove-active, remove-active-dynamic, remove-active-static, remove-inactive, remove-inactive-dynamic, remove-inactive-static
list, list-all, list-all-dynamic, list-all-static, list-active, list-active-dynamic, list-active-static, list-inactive, list-inactive-dynamic, list-inactive-static
export, export-all, export-all-dynamic, export-all-static, export-active, export-active-dynamic, export-active-static, export-inactive, export-inactive-dynamic, export-inactive-static
stop, stop-all, stop-all-dynamic, stop-all-static
start, start-all, start-all-dynamic, start-all-static
pause, pause-all, pause-all-dynamic, pause-all-static

Donc pause-all-dynamic et start-all-dynamic.

J’ai fait ça:

[{"id":"16cfb053aafc192c","type":"tab","label":"Flow 3","disabled":false,"info":"","env":[]},{"id":"05eb18ce0cc03ea0","type":"inject","z":"16cfb053aafc192c","name":"Liste","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"list-all","payload":"","payloadType":"date","x":910,"y":660,"wires":[["fac2cd859bcaac97"]]},{"id":"7a6624adb54763cb","type":"cronplus","z":"16cfb053aafc192c","name":"Clean","outputField":"payload","timeZone":"","persistDynamic":false,"commandResponseMsgOutput":"output1","outputs":1,"options":[{"name":"Reset","topic":"remove-all-dynamic","payloadType":"default","payload":"","expressionType":"cron","expression":"0 0 0 * * * *","location":"","offset":"0","solarType":"all","solarEvents":"sunrise,sunset"}],"x":910,"y":700,"wires":[["fac2cd859bcaac97"]]},{"id":"fac2cd859bcaac97","type":"cronplus","z":"16cfb053aafc192c","name":"","outputField":"payload","timeZone":"","persistDynamic":false,"commandResponseMsgOutput":"output1","outputs":1,"options":[],"x":1140,"y":420,"wires":[["2dee0e22b1000514","66d84ffefe91765c"]]},{"id":"73f6d81d4df279a9","type":"change","z":"16cfb053aafc192c","name":"=< 15","rules":[{"t":"set","p":"payload","pt":"msg","to":"[{\"command\":\"add\",\"name\":\"8:00\",\"expression\":\"0 0 8 * * * *\",\"payload\":\"ON\",\"type\":\"str\",\"topic\":\"8:00 - 9:00\",\"limit\":1},{\"command\":\"add\",\"name\":\"9:00\",\"expression\":\"0 0 9 * * * *\",\"payload\":\"OFF\",\"type\":\"str\",\"topic\":\"8:00 - 9:00\",\"limit\":1},{\"command\":\"add\",\"name\":\"19:00\",\"expression\":\"0 0 19 * * * *\",\"payload\":\"ON\",\"type\":\"str\",\"topic\":\"19:00 - 20:00\",\"limit\":1},{\"command\":\"add\",\"name\":\"20:00\",\"expression\":\"0 0 20 * * * *\",\"payload\":\"OFF\",\"type\":\"str\",\"topic\":\"19:00 - 20:00\",\"limit\":1}]","tot":"json"},{"t":"set","p":"topic","pt":"msg","to":"8h-9h/19h-20h","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":910,"y":320,"wires":[["fac2cd859bcaac97"]]},{"id":"7f028a50b936a8ff","type":"mqtt in","z":"16cfb053aafc192c","name":"Re-emit temp from 6h00","topic":"IPX/Piscine/Sonde_Piscine_6h","qos":"2","datatype":"auto","broker":"5fe63a5b.9fa6a4","inputs":0,"x":130,"y":320,"wires":[["a192c3b090988f2f"]]},{"id":"10d3e6e5a2096f0e","type":"switch","z":"16cfb053aafc192c","name":"","property":"temp","propertyType":"msg","rules":[{"t":"lte","v":"15","vt":"num"},{"t":"btwn","v":"16","vt":"num","v2":"20","v2t":"num"},{"t":"btwn","v":"21","vt":"num","v2":"25","v2t":"num"},{"t":"btwn","v":"25","vt":"num","v2":"32","v2t":"num"}],"checkall":"false","repair":false,"outputs":4,"x":490,"y":400,"wires":[["37578be18733f294"],["a5c7a0c299a72888"],["a5c7a0c299a72888"],["a5c7a0c299a72888"]]},{"id":"e6a506623a30e6b4","type":"api-current-state","z":"16cfb053aafc192c","name":"Filtration Auto","server":"445917a3.8e3978","version":3,"outputs":2,"halt_if":"on","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_boolean.filter_pool_auto","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"dummy","propertyType":"msg","value":"","valueType":"entityState"},{"property":"dummy_entity","propertyType":"msg","value":"","valueType":"entity"}],"for":0,"forType":"num","forUnits":"minutes","x":320,"y":400,"wires":[["10d3e6e5a2096f0e"],[]]},{"id":"a192c3b090988f2f","type":"change","z":"16cfb053aafc192c","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"temp","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":320,"wires":[["e6a506623a30e6b4"]]},{"id":"25c4f4d101d6b120","type":"inject","z":"16cfb053aafc192c","name":"test tempé 9","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"9","payloadType":"num","x":110,"y":60,"wires":[["c55083ec4f17ac21"]]},{"id":"f0e078a6684993cb","type":"change","z":"16cfb053aafc192c","name":"> 30","rules":[{"t":"set","p":"payload","pt":"msg","to":"[{\"command\":\"add\",\"name\":\"7:00\",\"expression\":\"0 0 7 * * * *\",\"payload\":\"ON\",\"type\":\"str\",\"limit\":1},{\"command\":\"add\",\"name\":\"00:00\",\"expression\":\"0 0 00 * * * *\",\"payload\":\"OFF\",\"type\":\"str\",\"topic\":\"7:00 - 00:00\",\"limit\":1}]","tot":"json"},{"t":"set","p":"topic","pt":"msg","to":"7h-00h","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":910,"y":480,"wires":[["fac2cd859bcaac97"]]},{"id":"faf0e4e4331511e0","type":"change","z":"16cfb053aafc192c","name":"25 à 30","rules":[{"t":"set","p":"payload","pt":"msg","to":"[{\"command\":\"add\",\"name\":\"3:00\",\"expression\":\"0 0 3 * * * *\",\"payload\":\"ON\",\"type\":\"str\",\"limit\":1},{\"command\":\"add\",\"name\":\"13:00\",\"expression\":\"0 0 13 * * * *\",\"payload\":\"OFF\",\"type\":\"str\",\"topic\":\"3:00 - 13:00\",\"limit\":1},{\"command\":\"add\",\"name\":\"14:00\",\"expression\":\"0 0 14 * * * *\",\"payload\":\"ON\",\"type\":\"str\",\"limit\":1},{\"command\":\"add\",\"name\":\"00:00\",\"expression\":\"0 0 00 * * * *\",\"payload\":\"OFF\",\"type\":\"str\",\"topic\":\"14:00 - 00:00\",\"limit\":1}]","tot":"json"},{"t":"set","p":"topic","pt":"msg","to":"3h-13h/14h-00h","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":920,"y":440,"wires":[["fac2cd859bcaac97"]]},{"id":"bf1966d0171a8f40","type":"change","z":"16cfb053aafc192c","name":"20 à 25","rules":[{"t":"set","p":"payload","pt":"msg","to":"[{\"command\":\"add\",\"name\":\"6:00\",\"expression\":\"0 0 6 * * * *\",\"payload\":\"ON\",\"type\":\"str\",\"topic\":\"6:00 - 9:00\",\"limit\":1},{\"command\":\"add\",\"name\":\"9:00\",\"expression\":\"0 0 9 * * * *\",\"payload\":\"OFF\",\"type\":\"str\",\"topic\":\"6:00 - 9:00\",\"limit\":1},{\"command\":\"add\",\"name\":\"11:00\",\"expression\":\"0 0 11 * * * *\",\"payload\":\"ON\",\"type\":\"str\",\"limit\":1},{\"command\":\"add\",\"name\":\"14:00\",\"expression\":\"0 0 14 * * * *\",\"payload\":\"OFF\",\"type\":\"str\",\"topic\":\"11:00 - 14:00\",\"limit\":1},{\"command\":\"add\",\"name\":\"16:00\",\"expression\":\"0 0 16 * * * *\",\"payload\":\"ON\",\"type\":\"str\",\"limit\":1},{\"command\":\"add\",\"name\":\"19:00\",\"expression\":\"0 0 19 * * * *\",\"payload\":\"OFF\",\"type\":\"str\",\"topic\":\"16:00 - 19:00\",\"limit\":1},{\"command\":\"add\",\"name\":\"21:00\",\"expression\":\"0 0 21 * * * *\",\"payload\":\"ON\",\"type\":\"str\",\"limit\":1},{\"command\":\"add\",\"name\":\"00:00\",\"expression\":\"0 0 00 * * * *\",\"payload\":\"OFF\",\"type\":\"str\",\"topic\":\"21:00 - 00:00\",\"limit\":1}]","tot":"json"},{"t":"set","p":"topic","pt":"msg","to":"6h-9h/11h-14h/16h-19h/21h-00h","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":920,"y":400,"wires":[["fac2cd859bcaac97"]]},{"id":"c6e27ae51d488d20","type":"change","z":"16cfb053aafc192c","name":"15 à 20","rules":[{"t":"set","p":"payload","pt":"msg","to":"[{\"command\":\"add\",\"name\":\"9:00\",\"expression\":\"0 0 9 * * * *\",\"payload\":\"ON\",\"type\":\"str\",\"topic\":\"9:00 - 11:00\",\"limit\":1},{\"command\":\"add\",\"name\":\"11:00\",\"expression\":\"0 0 11 * * * *\",\"payload\":\"OFF\",\"type\":\"str\",\"topic\":\"9:00 - 11:00\",\"limit\":1},{\"command\":\"add\",\"name\":\"14:00\",\"expression\":\"0 0 14 * * * *\",\"payload\":\"ON\",\"type\":\"str\",\"limit\":1},{\"command\":\"add\",\"name\":\"17:00\",\"expression\":\"0 0 17 * * * *\",\"payload\":\"OFF\",\"type\":\"str\",\"topic\":\"14:00 - 17:00\",\"limit\":1},{\"command\":\"add\",\"name\":\"20:00\",\"expression\":\"0 0 20 * * * *\",\"payload\":\"ON\",\"type\":\"str\",\"limit\":1},{\"command\":\"add\",\"name\":\"23:00\",\"expression\":\"0 0 23 * * * *\",\"payload\":\"OFF\",\"type\":\"str\",\"topic\":\"20:00 - 23:00\",\"limit\":1}]","tot":"json"},{"t":"set","p":"topic","pt":"msg","to":"9h-11/14h-17h/20h-23h","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":920,"y":360,"wires":[["fac2cd859bcaac97"]]},{"id":"effee7f10ff37261","type":"http request","z":"16cfb053aafc192c","name":"Filtration OFF","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://192.168.1.73/api/xdevices.json?key=apikey&ClearR=01","tls":"","persist":false,"proxy":"","authType":"basic","x":1460,"y":540,"wires":[[]]},{"id":"2dee0e22b1000514","type":"switch","z":"16cfb053aafc192c","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"ON","vt":"str"},{"t":"eq","v":"OFF","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":1290,"y":520,"wires":[["22262c32d47d1855"],["22262c32d47d1855"]]},{"id":"60b4c0c9fc1be9e6","type":"http request","z":"16cfb053aafc192c","name":"Filtration ON","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://192.168.1.73/api/xdevices.json?key=apikey&SetR=01","tls":"","persist":false,"proxy":"","authType":"basic","x":1450,"y":500,"wires":[[]]},{"id":"96cd42bd08277fb5","type":"inject","z":"16cfb053aafc192c","name":"test tempé 17","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"17","payloadType":"num","x":110,"y":100,"wires":[["c55083ec4f17ac21"]]},{"id":"67197478998e8019","type":"inject","z":"16cfb053aafc192c","name":"test tempé 23","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"23","payloadType":"num","x":110,"y":140,"wires":[["c55083ec4f17ac21"]]},{"id":"98dbd2b23737d0d9","type":"inject","z":"16cfb053aafc192c","name":"test tempé 27","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"27","payloadType":"num","x":110,"y":180,"wires":[["c55083ec4f17ac21"]]},{"id":"c53dfd6a53e67b86","type":"inject","z":"16cfb053aafc192c","name":"test tempé 31","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"31","payloadType":"num","x":110,"y":220,"wires":[["c55083ec4f17ac21"]]},{"id":"37578be18733f294","type":"api-call-service","z":"16cfb053aafc192c","name":"Hivernage On","server":"445917a3.8e3978","version":5,"debugenabled":false,"domain":"input_boolean","service":"turn_on","areaId":[],"deviceId":[],"entityId":["input_boolean.winter_pool"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":660,"y":360,"wires":[["73f6d81d4df279a9"]]},{"id":"a5c7a0c299a72888","type":"api-call-service","z":"16cfb053aafc192c","name":"Hivernage Off","server":"445917a3.8e3978","version":5,"debugenabled":false,"domain":"input_boolean","service":"turn_off","areaId":[],"deviceId":[],"entityId":["input_boolean.winter_pool"],"data":"","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":660,"y":440,"wires":[["c6e27ae51d488d20","bf1966d0171a8f40","faf0e4e4331511e0","f0e078a6684993cb","7d75f1f22b852681"]]},{"id":"e73527e186ab2112","type":"inject","z":"16cfb053aafc192c","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"55 05 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":110,"y":260,"wires":[["dfe2ca3c3de9f647"]]},{"id":"49f54fb15342219f","type":"json","z":"16cfb053aafc192c","name":"","property":"payload","action":"","pretty":false,"x":470,"y":260,"wires":[["32f4a84e0c233707"]]},{"id":"dfe2ca3c3de9f647","type":"http request","z":"16cfb053aafc192c","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"http://192.168.1.73/api/xdevices.json?key=apikey&Get=A","tls":"","persist":false,"proxy":"","authType":"","x":310,"y":260,"wires":[["49f54fb15342219f"]]},{"id":"32f4a84e0c233707","type":"function","z":"16cfb053aafc192c","name":"","func":"var value = msg.payload.A1;\nmsg.temp = parseFloat((((value*0.000050354)-0.25)/0.028).toFixed(2));\nmsg.payload = msg.temp;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":620,"y":260,"wires":[["c55083ec4f17ac21","a192c3b090988f2f"]]},{"id":"c55083ec4f17ac21","type":"mqtt out","z":"16cfb053aafc192c","name":"temp à 5h55","topic":"IPX/Piscine/Sonde_Piscine_6h","qos":"1","retain":"true","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"5fe63a5b.9fa6a4","x":810,"y":140,"wires":[]},{"id":"e0901a2e9144536e","type":"server-state-changed","z":"16cfb053aafc192c","name":"Select filtration","server":"445917a3.8e3978","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"input_select.pool_pump","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":100,"y":540,"wires":[[]]},{"id":"9de77aca1288b19c","type":"switch","z":"16cfb053aafc192c","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Auto","vt":"str"},{"t":"eq","v":"Marche forcée","vt":"str"},{"t":"eq","v":"Arrêt","vt":"str"}],"checkall":"false","repair":false,"outputs":3,"x":290,"y":540,"wires":[["c92b3041a25be356"],["af77a43c791c2378"],["58ab8095396ba01f"]]},{"id":"58ab8095396ba01f","type":"change","z":"16cfb053aafc192c","name":"Change Arret => off","rules":[{"t":"change","p":"payload","pt":"msg","from":"Arrêt","fromt":"str","to":"OFF","tot":"str"},{"t":"set","p":"state","pt":"msg","to":"Arrêt forcé","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":580,"wires":[["339a414641877018","b1b3ce3fbde59f65","0a623d9a2e3759ed"]]},{"id":"c92b3041a25be356","type":"change","z":"16cfb053aafc192c","name":"Change auto => on","rules":[{"t":"change","p":"payload","pt":"msg","from":"Auto","fromt":"str","to":"ON","tot":"str"},{"t":"set","p":"state","pt":"msg","to":"Auto","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":470,"y":500,"wires":[["dfe2ca3c3de9f647","4db1d9109faf6d6a"]]},{"id":"af77a43c791c2378","type":"change","z":"16cfb053aafc192c","name":"Change Marche forcée => on","rules":[{"t":"change","p":"payload","pt":"msg","from":"Marche forcée","fromt":"str","to":"ON","tot":"str"},{"t":"set","p":"state","pt":"msg","to":"Marche forcée","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":500,"y":540,"wires":[["339a414641877018","ae005bfe0d425c10","f5d5cf85f57f78e5"]]},{"id":"7d75f1f22b852681","type":"change","z":"16cfb053aafc192c","name":"TEST","rules":[{"t":"set","p":"payload","pt":"msg","to":"[{\"command\":\"add\",\"name\":\"TEST_ON\",\"expression\":\"0 39 17 * * * *\",\"payload\":\"ON\",\"type\":\"str\",\"topic\":\"TEST\",\"limit\":1},{\"command\":\"add\",\"name\":\"TEST_OFF\",\"expression\":\"0 40 17 * * * *\",\"payload\":\"OFF\",\"type\":\"str\",\"topic\":\"TEST\",\"limit\":1}]","tot":"json"},{"t":"set","p":"topic","pt":"msg","to":"TEST","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":910,"y":520,"wires":[["fac2cd859bcaac97"]]},{"id":"f0f97136debab7f6","type":"inject","z":"16cfb053aafc192c","name":"TEST","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"32","payloadType":"num","x":90,"y":380,"wires":[["a192c3b090988f2f"]]},{"id":"de05989df0d65e2a","type":"mqtt out","z":"16cfb053aafc192c","name":"Cycles de la journée","topic":"IPX/Piscine/day_cycles","qos":"1","retain":"true","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"5fe63a5b.9fa6a4","x":1500,"y":380,"wires":[]},{"id":"3fdeb2331312465a","type":"switch","z":"16cfb053aafc192c","name":"","property":"state","propertyType":"msg","rules":[{"t":"nnull"}],"checkall":"true","repair":false,"outputs":1,"x":1290,"y":320,"wires":[["037dd4148fb53aa9","26ab8097f2d575dd"]]},{"id":"d631f03bf841cea9","type":"inject","z":"16cfb053aafc192c","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"55 05 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"Arrêt","payloadType":"str","x":90,"y":620,"wires":[["9de77aca1288b19c"]]},{"id":"7f838d4ed013590d","type":"inject","z":"16cfb053aafc192c","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"55 05 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"Auto","payloadType":"str","x":90,"y":580,"wires":[["9de77aca1288b19c"]]},{"id":"0788ab4f952ce6b9","type":"inject","z":"16cfb053aafc192c","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"55 05 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"Marche forcée","payloadType":"str","x":120,"y":660,"wires":[["9de77aca1288b19c"]]},{"id":"22262c32d47d1855","type":"debug","z":"16cfb053aafc192c","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1440,"y":460,"wires":[]},{"id":"339a414641877018","type":"change","z":"16cfb053aafc192c","name":"Reset Cron","rules":[{"t":"set","p":"payload","pt":"msg","to":"{\"command\":\"remove-all-dynamic\"}","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":730,"y":620,"wires":[["fac2cd859bcaac97"]]},{"id":"037dd4148fb53aa9","type":"debug","z":"16cfb053aafc192c","name":"debug 2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"state","targetType":"msg","statusVal":"","statusType":"auto","x":1480,"y":120,"wires":[]},{"id":"4db1d9109faf6d6a","type":"link out","z":"16cfb053aafc192c","name":"link out 1","mode":"link","links":["9c4b64683e975a2c"],"x":675,"y":500,"wires":[]},{"id":"ae005bfe0d425c10","type":"link out","z":"16cfb053aafc192c","name":"link out 2","mode":"link","links":["f46226fc3866ce8e"],"x":675,"y":540,"wires":[]},{"id":"f5d5cf85f57f78e5","type":"link out","z":"16cfb053aafc192c","name":"link out 3","mode":"link","links":["ec5f7a55819bf8dd"],"x":675,"y":580,"wires":[]},{"id":"9c4b64683e975a2c","type":"link in","z":"16cfb053aafc192c","name":"link in 1","links":["4db1d9109faf6d6a"],"x":1155,"y":280,"wires":[["3fdeb2331312465a"]]},{"id":"f46226fc3866ce8e","type":"link in","z":"16cfb053aafc192c","name":"link in 2","links":["ae005bfe0d425c10"],"x":1155,"y":320,"wires":[["3fdeb2331312465a"]]},{"id":"5863fdaff03e5b3b","type":"link in","z":"16cfb053aafc192c","name":"link in 3","links":["b1b3ce3fbde59f65"],"x":1155,"y":360,"wires":[["3fdeb2331312465a"]]},{"id":"21531736cdbd62e3","type":"link in","z":"16cfb053aafc192c","name":"link in 4","links":["0a623d9a2e3759ed"],"x":1155,"y":540,"wires":[["2dee0e22b1000514"]]},{"id":"ec5f7a55819bf8dd","type":"link in","z":"16cfb053aafc192c","name":"link in 5","links":["f5d5cf85f57f78e5"],"x":1155,"y":500,"wires":[["2dee0e22b1000514"]]},{"id":"b1b3ce3fbde59f65","type":"link out","z":"16cfb053aafc192c","name":"link out 4","mode":"link","links":["5863fdaff03e5b3b"],"x":675,"y":700,"wires":[]},{"id":"0a623d9a2e3759ed","type":"link out","z":"16cfb053aafc192c","name":"link out 5","mode":"link","links":["21531736cdbd62e3"],"x":675,"y":660,"wires":[]},{"id":"26ab8097f2d575dd","type":"mqtt out","z":"16cfb053aafc192c","name":"Mode de la pompe","topic":"IPX/Piscine/pump_mode","qos":"1","retain":"true","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"5fe63a5b.9fa6a4","x":1490,"y":300,"wires":[]},{"id":"66d84ffefe91765c","type":"switch","z":"16cfb053aafc192c","name":"","property":"topic","propertyType":"msg","rules":[{"t":"nnull"}],"checkall":"true","repair":false,"outputs":1,"x":1290,"y":380,"wires":[["de05989df0d65e2a","5d6de9d6bc819421"]]},{"id":"5d6de9d6bc819421","type":"debug","z":"16cfb053aafc192c","name":"debug 3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"topic","targetType":"msg","statusVal":"","statusType":"auto","x":1480,"y":160,"wires":[]},{"id":"5fe63a5b.9fa6a4","type":"mqtt-broker","name":"MQTT","broker":"192.168.1.70","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"445917a3.8e3978","type":"server","name":"Home Assistant","version":2,"addon":false,"rejectUnauthorizedCerts":false,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30}]

Tu peux jeter un œil quand tu as 5 min voir si c’est logique/optimisé ?

Dans l’ensemble, ça me semble OK. En ordre d’importance:

  1. Un truc qui (je pense) ne va pas marcher:
    Screenshot 2022-07-21 at 18.57.44
    Tu testes si le topic existe et tu envoies msg.payload au noeud mqtt. Je suppose que c’est le topic que tu veux. Donc, il faut un noeud change pour mettre « topic » dans « payload »

  2. Le set msg.topic est inutile.

Dans le msg.payload tu as déjà "topic": "TEST. Pas besoin de le faire deux fois. Et je n’ai jamais testé ce que ça fait à cron-plus…

  1. Le noeud switch qui suit :

Tu sais déjà qu’en haut c’est ON et en bas OFF. Tu peux éviter le switch.

  1. le noeud function qui contient:

parseFloat((((value*0.000050354)-0.25)/0.028).toFixed(2));

peut (avantageusement ?) être remplacé par un noeud change et du jsonata (le truc qui commence par un genre de S:):

Ca:

$round(((payload.A1 * 0.000050354)-0.25)/0.028),2)

Le ? après avantageusement:

  • une fonction c’est un tantinet moins efficace qu’un change
  • le jsonata c’est pas forcément trivial

Mais, c’est une bonne habitude d’essayer d’éviter les fonctions.

C’est bien topic dans le switch:
image

Corrigé, en effet ^^

Pas compris là :slight_smile:

Comme ça:
image
?

C’est ça qui est important… Dans le switch, tu vérifies le topic (ok) mais dans le mqtt tu envoies le payload (pas ok). Tu veux envoyer ce qui est dans le topic si je ne me trompe pas. Donc, il faut copier topic dans payload avec un change node.

Ce n’est pas $ le format mais une espèce de S: (c’est ça qui dit ue c’est du jsonata).

Ok, c’est fait :slight_smile:

J’ai ça:

Expression. Si tu es matheux, c’est un genre de signe intégrale…

Je suis en rouge avec Expression:
image

Ca veut dire que la syntaxe n’est pas correcte… Pour tester aller sur try.jsonata.org et docs.jsonata.org pour comprendre.

Pas:

Mais:
$round((((payload.A1 * 0.000050354)-0.25)/0.028),2)

Une parenthèse ouvrante de plus.

Ah yes c’est ok!
Cela semble bien fonctionner, je met en prod aujourd’hui.
Merci beaucoup pour ton aide!!