Page 1 of 1

notifications using a variable as subject

Posted: Saturday 31 October 2020 0:38
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

Re: notifications using a variable as subject  [Solved]

Posted: Saturday 31 October 2020 19:38
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
}

Re: notifications using a variable as subject

Posted: Sunday 01 November 2020 12:42
by kitopopo
sorry dear waaren i understand. I will study your script. Thanks in advanced

Re: notifications using a variable as subject

Posted: Sunday 01 November 2020 12:49
by kitopopo
Dear @waaren are yo the best. Telegram now show the subject. Thanks very much. Whts mean logging in the script?

Re: notifications using a variable as subject

Posted: Sunday 01 November 2020 12:57
by kitopopo
Ok i found the info in the wiki. Thenks very much. Best regards