LogicMachine Forum
Push notifications from LM to iOS and Android devices - Printable Version

+- LogicMachine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Gateway (https://forum.logicmachine.net/forumdisplay.php?fid=10)
+--- Thread: Push notifications from LM to iOS and Android devices (/showthread.php?tid=1083)

Pages: 1 2 3 4


RE: Push notifications from LM to iOS and Android devices - mariosp - 22.01.2025

(22.01.2025, 12:35)baggins Wrote:
(22.01.2025, 12:31)mariosp Wrote: hello guys i made this script about DHW temperature for push notification and doesnt work the id is true. Here is the script
Code:
local min_temp = '30' local max_temp = '60' local water_temp = event.getvalue() if water_temp <= min_temp   then push = require('applibs.lmcloud.push')   token = 'ios:d-UdhwTxj05Mqtku6GH0JU:APA91bGK4SoVNL4AOg20RQTC2DiUMYtbjrk6YhsVPQoP9nDpgboWDpTQO0G6ruMHq2xXwccyI1LsyJL3kflVsfCjzvcrQspFTUOlqLfpjap4dAnHHSF9tE4' title = 'Push title' body = 'Χαμηλή Θερμοκρασία ΖΝΧ' elseif     water_temp >= max_temp   then   push = require('applibs.lmcloud.push')   token = 'ios:d-UdhwTxj05Mqtku6GH0JU:APA91bGK4SoVNL4AOg20RQTC2DiUMYtbjrk6YhsVPQoP9nDpgboWDpTQO0G6ruMHq2xXwccyI1LsyJL3kflVsfCjzvcrQspFTUOlqLfpjap4dAnHHSF9tE4' title = 'Push title' body = 'Υψηλή Θερμοκρασία ΖΝΧ'     end
and im getting this log : User script:5: attempt to compare number with string stack traceback:
thank you in advance!!
Do not use quotes: local min_temp = 30
i already tried that not the issue ...


RE: Push notifications from LM to iOS and Android devices - Daniel - 22.01.2025

The quotes are the issue, remove from 30 and 60 otherwise it is a string not a number.


RE: Push notifications from LM to iOS and Android devices - mariosp - 22.01.2025

(22.01.2025, 12:47)Daniel Wrote: The quotes are the issue, remove from 30 and 60 otherwise it is a string not a number.

Code:
local min_temp = 30 local max_temp = 60 local water_temp = event.getvalue() if water_temp <= min_temp   then push = require('applibs.lmcloud.push')   token = 'ios:d-UdhwTxj05Mqtku6GH0JU:APA91bGK4SoVNL4AOg20RQTC2DiUMYtbjrk6YhsVPQoP9nDpgboWDpTQO0G6ruMHq2xXwccyI1LsyJL3kflVsfCjzvcrQspFTUOlqLfpjap4dAnHHSF9tE4' title = 'Push title' body = 'Χαμηλή Θερμοκρασία ΖΝΧ' elseif     water_temp >= max_temp   then   push = require('applibs.lmcloud.push')   token = 'ios:d-UdhwTxj05Mqtku6GH0JU:APA91bGK4SoVNL4AOg20RQTC2DiUMYtbjrk6YhsVPQoP9nDpgboWDpTQO0G6ruMHq2xXwccyI1LsyJL3kflVsfCjzvcrQspFTUOlqLfpjap4dAnHHSF9tE4' title = 'Push title' body = 'Υψηλή Θερμοκρασία ΖΝΧ'     end
i tried again it still doent work but i dont get any error


RE: Push notifications from LM to iOS and Android devices - admin - 22.01.2025

You are not calling push(token, title, body) anywhere in your code.


RE: Push notifications from LM to iOS and Android devices - mariosp - 22.01.2025

(22.01.2025, 12:52)admin Wrote: You are not calling push(token, title, body) anywhere in your code.

can you explain more please ? im now learning i appreciate


RE: Push notifications from LM to iOS and Android devices - Daniel - 22.01.2025

Code:
local min_temp = 30 local max_temp = 60 local water_temp = event.getvalue() if water_temp <= min_temp   then push = require('applibs.lmcloud.push')   token = 'your_token' title = 'Push title' body = 'Χαμηλή Θερμοκρασία ΖΝΧ' res, err = push(token, title, body) log(res, err)  elseif     water_temp >= max_temp   then   push = require('applibs.lmcloud.push')   token = 'ios:d-UdhwTxj05Mqtku6GH0JU:APA91bGK4SoVNL4AOg20RQTC2DiUMYtbjrk6YhsVPQoP9nDpgboWDpTQO0G6ruMHq2xXwccyI1LsyJL3kflVsfCjzvcrQspFTUOlqLfpjap4dAnHHSF9tE4' title = 'Push title' body = 'Υψηλή Θερμοκρασία ΖΝΧ' res, err = push(token, title, body) log(res, err)        end



RE: Push notifications from LM to iOS and Android devices - Daniel - 22.01.2025

PS. Do not share your token as anyone with it can send you notification.


RE: Push notifications from LM to iOS and Android devices - Zoli - 29.01.2026

Hello!
My problem is that the push notification works, but it doesn't make a sound or wake up the display, it's a quasi-silent notification. I've had this same experience with several phones (iOS). Has anyone had this problem? What could be the solution?
Thank you!


RE: Push notifications from LM to iOS and Android devices - Daniel - 29.01.2026

Try again and let us know if something has changed.


RE: Push notifications from LM to iOS and Android devices - Zoli - 29.01.2026

(29.01.2026, 17:33)Daniel Wrote: Try again and let us know if something has changed.

It works perfectly now.
Is there any way to set the priority of the push message?
Thanks!


RE: Push notifications from LM to iOS and Android devices - Daniel - 30.01.2026

No, there is one globally set and we use the highest.