Gmail / SMS Notification

Hello,

I’m finally starting to make some progress. I’ve got a simple script running which turns a switch on at night then again off in the morning. It’s working great. Now I would like to add an action where an email through GMail is sent to my cell phone. I added an action to the light switch automation but it doesn’t seem to be working. I also thought to set up a simple script just for the purposes of testing the email function but still not working. I’m using Hass.io.

The error reported is;
ERROR (MainThread) [homeassistant.core] Invalid service data for notify.hassio: required key not provided @ data[‘message’]. Got None

The script is called “Send Page”, Action Type is “Call Service”, the Service is "notify.hassio, in the Service Data field it’s blank with {}.

The yaml config looks like this;

# Notify
notify:
  - platform: smtp
    name: Hassio
    server: smtp.gmail.com
    port: 587
    timeout: 15
    sender: [email protected]
    starttls: 1
    username: xxxxxxxxxxx
    password: email password
    recipient: [email protected] 

Any suggestions would be much appreciated.

Thank you,

Can you post the script in a code block please?

The error tells you the problem - you’re not providing a message in the data section. See the examples.

Sorry all,

I’m very new to this. I’m not sure how to post code block.

Also I do see the error message but I don’t understand what it’s calling for.

Details on the code block are in the large blue box at the top of every page on this forum :wink:

Have a look at the examples I linked to - you must provide a message.

OK, I’ll keep trying.

Unfortunately it seems that frequently after making changes to the configuration file, I have to format and reload the OS because the thing locks up and/or locks me out. This is a very slow process.

Thank you for the suggestions.

Ensure you add the SSH add-on, then you can’t get locked out if there’s a configuration issue.

[quote=“punkin, post:1, topic:37288”]
starttls: 1
This is the only difference from your config to mine, I have ‘true’ instead.

Thanks everyone,

I think I’ll abandon this idea. I had to format the drive and reload the OS 3 times today just to get back to the point where I could turn my light switch on and off again. Each time I try to add some of the extra features the thing locks up. Best to leave well enough alone.

Thank you everyone.

Just to be sure and not to give up too early, all I did was change the name from Hassio to hassio and the thing is completely locked up again. I’ve rebooted several times and there seems no way to recover it. I’ll reformat once more then if I can get it to turn my switch on and off again, I’ll just leave it alone.

Thanks again

Dude, the problem in your code is not in the bit you posted, it’s in your script, which we can probably fix if you post it here. (I did ask yesterday, and Tinkerer has even tried to guess the error for you in the absence of the script itself).

Very unlikely you need to reformat.

I’m sorry,

I don’t know what you’re asking for. I would gladly share this. I have seen some link to here and there but I don’t understand. I was clear about the fact that I’m quite new to this and I am resigned to the possibility that this may not be the forum for learning. I don’t mean to waste your time.

Code Block - Still trying to understand how to give you what you’re asking for. When I click and copy the info, not everything is posted.

1 Like

I looked in my Scripts.yaml file and there is nothing in there…its is completely blank.

On your first post see the gray box with all the # Notify code(?) that’s called Code Block.

Can you post here your automation or script you’ve got to send you an email notification?

On your “script” Service Data field paste this: {"message":":)"}

Thank you for your patience and help with this. As soon as I paste and restart the following into my scripts.yaml file, Hassio locks up. The only way I’ve been able to recover is by reformatting and starting over.

#Notification
script:
test_notification:
alias: Test Notification
sequence:
- service: notify.Hassio
data:
message: ‘This is a test notification!’

remove the line script:

and ensure the rest is formatted like this (with spaces, not tabs):

test_notification:
  alias: Test Notification
  sequence:
    - service: notify.Hassio
      data:
        message: 'This is a test notification!'

Also note that in your paste you are using some kind of non-standard apostrophes (presumably from editing the file in Word or some other ‘clever’ text editor).

Thank you,

I’m using Notepad ++

Thank you very much,

The formatting does look as you’ve shown it. I’m not sure why the formatting changes when I copy and paste. I have made the changes to the file and rebooting now but I suspect that I’ll need to reformat and start over. In the past, once I’ve entered this state, even after deleting the contents of the scripts.yaml file it doesn’t recover. I’ll post my results shortly.

Again, thanks very much.

Good luck :+1:

1 Like

Try change both ’ with " in the message field.
Are this the only changes you making to get hass.io blocked out?