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.

LM Home app (Andrоid/iOS starter)
(13.02.2025, 17:42)Chandrias Wrote:
(13.02.2025, 16:27)Daniel Wrote: If you using Push notifications app then you are not using LM Home app.  The script above is for LM home app not LogicMachine app which is the older version.
https://kb.logicmachine.net/notification...fications/

I installed the LM Home app also, but when I open it, the gear icon is not there.
Check the attached picture
For see the gear icon and system you must log as administrator, not user
BR Cristian
Reply
(13.02.2025, 19:26)CristianAgata Wrote:
(13.02.2025, 17:42)Chandrias Wrote:
(13.02.2025, 16:27)Daniel Wrote: If you using Push notifications app then you are not using LM Home app.  The script above is for LM home app not LogicMachine app which is the older version.
https://kb.logicmachine.net/notification...fications/

I installed the LM Home app also, but when I open it, the gear icon is not there.
Check the attached picture
For see the gear icon and system you must log as administrator, not user
BR Cristian

Still no success

Attached Files Thumbnail(s)
   
Reply
To login into LM Cloud via LM Home app either click and hold LM Home icon and select "Go to LM Cloud" or temporarily turn of Wi-Fi on your phone.
Reply
(14.02.2025, 07:43)admin Wrote: To login into LM Cloud via LM Home app either click and hold LM Home icon and select "Go to LM Cloud" or temporarily turn of Wi-Fi on your phone.

That worked. Thanks
Reply
Hi.
I still have two questions:
1) In local network, credentials seems to be unsaved (however password stored in iphone, but need to put user name + password every time). I can of course store the password in icloud, but i really think it is disturbing having to enter password all time (no, I don't use admin).
2) Any way to use simpler names instead of full token? Also any way to make groups of phones or to push to all phones?
If we are three users, it would be nice to have "xxx's phone", "yyy's phone", and "zzz's phone". + "push to all".

Thanks a lot for your helplfulness.
Reply
1. Check that "Remember login and password" is enabled in LM > Users > User access settings. Don't use admin user for the app. Keep the app running in the background after the first login otherwise the credentials might not be saved.

2. Create a user library named push, provide user names, tokens and create groups as needed.
Code:
local tokens = {
  ['User A'] = 'user-token-A',
  ['User B'] = 'user-token-B',
  ['User C'] = 'user-token-C',
}

local groups = {
  ['Group A'] = { 'User A', 'User B' },
  ['Group B'] = { 'User B', 'User C' },
}

return function(name, title, body)
  local push = require('applibs.lmcloud.push')

  local token = tokens[ name ]
  if token then
    return push(token, title, body)
  end
  
  local group = groups[ name ]
  if group then
    local ress, errs = {}, {}
    
    for _, tname in ipairs(group) do
      token = tokens[ tname ]
      
      if token then
        local res, err = push(token, title, body)
        if res then
          ress[ name ] = true
        else
          errs[ name ] = err
        end
      else
        errs[ name ] = 'not found'
      end
    end
    
    return ress, errs
  end
  
  return nil, 'not found'  
end

Usage:
Code:
push = require('user.push')

name = 'Group A'
title = 'Push title'
body = 'Push message body'

res, err = push(name, title, body)
log(res, err)
Reply
(17.02.2025, 08:00)admin Wrote: 1. Check that "Remember login and password" is enabled in LM > Users > User access settings. Don't use admin user for the app. Keep the app running in the background after the first login otherwise the credentials might not be saved.

2. Create a user library named push, provide user names, tokens and create groups as needed.
Code:
local tokens = {
  ['User A'] = 'user-token-A',
  ['User B'] = 'user-token-B',
  ['User C'] = 'user-token-C',
}

local groups = {
  ['Group A'] = { 'User A', 'User B' },
  ['Group B'] = { 'User B', 'User C' },
}

return function(name, title, body)
  local push = require('applibs.lmcloud.push')

  local token = tokens[ name ]
  if token then
    return push(token, title, body)
  end
 
  local group = groups[ name ]
  if group then
    local ress, errs = {}, {}
   
    for _, tname in ipairs(group) do
      token = tokens[ tname ]
     
      if token then
        local res, err = push(token, title, body)
        if res then
          ress[ name ] = true
        else
          errs[ name ] = err
        end
      else
        errs[ name ] = 'not found'
      end
    end
   
    return ress, errs
  end
 
  return nil, 'not found' 
end

Usage:
Code:
push = require('user.push')

name = 'Group A'
title = 'Push title'
body = 'Push message body'

res, err = push(name, title, body)
log(res, err)

Wow. Great! Thanks. Works like a charm.
Reply


Forum Jump: