How to include json in Automation

So the latest version of HA (.79) includes an update to the android TV notifier that allows you to not only send text but images. Very cool. I like it. I really dont do much, buy I do send a simple notification when someone crosses my line crossing sensor after dark. Usually pizza delivery, etc.

Anyway, thought it would be cool to include a picture from my cam. Issue is I’ve never included JSON in any of my automations and that seems to be the way to send files.

Can someone tell me if this looks right??

  - service: notify.sony_tv
    data:
      {
        "message":"Someone has crossed the driveway coming from Street",
        "title": "Driveway Crossing",
        "data":{
          "file":{
            "path":"/tmp/frontdoor.jpg"
          }
        }
      }

I’m pretty sure that’s just another way to represent YAML. Even though it looks like JSON, it’s really still YAML. I think. I haven’t really tried anything like that, but I think that’s just another way of writing this:

  - service: notify.sony_tv
    data:
      message: Someone has crossed the driveway coming from Street
      title: Driveway Crossing
      data:
        file:
          path: /tmp/frontdoor.jpg

Try putting both into this YAML Online Parser and they should give the same results.

Yup, that totally worked, the JSON threw me off! Thanks

Hey, just a quick question:

So when you sit and watches tv you simply get some sort of pop up with the notification text or picture from your cam?
Does this only work when the “Android menu” or system is running or does it also work if you are using HDMI1 where your PS4 for instance is connected or?

does that answer your question? :slight_smile: