This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Push notifications from LM to iOS and Android devices
#61
(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 ...
Reply
#62
The quotes are the issue, remove from 30 and 60 otherwise it is a string not a number.
------------------------------
Ctrl+F5
Reply
#63
(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
Reply
#64
You are not calling push(token, title, body) anywhere in your code.
Reply
#65
(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
Reply
#66
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
------------------------------
Ctrl+F5
Reply
#67
PS. Do not share your token as anyone with it can send you notification.
------------------------------
Ctrl+F5
Reply


Forum Jump: