Guys, once again i need your help with something that i’ve been struggling for the last couple of months. I tried searching this on the forum and online but couldn’t find something to help me in my situation.
I’m using the “notify” service to send a message via bot on Telegram in several automations. The message bot works perfectly with no flaws. However, i wanted to take it a step further and include photos in the messages, and for this i’m aware i have to use the “telegram_bot.send_photo”. The problem however is , anytime i’m trying to send a photo that’s saved locally in the “www” directory, it won’t work, if i change the template and send a photo from a URL, that works.
service: telegram_bot.send_photo
data:
file: /local/temperature-cold.png
target:
- -XXXXXXXX (<-- group id)
- XXXXXXXX ( <-- user id)
Searching online, i found out i need to whitelist the directory by adding certain lines in the configuration.yaml file. Did this, and it’s still not working.
homeassistant:
allowlist_external_dirs: (had this changed to "whitelist_external_dirs:" and still no luck)
- /config
I checked the configuration file, and restarted HA, still no luck. So, in my mind, i think i’m doing something wrong with the whitelisting of the directory and i can’t for the life of me understand what is it that i’m doing wrong.
I also want to add this to 2 different automations, where i’m getting a Telegram message with a picture when my Nest camera is detecting movement, and …
I also wanted to get some sort of notification where i’m being told what media is playing on Plex. However, from the entire list of variables, all i’m getting is "User X is playing “media title” on Plex “device”. "
The name of the media and the device are correct, however, no actual picture appears in the message.
I know i may be causing a lot of headaches and this stuff may be extremely simple for some of you, i do have some knowledge when it comes to HA, however i’m not an expert, so i’m trying my best to understand. But now i really need your help with this, and i’ll really appreciate every bit of help received. Bellow is the code i use for Plex:
alias: Notifications Plex new
trigger:
- platform: state
from:
- playing
- paused
entity_id:
- media_player.plex_plex_for_android_tv_shield_android_tv
- platform: state
to:
- playing
- paused
entity_id:
- media_player.plex_plex_for_android_tv_shield_android_tv
action:
- service: notify.jarvis
data:
title: |
{% if username == None %}
{{prevusername}} {{devstate | replace('idle', 'stopped')|replace('unavailable','stopped')}} on {{device}}
{% else %}
{{username}} {{devstate }} on {{device}}
{% endif %}
message: |
{% if username == None %}
{% if prevseries == "" %}
{{ prevtitle }} {{devstate | replace('idle', 'stopped')|replace('unavailable','stopped')}} on {{device}}
{% else %}
{{ prevseries }} - S{{'%02d' % prevseason}}E{{'%02d' % prevepisode}} - {{ prevtitle }} {{devstate | replace('idle', 'stopped')|replace('unavailable','stopped')}} on {{device}}
{% endif %}
{% else %}
{% if series == None %}
{{ title }} {{devstate }} on {{device}}
{% else %}
{{ series }} - S{{'%02d' % season}}E{{'%02d' % episode}} - {{ title }} {{devstate}} on {{device}}
{% endif %}
{% endif %}
data:
icon_url: |
{% if username == None %}
{{prevpicture}}
{% else %}
{{picture}}
{% endif %}
notification_icon: mdi:plex
tag: |
{% if username == None %}
{{prevusername}} {{device}}
{% else %}
{{username}} {{device}}
{% endif %}
mode: restart
variables:
device: "{{ state_attr(trigger.entity_id, 'friendly_name') }}"
series: "{{ state_attr(trigger.entity_id, 'media_series_title') }}"
title: "{{ state_attr(trigger.entity_id, 'media_title') }}"
picture: "{{ state_attr(trigger.entity_id, 'entity_picture') }}"
username: "{{ state_attr(trigger.entity_id, 'username') }}"
season: "{{ state_attr(trigger.entity_id, 'media_season') }}"
episode: "{{ state_attr(trigger.entity_id, 'media_episode') }}"
devstate: "{{ trigger.to_state.state }}"
prevseries: "{{trigger.from_state.attributes.media_series_title}}"
prevtitle: "{{trigger.from_state.attributes.media_title}}"
prevpicture: "{{trigger.from_state.attributes.entity_picture}}"
prevusername: "{{trigger.from_state.attributes.username}}"
prevseason: "{{trigger.from_state.attributes.media_season}}"
prevepisode: "{{trigger.from_state.attributes.media_episode}}"