Bonsoir,
J’utilise cette syntaxe pour une notify sur mon portable :
{"message":"{{payload}}"}
Dans un autre cas je le fait comme ça avec une variable :
var datejour = global.get('datejour');
var dateexpir = global.get('dateexpir');
var tempsval = dateexpir - datejour;
tempsval = ((tempsval /3600) /24);
tempsval = parseFloat(tempsval).toFixed(0);
msg.payload = Number(tempsval);
global.set('datenewexpir', msg.payload);
return msg;
Je mets le flow complet
[{"id":"1c21385eb72b028f","type":"tab","label":"Certificat","disabled":false,"info":"","env":[]},{"id":"cba922d97d245edc","type":"debug","z":"1c21385eb72b028f","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":990,"y":60,"wires":[]},{"id":"f2b9ad5c95cf94bf","type":"api-current-state","z":"1c21385eb72b028f","name":"Expiration certificat","server":"443ff1c5.63d78","version":3,"outputs":1,"halt_if":"","halt_if_type":"str","halt_if_compare":"is","entity_id":"sensor.cert_expiry_timestamp_mondomaine_fr","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","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":410,"y":60,"wires":[["642f1eec7ca4c701"]]},{"id":"9b1e1efe9b9c8efa","type":"ui_date_picker","z":"1c21385eb72b028f","name":"","label":"date","group":"7581546f.42c224","order":2,"width":0,"height":0,"passthru":true,"topic":"topic","topicType":"msg","className":"","x":370,"y":180,"wires":[["ccc10d5dde56fc26"]]},{"id":"642f1eec7ca4c701","type":"function","z":"1c21385eb72b028f","name":"Expir","func":"msg.payload = msg.payload.substring(0,msg.payload.length -15);\nmsg.payload = Date.parse(msg.payload) /1000;\nglobal.set('dateexpir', msg.payload);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":630,"y":60,"wires":[["cba922d97d245edc","403ea73e67190e45"]]},{"id":"1cd3b498c4ccc80a","type":"debug","z":"1c21385eb72b028f","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":990,"y":180,"wires":[]},{"id":"ccc10d5dde56fc26","type":"function","z":"1c21385eb72b028f","name":"Jour","func":"msg.payload = msg.payload /1000 ;\nmsg.payload = parseFloat(msg.payload).toFixed(0);\nmsg.payload = Number(msg.payload);\nglobal.set('datejour', msg.payload);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":630,"y":180,"wires":[["1cd3b498c4ccc80a"]]},{"id":"403ea73e67190e45","type":"function","z":"1c21385eb72b028f","name":"DiffDate","func":"var datejour = global.get('datejour');\nvar dateexpir = global.get('dateexpir');\nvar tempsval = dateexpir - datejour;\ntempsval = ((tempsval /3600) /24);\ntempsval = parseFloat(tempsval).toFixed(0);\nmsg.payload = Number(tempsval);\nglobal.set('datenewexpir', msg.payload);\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":380,"y":280,"wires":[["0cb5cb5bc50ed3d6","98e564e8e0240c5d"]]},{"id":"0cb5cb5bc50ed3d6","type":"debug","z":"1c21385eb72b028f","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":990,"y":400,"wires":[]},{"id":"98e564e8e0240c5d","type":"switch","z":"1c21385eb72b028f","name":"","property":"payload","propertyType":"msg","rules":[{"t":"lte","v":"3","vt":"str"},{"t":"gte","v":"85","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":630,"y":280,"wires":[["d35cac400d66e9f6","078994a9ad5dc476"],["ade0b09dc5933592"]]},{"id":"d35cac400d66e9f6","type":"api-call-service","z":"1c21385eb72b028f","name":"","server":"443ff1c5.63d78","version":5,"debugenabled":false,"domain":"script","service":"renouvellement_certificat","areaId":[],"deviceId":[],"entityId":[],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":930,"y":280,"wires":[[]]},{"id":"31743c2828fef00c","type":"inject","z":"1c21385eb72b028f","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"date","x":100,"y":60,"wires":[["f2b9ad5c95cf94bf","9b1e1efe9b9c8efa"]]},{"id":"031da89e7b5514d5","type":"server-state-changed","z":"1c21385eb72b028f","name":"Couché Soleil + 2 Min","server":"443ff1c5.63d78","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sun.sun","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"below_horizon","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"2","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"date"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":120,"y":200,"wires":[["f2b9ad5c95cf94bf","9b1e1efe9b9c8efa"],[]]},{"id":"078994a9ad5dc476","type":"debug","z":"1c21385eb72b028f","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":990,"y":340,"wires":[]},{"id":"ade0b09dc5933592","type":"delay","z":"1c21385eb72b028f","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":480,"y":460,"wires":[["f29b6c0e74abdea6"]]},{"id":"92d9500488e8c070","type":"api-call-service","z":"1c21385eb72b028f","name":"","server":"443ff1c5.63d78","version":5,"debugenabled":false,"domain":"notify","service":"mobile_app_iphone_de_bob","areaId":[],"deviceId":[],"entityId":[],"data":"{\"message\":\"{{payload}}\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":940,"y":460,"wires":[[]]},{"id":"92a7bfa1e1960cd0","type":"server-state-changed","z":"1c21385eb72b028f","name":"Couché Soleil + 7 Min","server":"443ff1c5.63d78","version":4,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"sun.sun","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"below_horizon","halt_if_type":"str","halt_if_compare":"is","outputs":2,"output_only_on_state_change":true,"for":"7","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"date"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":120,"y":280,"wires":[["f2b9ad5c95cf94bf","9b1e1efe9b9c8efa"],[]]},{"id":"f29b6c0e74abdea6","type":"change","z":"1c21385eb72b028f","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"Certificat renouvellé pour xxx jours","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"xxx","fromt":"str","to":"datenewexpir","tot":"global"}],"action":"","property":"","from":"","to":"","reg":false,"x":660,"y":460,"wires":[["92d9500488e8c070","36299ebc5fe3f69f"]]},{"id":"36299ebc5fe3f69f","type":"debug","z":"1c21385eb72b028f","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":990,"y":540,"wires":[]},{"id":"443ff1c5.63d78","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30},{"id":"7581546f.42c224","type":"ui_group","name":"Utilities","tab":"a577685a.d0bd48","order":3,"disp":true,"width":"6","collapse":false},{"id":"a577685a.d0bd48","type":"ui_tab","name":"Arbeitszimmer","icon":"dashboard","order":3}]
Bob