so i trying to make a keep live poll for another program i use
so it will send a MQTT yes every 10 min and when it sends it will then convert it to HA will see it as Connected… but if say after 50 min of not getting a Yes it will report its Offline… now the problem i having is at the point of the function the Trigger supposed to push 1 which it does but the function supposed to keep Adding it but its only receiving 1… its not +1 ive tried a few different ways… i tried my own i tried googling… so im stuck… here is the code
[{"id":"2eb58b0cb0c5ddd3","type":"trigger","z":"feb1b184abb55693","name":"Poll Every 10 min","op1":"1","op2":"0","op1type":"num","op2type":"str","duration":"-3","extend":false,"overrideDelay":false,"units":"s","reset":"stop","bytopic":"all","topic":"topic","outputs":1,"x":530,"y":1380,"wires":[["4371eea2659fb928"]]},{"id":"84a3c30b1ee4f3eb","type":"mqtt in","z":"feb1b184abb55693","name":"MQTT \"callerid/alive\"","topic":"alive","qos":"2","datatype":"auto-detect","broker":"12cbc2886c19b10a","nl":false,"rap":true,"rh":0,"inputs":0,"x":90,"y":1380,"wires":[["12fd9632d5a356c7"]]},{"id":"12fd9632d5a356c7","type":"ha-sensor","z":"feb1b184abb55693","name":"Callattendant Still Alive ","entityConfig":"645169a671b306dd","version":0,"state":"payload","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":300,"y":1380,"wires":[["f73dda6eb261e5f9","2eb58b0cb0c5ddd3"]]},{"id":"f73dda6eb261e5f9","type":"switch","z":"feb1b184abb55693","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Yes","vt":"str"},{"t":"neq","v":"Yes","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":450,"y":1300,"wires":[["3adcaa432fd5e7e1"],[]]},{"id":"3adcaa432fd5e7e1","type":"change","z":"feb1b184abb55693","name":"Set To 0 If MQTT Msg Is Yes","rules":[{"t":"set","p":"payload","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":1300,"wires":[["4371eea2659fb928"]]},{"id":"4371eea2659fb928","type":"function","z":"feb1b184abb55693","name":"function 4","func":"var value = value + msg.payload\n//value = value +1;\nmsg.payload = msg.payload + 1;\n\nmsg.value = value;\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":720,"y":1380,"wires":[["028ff549a780bfc7","4e7eb63c8f455a47"]]},{"id":"4e7eb63c8f455a47","type":"debug","z":"feb1b184abb55693","name":"debug 25","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":940,"y":1340,"wires":[]},{"id":"186cd3be6bfce81c","type":"inject","z":"feb1b184abb55693","name":"Yes","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Yes","payloadType":"str","x":90,"y":1480,"wires":[["12fd9632d5a356c7"]]},{"id":"028ff549a780bfc7","type":"switch","z":"feb1b184abb55693","name":"","property":"value","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"gt","v":"5","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":750,"y":1440,"wires":[["4b7e7b663e31bb09","4e7eb63c8f455a47"],["fe8e06f7c086e424","4e7eb63c8f455a47"]]},{"id":"4b7e7b663e31bb09","type":"change","z":"feb1b184abb55693","name":"Set Connected","rules":[{"t":"set","p":"payload","pt":"msg","to":"Connected","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":940,"y":1420,"wires":[["eaf9054c35ddae85"]]},{"id":"fe8e06f7c086e424","type":"change","z":"feb1b184abb55693","name":"Set Offline","rules":[{"t":"set","p":"payload","pt":"msg","to":"Offline","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":930,"y":1460,"wires":[["eaf9054c35ddae85"]]},{"id":"eaf9054c35ddae85","type":"ha-sensor","z":"feb1b184abb55693","name":"Callattendant Status","entityConfig":"645169a671b306dd","version":0,"state":"payload","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":1160,"y":1420,"wires":[["4e7eb63c8f455a47"]]},{"id":"7dac54c00df1c86c","type":"inject","z":"feb1b184abb55693","name":"No","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"No","payloadType":"str","x":90,"y":1540,"wires":[["12fd9632d5a356c7"]]},{"id":"12cbc2886c19b10a","type":"mqtt-broker","name":"home assistant server","broker":"192.168.0.12","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"3","keepalive":"60","cleansession":true,"autoUnsubscribe":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""},{"id":"645169a671b306dd","type":"ha-entity-config","server":"915baa48.9b1898","deviceConfig":"","name":"Callattendant Status","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"Callattendant Status"},{"property":"icon","value":""},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":""},{"property":"unit_of_measurement","value":""},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"915baa48.9b1898","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}]
i tried changing the payloads… to msg.value on the trigger node and function but i get nan… as i figured maybe the payload is conflicting here is that code
[{"id":"2eb58b0cb0c5ddd3","type":"trigger","z":"feb1b184abb55693","name":"Poll Every 10 min","op1":"1","op2":"0","op1type":"num","op2type":"str","duration":"-3","extend":false,"overrideDelay":false,"units":"s","reset":"stop","bytopic":"all","topic":"topic","outputs":1,"x":530,"y":1380,"wires":[["4371eea2659fb928"]]},{"id":"84a3c30b1ee4f3eb","type":"mqtt in","z":"feb1b184abb55693","name":"MQTT \"callerid/alive\"","topic":"alive","qos":"2","datatype":"auto-detect","broker":"12cbc2886c19b10a","nl":false,"rap":true,"rh":0,"inputs":0,"x":90,"y":1380,"wires":[["12fd9632d5a356c7"]]},{"id":"12fd9632d5a356c7","type":"ha-sensor","z":"feb1b184abb55693","name":"Callattendant Still Alive ","entityConfig":"645169a671b306dd","version":0,"state":"payload","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":300,"y":1380,"wires":[["f73dda6eb261e5f9","2eb58b0cb0c5ddd3"]]},{"id":"f73dda6eb261e5f9","type":"switch","z":"feb1b184abb55693","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"Yes","vt":"str"},{"t":"neq","v":"Yes","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":450,"y":1300,"wires":[["3adcaa432fd5e7e1"],[]]},{"id":"3adcaa432fd5e7e1","type":"change","z":"feb1b184abb55693","name":"Set To 0 If MQTT Msg Is Yes","rules":[{"t":"set","p":"payload","pt":"msg","to":"0","tot":"num"}],"action":"","property":"","from":"","to":"","reg":false,"x":640,"y":1300,"wires":[["4371eea2659fb928"]]},{"id":"4371eea2659fb928","type":"function","z":"feb1b184abb55693","name":"function 4","func":"var value = value + msg.payload\n//value = value +1;\nmsg.payload = msg.payload + 1;\n\nmsg.value = value;\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":720,"y":1380,"wires":[["028ff549a780bfc7","4e7eb63c8f455a47"]]},{"id":"4e7eb63c8f455a47","type":"debug","z":"feb1b184abb55693","name":"debug 25","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":940,"y":1340,"wires":[]},{"id":"186cd3be6bfce81c","type":"inject","z":"feb1b184abb55693","name":"Yes","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Yes","payloadType":"str","x":90,"y":1480,"wires":[["12fd9632d5a356c7"]]},{"id":"028ff549a780bfc7","type":"switch","z":"feb1b184abb55693","name":"","property":"value","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"gt","v":"5","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":750,"y":1440,"wires":[["4b7e7b663e31bb09","4e7eb63c8f455a47"],["fe8e06f7c086e424","4e7eb63c8f455a47"]]},{"id":"4b7e7b663e31bb09","type":"change","z":"feb1b184abb55693","name":"Set Connected","rules":[{"t":"set","p":"payload","pt":"msg","to":"Connected","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":940,"y":1420,"wires":[["eaf9054c35ddae85"]]},{"id":"fe8e06f7c086e424","type":"change","z":"feb1b184abb55693","name":"Set Offline","rules":[{"t":"set","p":"payload","pt":"msg","to":"Offline","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":930,"y":1460,"wires":[["eaf9054c35ddae85"]]},{"id":"eaf9054c35ddae85","type":"ha-sensor","z":"feb1b184abb55693","name":"Callattendant Status","entityConfig":"645169a671b306dd","version":0,"state":"payload","stateType":"msg","attributes":[],"inputOverride":"allow","outputProperties":[],"x":1160,"y":1420,"wires":[["4e7eb63c8f455a47"]]},{"id":"7dac54c00df1c86c","type":"inject","z":"feb1b184abb55693","name":"No","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"No","payloadType":"str","x":90,"y":1540,"wires":[["12fd9632d5a356c7"]]},{"id":"12cbc2886c19b10a","type":"mqtt-broker","name":"home assistant server","broker":"192.168.0.12","port":"1883","clientid":"","autoConnect":true,"usetls":false,"protocolVersion":"3","keepalive":"60","cleansession":true,"autoUnsubscribe":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"userProps":"","sessionExpiry":""},{"id":"645169a671b306dd","type":"ha-entity-config","server":"915baa48.9b1898","deviceConfig":"","name":"Callattendant Status","version":"6","entityType":"sensor","haConfig":[{"property":"name","value":"Callattendant Status"},{"property":"icon","value":""},{"property":"entity_picture","value":""},{"property":"entity_category","value":""},{"property":"device_class","value":""},{"property":"unit_of_measurement","value":""},{"property":"state_class","value":""}],"resend":false,"debugEnabled":false},{"id":"915baa48.9b1898","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}]