Why not make an command line sensor? This is working in docker also.
sensor:
- platform: command_line
name: shopping_list
command: /config/shopping_list.py
shopping_list.py:
#!/usr/local/bin/python
# coding: utf8
import json
with open('/config/.shopping_list.json') as data_file:
shoppingListData = json.load(data_file)
content = u"Boodschappen:\n"
for entry in shoppingListData:
if not entry['complete']:
content += u"- %s\n" % entry['name']
content += u"\n"
print(content)
Then this is possible:
trigger:
platform: zone
zone: zone.shop
event: enter
action:
service: notify.telegram
data_template:
message: '{{states.sensor.shopping_list.state}}'