notifications using a variable as subject  [Solved]

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
kitopopo
Posts: 59
Joined: Monday 03 December 2018 11:49
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

notifications using a variable as subject

Post by kitopopo »

Does anyone know why using domoticz.notify the message field is read from a local variable but the subject of a local variable is not read?

Code: Select all

return {
  on = {
        --timer = {'at sunset'},
        devices = { 'Estora salon level'  }
  },
          	execute = function(domoticz, device)

local porcentaje = (domoticz.devices('Estora salon level').level)
local asunto= 'test'

if domoticz.devices('Estora salon level').level >= 1 and  domoticz.devices('Estora salon level').level <= 99 then
     domoticz.notify(asunto, porcentaje, domoticz.PRIORITY_MODERATE, nil, nil, "telegram")

end

end

}
Thanks in advanced
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: notifications using a variable as subject  [Solved]

Post by waaren »

kitopopo wrote: Saturday 31 October 2020 0:38 Does anyone know why using domoticz.notify the message field is read from a local variable but the subject of a local variable is not read?
Fot telegram the subject is ignored. All messages are picked up by the domoticz bot. If you want a specific subject use something like

btw. Please do not post in a topic that is about something else.
I now split the topic and moved your post.

Code: Select all

return {
  on = {
        --timer = {'at sunset'},
        devices = { 'Estora salon level'  }
  },
   logging =
   {
        level = domoticz.LOG_DEBUG,
        marker = 'Estora',
   },

   execute = function(dz, item)

        local porcentaje = item.level
        local asunto = 'test'

        if porcentaje >= 1 and  porcentaje <= 99 then
             dz.notify('Whatever', 'subject: ' .. asunto .. '; msg: ' .. porcentaje, dz.PRIORITY_MODERATE, nil, nil, dz.NSS_PUSHOVER)
             dz.notify('Whatever', 'subject: ' .. asunto .. '; msg: ' .. porcentaje, dz.PRIORITY_MODERATE, nil, nil, dz.NSS_TELEGRAM)
        end
    end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
kitopopo
Posts: 59
Joined: Monday 03 December 2018 11:49
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: notifications using a variable as subject

Post by kitopopo »

sorry dear waaren i understand. I will study your script. Thanks in advanced
kitopopo
Posts: 59
Joined: Monday 03 December 2018 11:49
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: notifications using a variable as subject

Post by kitopopo »

Dear @waaren are yo the best. Telegram now show the subject. Thanks very much. Whts mean logging in the script?
kitopopo
Posts: 59
Joined: Monday 03 December 2018 11:49
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: notifications using a variable as subject

Post by kitopopo »

Ok i found the info in the wiki. Thenks very much. Best regards
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest