Invalid config error for custom doorbell

Hi, I keep getting this error when trying to run a script to create a home doorbell that pushes a image to telegram.

This is my configuration.yaml file.

# Configure a default setup of Home Assistant (frontend, api, etc)

# Text to speech
  - platform: google_translate
# Example configuration.yaml entry
  - platform: mqtt
    topic: dev/camera
#telegram stuff
  - platform: polling
    api_key: API_KEYHERE
      - 1123456789
      - -11111111
 - name: Telegram
   platform: telegram
   chat_id: -111111111
 - alias: Doorbell_pressed_automation
     platform: mqtt
     topic: dev/test
     payload: 'Capture!'
     - service: automation.turn_off
       entity_id: automation.doorbell_pressed_automation
     - service: script.turn_on
       entity_id: script.doorbell_pressed_script
     - delay: "00:00:5"
     - service: automation.turn_on
       entity_id: automation.doorbell_pressed_automation
    - service: mqtt.publish
      data: {"topic":"dev/test", "payload":"ON"}
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
  customize: !include customize.yaml

But i’m getting this error:

The following integrations and platforms could not be set up:

Please check your config and logs.
Logger: homeassistant.setup
First occurred: 11:39:04 (1 occurrences)
Last logged: 11:39:04

Setup failed for dev_publish_on_script: Integration not found.

You need to put the script under the script key:


If you have this:

script: !include scripts.yaml

Then put the script in that file instead.

Also rather than turning the automation off, delay, turn it on again to prevent multiple notifications, delete all that and just put this at the end of your actions:

     - delay: "00:00:05"

The default mode for automations is to only run one instance, so if it triggers again while waiting in that delay it will not run. It will generate a warning in the log though (“automation Doorbell_pressed_automation already running”). To suppress that you can do this:

 - alias: Doorbell_pressed_automation
     platform: mqtt
     topic: dev/test
     payload: 'Capture!'
     - service: automation.turn_off
       entity_id: automation.doorbell_pressed_automation
     - delay: "00:00:5"
   max_exceeded: silent

Thank you. Done that. I cant figure out how to do this now.

“create a template sensor which is displays the time when ‘Capture!’ is published on the dev/test channel by post_image() . I have a sensor monitoring dev/test with the code”
The code is

  - platform: mqtt 
    name: "dev_test" 
    state_topic: "dev/test" 

Not sure how to create a sensor from this. I am following this tutorial but most problems i can figure out but i’m new to home assistant. Homeassistant doorbell

I’d use a triggered template sensor instead:

  - trigger:
      - platform: mqtt
        topic: dev/test
        payload: 'Capture!'
      - name: "Doorbell Pressed at"
        state: "{{ now() }}"

This sensor state will have the following format: 2021-09-02 21:09:12.231825+10:00

You can format it however you like though.

See this topic:

So do i place that in configurations.yaml file? this is where i’m lost as when i’ve gone to the templates bit in homeassistant it’s confusing me.

Yes indeed. In configuration.yaml.

Did that but it’s saying
The following integrations and platforms could not be set up:

  • template

Please check your config and logs.

the log shows:
Logger: homeassistant.setup
First occurred: 12:17:08 (1 occurrences)
Last logged: 12:17:08

Setup failed for template: No setup function defined.

What version of Home Assistant are you running?

System Health

version: 2021.1.5
installation_type: Home Assistant Core
dev: false
hassio: false
docker: false
virtualenv: true
python_version: 3.7.3
os_name: Linux
os_version: 5.10.60+
arch: armv6l
timezone: Europe/London

logged_in: false
can_reach_cert_server: ok
can_reach_cloud_auth: ok
can_reach_cloud: ok

dashboards: 1
mode: auto-gen
resources: 0

You are 8 releases behind.

That version does not include the new template format. Triggered template sensors were introduced in 2021.4

tried to update to the lastest 2021.9.0 however when ever i use pip3 install --upgrade homeassistant is just reinstalls 2021.1.5 so not sure what i’m doing wrong.

Not reading and fixing the breaking changes relevant to your config for all the updates in between probably.

Update one version at a time (the last dot release for each major version), read the breaking changes in the relevant release notes blog post and fix them before moving on to the next version.

Ah got it. I needed to upgrade python to 3.8 before anything else. Doing this now and compiling. once that is done I’ll do the version by version update.

Thank you…

Thank you i’ve finished updating homeassistant.

How can i get it to start running a script in /var/www/html/images when it reboots.
It is a py script and contains this:

# combine the MQTT and RF receive codes 
import paho.mqtt.client as mqtt 
import paho.mqtt.publish as publish 
import picamera 
import argparse 
import signal 
import sys 
import time
import datetime
import logging 
from rpi_rf import RFDevice 
rfdevice = None 
### camera 
camera = picamera.PiCamera() 
def post_image(): 
   print('Taking photo') 
   file_name = 'image_' + str( + '.jpg' 
   camera.capture(file_name)  # time-stamped image 
   with open('image.jpg', "rb") as imageFile: 
       myFile = 
       data = bytearray(myFile) 
   client.publish('dev/camera', data, mqttQos, mqttRetained)  # 
   client.publish('dev/test', 'Capture!') 
   print(file_name + 'image published') 
### MQTT 
broker = '' 
topic ='dev/test' 
mqttQos = 0 
mqttRetained = False 
def on_connect(client, userdata, flags, rc): 
   print("Connected with result code "+str(rc)) 
# The callback for when a PUBLISH message is received from the server.
def on_message(client, userdata, msg): 
   payload = str(msg.payload.decode('ascii'))  # decode the binary string 
   print(msg.topic + " " + payload) 
def process_trigger(payload): 
   if payload == 'ON': 
       print('ON triggered') 
client = mqtt.Client() 
client.on_connect = on_connect    # call these on connect and on message 
client.on_message = on_message 
client.username_pw_set(username='user',password='pass')  # need this 
#client.loop_forever()    #  don't get past this 
client.loop_start()    #  run in background and free up main thread 
### RF 
def exithandler(signal, frame): 
logging.basicConfig(level=logging.INFO, datefmt='%Y-%m-%d %H:%M:%S', 
                   format='%(asctime)-15s - [%(levelname)s] %(module)s: %(message)s', ) 
parser = argparse.ArgumentParser(description='Receives a decimal code via a 433/315MHz GPIO device') 
parser.add_argument('-g', dest='gpio', type=int, default=27, 
                   help="GPIO pin (Default: 27)") 
args = parser.parse_args() 
signal.signal(signal.SIGINT, exithandler) 
rfdevice = RFDevice(args.gpio) 
timestamp = None"Listening for codes on GPIO " + str(args.gpio)) 
code_of_interest = '8388608' 
while True: 
   if rfdevice.rx_code_timestamp != timestamp: 
       timestamp = rfdevice.rx_code_timestamp 
       if str(rfdevice.rx_code) == code_of_interest: 
           time.sleep(1)  # prevent registering multiple times