[support] dlandon - Zoneminder 1.36


Recommended Posts

  • 3 weeks later...

@dlandoncan you add notifications also for telegram?

Something like this

 

pip install python-telegram-bot

#############################

from telegram import Bot, InputFile

# Add the following function to send notifications to Telegram
def send_telegram_notification(token, chat_id, message, image_path=None):
    bot = Bot(token)
    
    # Check if an image is provided
    if image_path:
        # Send photo along with the message
        with open(image_path, 'rb') as photo:
            bot.send_photo(chat_id, photo, caption=message)
    else:
        # Send only the message
        bot.send_message(chat_id, message)

# Modify the section where you read parameters from secrets or set them manually
if not param_dict['token'] or not param_dict['user']:
    # read from secrets
    secrets = read_secrets()
    if not param_dict['token']:
        param_dict['token'] = secrets.get('TELEGRAM_BOT_TOKEN')  # Replace with your secret key
        zmlog.Debug(1, "eid:{} Reading token from secrets".format(eid))
    if not param_dict['user']:
        param_dict['user'] = secrets.get('TELEGRAM_CHAT_ID')  # Replace with your secret key
        zmlog.Debug(1, "eid:{} Reading user from secrets".format(eid))

# Replace the Pushover-specific code with the Telegram notification code
param_dict['title'] = '{} Alarm ({})'.format(mname, eid)
param_dict['message'] = cause + datetime.now().strftime(' at %I:%M %p, %b-%d')
if event_type == 'event_end':
    param_dict['title'] = 'Ended:' + param_dict['title']

disp_param_dict = param_dict.copy()
disp_param_dict['token'] = '<removed>'
disp_param_dict['user'] = '<removed>'
zmlog.Debug(1, "eid:{} Telegram payload: data={} files={}".format(eid, disp_param_dict, files))
send_telegram_notification(param_dict['token'], param_dict['user'], param_dict['message'], image_path)
zmlog.close()

 

Link to comment
  • 3 weeks later...

Got a question, not sure where to ask, but since it pertains to Zoneminder I'll ask here...  I have the Appdata Backup Plugin installed, and the plugin turns off the docker, backs it up, then turns it back on.  Is the Zoneminder shutdown script/process safe even while it's recording an alarm?  I have a lot of issues and db corruption at random points, and I have had to dump, drop, recreate and restore the zm database quite a few times, not sure what the cause is, but it started when I upgraded from 6.9.2 to 6.12.6...  I know this got really bad when I left the NO_START_ZM set to 1 and since I have figured out it doesn't do a normal startup or shutdown, I have set it to 0 and this has "stopped for now" but want to make sure it is safe, otherwise I would skip it on the backup and manually back it up myself.

 

Thanks in advance.

Link to comment
  • 1 month later...
42 minutes ago, Sforget said:

The latest Version, v1.36.33, has performance issues. Is there currently a way to roll back to an earlier version?

 

There is no way to roll back because the Zoneminder Docker Container always installs the latest version of Zoneminder.  Try getting support for your issue at Zoneminder support.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.