configuration-filestwilio-apihome-automation

Cannot figure out how to get the twilio API to work in home assistant


Ok, so I am using home assistant to automatically send myself a message at certain times of the day using the twilio api.

https://home-assistant.io/getting-started/troubleshooting-configuration/

It is all done in the configuration.yaml file, so here is what mine looks like:

notify:
  - name: Cody Wirth
    platform: twilio_sms
    account_sid: AC8a4f2f40331bdad5c95265f2cefe26a2
    auth_token: 33a693e18dcad513d4791c51f1071227
    from_number: "+16142896777"

automation:
  - alias: Send message at a given time
    trigger:
      platform: time
      hours: 24
      minutes: 47
      seconds: 15
    action:
      service: notify.twilio_sms
      data:
        message: 'The sun has set'
        target:
          - "+16147059227"

Is there anything wrong with my syntax? Is there something I need to configure on Twilio's end to make the messages come through to my phone? Nothing at all is happening when I automate the messages to send.

Ok, so this is the error that it returns:

"17-01-12 08:17:44 WARNING (MainThread) [homeassistant.core] Unable to find service notify/twilio_sms"

Solution

  • To be able to use twilio, you first need to enable/configure the twilio component. The automation does not configure or start the twilio component, it just uses it.

    You can find the configuration documentation on the twilio component page:

    twilio:
      account_sid: ACCOUNT_SID_FROM_TWILIO
      auth_token: AUTH_TOKEN_FROM_TWILIO
    

    After you configured it (and restarted home-assistant), your automation should be able to send notifications over it.