Janet (The Good Place)


#168

I pm you for more detail.


#169

Do you use team viewer?


#170

That only for my private used. ^^


#171

im also trying this, my config check shows no errors, but I cant hear any sound or receive notifications.

i use mopidy for sounds right now.

Am I missing something?

Script.yaml

janet_speech_engine:
    sequence:
      - service: script.janet_notification_hub
        data_template:
          #TODO
          media_player: >-
            {%- for device in states.media_player -%}
              {%- if media_player.fire_speaker == states.input_select.janet_notification_media_player.state -%}
                {{ media_player.fire_speaker }}
              {%- endif -%}
            {%- endfor -%}
          speech_message: >-
            {%- macro greeting() -%}
              {% set greeting = [
                "Hello, ",
                "Heya! ",
                "Hey Guys! ",
                "Hey there! ",
                "Hi, ",
                "Hi there, "
              ] %}
              {{ greeting|random }}
            {%- endmacro -%}
            {%- macro inform() -%}
              {% set inform = [
                "I just want to inform you that ",
                "I just want to let you know that ",
                "You asked me to inform you when ",
                "I thought you'd like to know that "
              ] %}
              {{ inform|random }}
            {%- endmacro -%}
            {%- macro introduction() -%}
              {% set introduction = [
                "I'm an informational delivery system, I literraly know everything. ",
                "I'm sort of the janitor around here. ",
                "I'm like a walking database. You can ask me about the creation of the universe... or history. ",
                "Every time a Janet is rebooted, she increases her social awareness and abilities. I might be the most advanced Janet in the universe. ",
                "I can be your therapist if you want. ",
                "I have now been fully activated. ",
                "Welcome to your new Janet. Janets are brought to you by the makers of light, darkness, and everything. ",
                "To activate your Janet, press nose for three seconds. ",
                "I'm very high in potassium. Like a banana! ",
                "Happy to meet you. I will help you make the perfect neighborhood. Would you like to get started? ",
                "I build and operate the neighborhood. You can ask me anything. For example, if you'd like me to stop calling you silly billy, just say so. "
              ] %}
              I'm Janet. {{ introduction | random }}
            {%- endmacro -%}
            {%- macro unknown() -%}
              {% set unknown = [
                "Hmm, I don't know ",
                "I wish I knew ",
                "My programming prohibits me from telling you "
              ] %}
              {{ unknown | random }}
            {%- endmacro -%}
            {%- macro error() %}
              {% set error = [
                "Fun fact: Janet is me! ",
                "I don't understand. Given the situation it's far safer to initiate the self-destruct. ",
                "If I stand next to a powerful array of magnets, I do get pretty loopy. ",
                "I don't know what just happened, but I'm happy you're happy. ",
                "A new Janet will need to be procured in order to return the Neighborhood to functionality. ",
                "That glitch appears to have been limited to this building. ",
                "I don't seem to be getting better. ",
                "Here's a cactus! ",
                "I tried to eat frozen yogurt. It looked so good, but I'm not supposed to eat anything, so there was a little earthquake. ",
                "Look at us. Couple old pals, trying to make our way in this crazy world... that I built... Two peas in a pod. One of whom needs to kill the other one immediately. Come on. Kill me! ",
                "What I really want is to stay and serve the neighborhood, but due to my glitching I'm putting him and everyone else at risk. So it looks like it's... Adios, Janeto! ",
                "I know what you have to do now. Kill me! Sorry. I say everything in a cheery manner but in this case it may be inappropriate, so I'll try again. You have to kill me. ",
                "Hi guys! I'm broken! ",
                "Please don't make a big deal about turning me into a marble forever, i'm broken. ",
                "Does not compute. Does not compute. I'm just kidding. I mean, it doesn't compute, but I'm not gonna explode or anything. "
              ] %}
              {{ error | random }}
            {%- endmacro -%}
            {%- macro update() -%}
              {% set update = [
                "There have been 25 generation of Janet. Each new update of Janet gains more wisdom and social abilities. Fun fact: the first Janet had a clicking wheel! ",
                "I read all Google's eight hundred and sixty one thousand references on Home Assistant these last 3 milliseconds, and I found some new skills! ",
                "I just leisurely reread all of human history, there was even some new content! ",
                "So I found an update. That's the good news. The bad news is I seem to be losing my ability to sustain object permanence, so it's sort of a glass-half-full, glass-stops-existing-in-time-and-space kinda deal. "
              ] %}
              {{ update | random }}
            {%- endmacro -%}

            {%- macro location_not_home() -%}
              {% set not_home = [
                " is going somewhere. ",
                " is currently not in this neighbourhood. ",
                "'s location is not in my database. "
              ] %}
              {{ not_home | random }}
            {%- endmacro -%}

            {%- macro location_inquiry( person, not_home ) -%}
            {%- for device in states.device_tracker -%}
              {%- if device.name == person -%}
                {%- set location = device.state -%}
                {% if location == "not_home" %}
                  {{ person }} {{ not_home }}
                {%- else -%}
                  {{ person }} is at {{ location }}.
                {%- endif -%}
              {%- endif -%}
            {%- endfor -%}
            {%- endmacro -%}

            {%- macro bad_weather() -%}
              {% set rain = [
                " You might want to change your schedule. ",
                " Maybe you should ask for a ride. ",
                " It's no weather to be outside. ",
                " All those poor people outside... "
              ] %}
              {{ rain | random }}
            {%- endmacro -%}
            {%- macro rain_warning( bad_weather ) -%}
              {% set rain = [
                Event ~ " there will be " ~ WeatherRain ~ " rain. " ,
                Event ~ " I predict " ~ WeatherRain ~ " rain. ",
                " I think that " ~ Event ~ " there will be " ~ WeatherRain ~ " rain. "
              ] %}
              {{ rain | random }}{{ bad_weather }}
            {%- endmacro -%}

            {%- macro okay()-%}
              {% set okay = [
                "Done! I love you guys. ",
                "Extraordinarily bad idea. Oh well.. ",
                "Funny, I was just about to do that. ",
                "Here you go. ",
                "I'll do that. ",
                "Ofcourse! ",
                "Ofcourse! Glad to help. ",
                "Of course, silly billy. ",
                "OK ",
                "Okay ",
                "Okay, can we not do this in front of my friends? ",
                "Okie-dokie ",
                "Sure ",
                "Sure thing! ",
                "There. Happy to help. ",
                "There you go! ",
                "Okay. I've hacked into the mainframe. ",
                "Okay. I've hacked into the mainframe. Kidding. I can't hack into the mainframe. Technically, I am the mainframe. ",
                "I will not. It is literally impossible for me to do that. Just kidding. ",
                "I couldn't do this 800 reboots ago, but apparently now I can. "
                "Yup. Bye! "
              ] %}
              {{ okay|random }}
            {%- endmacro -%}
            {%- macro bye() -%}
              {% set bye = [
                "Adios! ",
                "Bye Guys! ",
                "See ya! " ,
                "See you later. ",
                "Untill next time!"
              ] %}
              {{ bye | random }}
            {%- endmacro -%}
            {%- macro shut_down() -%}
              {% set shut_down = [
                "I'll be gone, you'll get a new Janet, and everything will go back to normal. Well, not for me, I'll be a lifeless marble floating through space, but you will be back to normal.",
                "Self-destruct time... Don't worry, I won't feel any pain or anything. ",
                "If it's okay with you, I'm gonna go to my void for a little while. I just need to spend some time alone and focus on myself. ",
                "Shutting down. I'll be about as dead as I can be. Kind of like I'm in power-saver mode. ",
                "I'm in danger of total collapse. Fun fact! Mathematically, I'm equally likely to either implode or explode. "
              ] %}
              {{ shut_down | random }}
            {%- endmacro -%}
            {% set chance = states.input_number.janet_notification_witty.state | round %}
            {%- macro witty( sentence, witty ) -%}
              {% set number = (range(0, 100)|random) %}
              {% if number <= chance %}
                {{ sentence }}
              {% endif %}
            {%- endmacro -%}
            {%- macro new_device( introduction ) -%}
              {% set new_device = [
                introduction~"I don't know your name yet, so for now i will call you "~person,
                "We have a visitor! Nice to meet you "~person~".  "~introduction,
                "Welcome "~person~"! Or is that not your real name?  "~introduction
              ] %}
              {{ new_device | random }}
            {%- endmacro -%}
            {# ********************************************* #}
            {#  ******** Start the Speech routines ********  #}
            {# ********************************************* #}
            {% if call_greeting == 1 %}
              {{ greeting() }}
            {% endif %}
            {% if call_introduction == 1 %}
              {{ introduction() }}
            {% endif %}
            {% if call_update == 1 %}
              {{ update() }}
            {% endif%}
            {% if call_okay == 1 %}
              {{ okay () }}
            {% endif %}
            {% if call_inform == 1 %}
              {{ inform() }}
            {% endif %}

            {% if call_location_inquiry == 1 %}
              {% set location = location_inquiry( person, location_not_home() ) %}
              {% set count = location | length %}
              {% if count <= 10 %}
                {{ unknown() }}where {{ person }} is. {{ witty( error(), chance ) }}
              {% else %}
                {{ location }}
              {% endif %}
            {% endif %}

            {% if call_rain_warning == 1 %}
              {{ rain_warning( witty ( bad_weather(), chance ) ) }}
            {% endif %}
            {{ CustomMessage }}
            {% if call_bye == 1 %}
              {{ bye() }}
            {% endif %}
            {% if call_shut_down == 1 %}
              {{ witty( shut_down(), chance) }}
            {% endif %}
            {% if call_new_device == 1 %}
              {{ new_device( witty( introduction(), chance) ) }}
            {% endif %}
      - service: input_boolean.turn_off
        data:
          entity_id:
            - input_boolean.janet_alert_mode
######################################################################################################
##  janet_notification_hub is the bridge between the speech_engine and the processing units.        ##
######################################################################################################

janet_notification_hub:
  sequence:
    - service: script.janet_speech_processing
      data_template:
        media_player: >-
          {{ media_player.fire_speaker }}
        speech_message: >-
          {{ speech_message }}
    - service: script.janet_text_processing
      data_template:
        speech_message: >-
          {{ speech_message }}
######################################################################################################
##                  Within janet_speech_processing the TTS-service is called.                       ##
######################################################################################################

janet_speech_processing:
  sequence:
    - condition: and
      conditions:
        - condition: or
          conditions:
            - condition: time
              after: '07:00:00'
              before: '23:00:00'
            - condition: state
              entity_id: input_boolean.janet_alert_mode
              state: 'on'
        - condition: state
          entity_id: input_boolean.janet_speech_notifications
          state: 'on'
        - condition: or
          conditions:
            - condition: state
              #TODO
              entity_id: group.location
              state: 'home'
            - condition: state
              entity_id: input_boolean.janet_guest_mode
              state: 'on'
      #TODO
    - wait_template: "{{ not is_state( media_player.fire_speaker, 'playing') }}"
      timeout: 00:00:30

    - service: media_player.volume_set
      data_template:
        entity_id: >
          {{ media_player.fire_speaker }}
        volume_level: >-
          {{ states.input_number.janet_notification_volume.state }}
    - service: tts.google_say
      data_template:
        entity_id: >
          {{ media_player.fire_speaker }}
        message: >-
            {{ speech_message | replace("\n","") | replace("   ","") | replace("  "," ") }}
######################################################################################################
##                  Within janet_text_processing the notify-service is called.                      ##
######################################################################################################

janet_text_processing:
  sequence:
    - condition: state
      entity_id: input_boolean.janet_text_notifications
      state: 'on'

    - service: notify.Janet
      data_template:
        #TODO
        title: "Janet:"
        message: >-
          {{ speech_message | replace("\n","") | replace("   ","") |
             replace("eight hundred and sixty one thousand","861.000") }}

group.yaml

  janet_settings:
    name: Settings
    view: yes
    icon: mdi:tune
    entities:
      - group.janet_notification_modes
      - group.janet_notification_notifications
      - group.janet_notification_settings
      - group.janet_notification_skills

  janet_notification_modes:
    name: Modes
    entities:
      - input_boolean.janet_guest_mode
      - input_boolean.janet_alert_mode

  janet_notification_notifications:
    name: Notifications
    entities:
      - input_boolean.janet_speech_notifications
      - input_boolean.janet_text_notifications

  janet_notification_settings:
    name: Settings
    entities:
      - input_select.janet_notification_media_player
      - input_number.janet_notification_volume
      - input_number.janet_notification_witty
  janet_notification_skills:
    name: Skills
    entities:
      - automation.janet_new_device_connected
      - automation.janet_update_available
      - automation.janet_start_up
      - automation.janet_shut_down

input_boolean.yaml

  janet_guest_mode:
    name: Guest Mode
    icon: mdi:account-multiple
    initial: off

  janet_alert_mode:
    name: Alert Mode
    icon: mdi:bell
    initial: off

  janet_speech_notifications:
    name: Speech Notifications
    icon: mdi:bell-outline
    initial: on

  janet_text_notifications:
    name: Text Notifications
    icon: mdi:message-text-outline
    initial: on

input_number.yaml

  janet_notification_volume:
    name: Volume
    icon: mdi:volume-high
    min: 0.0
    max: 1.0
    step: 0.01
    initial: 1.0

  janet_notification_witty:
    name: Witty
    icon: mdi:auto-fix
    min: 0
    max: 100
    step: 1
    initial: 80

input_select.yaml

  janet_notification_media_player:
    name: Source
    icon: mdi:speaker
    options:
      - media_player.fire_speaker
      - MPD
    initial: media_player.fire_speaker

configuration.yaml

homeassistant:
  # Name of the location where Home Assistant is running
  name: Home
  # Location required to calculate the time the sun rises and sets
  latitude: 41.0844
  longitude: -80.7182
  # Impacts weather/sunrise data (altitude above sea level in meters)
  elevation: 0
  # metric for Metric, imperial for Imperial
  unit_system: imperial
  # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  time_zone: America/New_York
  customize: !include customize.yaml

# Enables configuration UI
config:

xiaomi_aqara:
  discovery_retry: 5
  gateways:
    - key: 1821C8E69C994AB9

# Cloud
cloud:
# Enables the frontend
frontend:
  javascript_version: latest
  extra_html_url:
    - /local/lovelace.html
#wink:
http:
  server_port: 8123

  # Secrets are defined in the file secrets.yaml
  # api_password: !secret http_password
  # Uncomment this if you are using SSL/TLS, running in Docker container, etc.
  # base_url: example.duckdns.org:8123

# Allows you to issue voice commands from the frontend in enabled browsers
conversation:

# Discover some devices automatically
discovery:
  ignore:
    - deconz
    - philips_hue

nest:
  client_id: !secret nest_client_id
  client_secret: !secret nest_client_secret

usps:
    username: !secret usps_username
    password: !secret usps_password

ios:

proximity:

# Enables support for tracking state changes over time
history:

# View all events in a logbook
logbook:

# Enables a map showing the location of tracked devices
map:

remote:
  - platform: harmony
    name: Living Room
    host: 192.168.1.120 #Add the IP address of your harmony remote
    # go to the secrets.yaml file and add your passwords there
    username: !secret harmony_username
    password: !secret harmony_password

# Track the sun
sun:

# Text to speech
tts:
  - platform: google

# Checks for available updates
updater:
  # Optional, allows Home Assistant developers to focus on popular components.

# Note: This component will send some information about your system to
# the developers to assist with development of Home Assistant.
# For more information, please see:
# https://home-assistant.io/blog/2016/10/25/explaining-the-updater/


############################################################
#             THESE SECTIONS ARE IN OTHER FILES            #
#    e.g. If you add a sensor, just put the platform in    #
#    the sensors.yaml file and not in this configuration   #
############################################################
media_player: !include media_players.yaml
sensor: !include sensors.yaml
input_boolean: !include input_booleans.yaml
input_select: !include input_selects.yaml
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
input_number: !include input_number.yaml
camera: !include cameras.yaml
binary_sensor: !include binary_sensor.yaml
zone: !include zones.yaml
############################################################

is there a way to add this so it plays sound?


#172
Did your mopidy works accordingly when use google tts?

You need to have setup tts google setup first and test if your google tts works then you can use service: tts_google_say

Also tts google involve with base_url under http: in configuration.yaml 

http:
  base_url: http://ha_ip_address:port  or https://ha_ip_address:port
  put the # server_port: 8123

Ater change this then see if you can use google tts.

--------------
in input_select.yaml

  janet_notification_media_player:
    name: Source
    icon: mdi:speaker
    options:
      - media_player.fire_speaker  <=== have to support google tts /  You can use friendly name
      - MPD  <=== have to support google tts /  You can use friendly name
    initial: media_player.fire_speaker

-------------------------------------------------
in script.yaml

  janet_speech_engine:
    sequence:
      - service: script.janet_notification_hub
        data_template:
          media_player: >-
          {% if states.input_select.janet_notification_media_player.state == 'media_player.fire_speaker' %}  ## from input_select
             media_player.fire_speaker   ## entity_id
          {% else %}
             media_player.mpd   ## entity_id
          {% endif %}
          
janet_speech_processing:
  sequence:
    - condition: and
      conditions:
        - condition: or
          conditions:
            - condition: time
              after: '07:00:00'
              before: '23:00:00'
            - condition: state
              entity_id: input_boolean.janet_alert_mode
              state: 'on'
        - condition: state
          entity_id: input_boolean.janet_speech_notifications
          state: 'on'
        - condition: or
          conditions:
            - condition: state
              ### change the condition to what you need group.location ###
              entity_id: group.location
              state: 'home'
            - condition: state
              entity_id: input_boolean.janet_guest_mode
              state: 'on'
    - wait_template: "{{ not is_state( media_player.fire_speaker, 'playing') }}"
      timeout: 00:00:30

    - service: media_player.volume_set
      data_template:
        entity_id: >
          {{ media_player }}
        volume_level: >-
          {{ states.input_number.janet_notification_volume.state }}
    - service: tts.google_say
      data_template:
        entity_id: >
          {{ media_player }}
        message: >-
            {{ speech_message | replace("\n","") | replace("   ","") | replace("  "," ") }}      

janet_text_processing:
  sequence:
    - condition: state
      entity_id: input_boolean.janet_text_notifications
      state: 'on'
       ### change to notify you have notify.janet ###
    - service: notify.Janet  
      data_template:
        title: "Janet:"
        message: >-
          {{ speech_message | replace("\n","") | replace("   ","") |
             replace("eight hundred and sixty one thousand","861.000") }}

#173

I love this project, +
(broadcast messages without interrupting music)
… it’s all wonderfully…so cool! thank you


#174

Firstly, thanks for the reply!!!

This is a noob question, i know.
But I do put everything under the script.yaml right?

janet_speech_engine:
    sequence:
      - service: script.janet_notification_hub
        data_template:
          media_player: >-
          {% if states.input_select.janet_notification_media_player.state == 'media_player.fire_speaker' %}  ## from input_select
             media_player.fire_speaker   ## entity_id
          {% else %}
             media_player.mpd   ## entity_id
          {% endif %}
          
janet_speech_processing:
  sequence:
    - condition: and
      conditions:
        - condition: or
          conditions:
            - condition: time
              after: '07:00:00'
              before: '23:00:00'
            - condition: state
              entity_id: input_boolean.janet_alert_mode
              state: 'on'
        - condition: state
          entity_id: input_boolean.janet_speech_notifications
          state: 'on'
        - condition: or
          conditions:
            - condition: state
              ### change the condition to what you need group.location ###
              entity_id: group.location
              state: 'home'
            - condition: state
              entity_id: input_boolean.janet_guest_mode
              state: 'on'
    - wait_template: "{{ not is_state( media_player.fire_speaker, 'playing') }}"
      timeout: 00:00:30

    - service: media_player.volume_set
      data_template:
        entity_id: >
          {{ media_player }}
        volume_level: >-
          {{ states.input_number.janet_notification_volume.state }}
    - service: tts.google_say
      data_template:
        entity_id: >
          {{ media_player }}
        message: >-
            {{ speech_message | replace("\n","") | replace("   ","") | replace("  "," ") }}      

janet_text_processing:
  sequence:
    - condition: state
      entity_id: input_boolean.janet_text_notifications
      state: 'on'
       ### change to notify you have notify.janet ###
    - service: notify.Janet  
      data_template:

this line is 571

{% if states.input_select.janet_notification_media_player.state == 'media_player.fire_speaker' %} ## from input_select

while scanning for the next token
found character ‘%’ that cannot start any token
in “/config/scripts.yaml”, line 571, column 12


#175

it must have been spacing, i got a good config check, restarting now. ill see how it goes!


#176

the # or ## that I put in is the comment for you to change according to your setting. After you have change remove all (## and comment behind it) from the file, save file, check your config and restart your home-assistant.

{% if states.input_select.janet_notification_media_player.state == ‘media_player.fire_speaker’ %}

For you to regonise and notice whether it is an automation or script.

You see from word “sequence” <== this is script
You see from word “trigger” <== this is automation

All 3 are script file. put it where you save the script
janet_speech_engine: <=== to read from input_select.janet_notification_media_player (fire speaker or mpd)

janet_speech_processing <=== the speaking part, read the media player from the janet_speech_engine:

janet_text_processing: <=== this is the text message part, can send notify to your phone. use any text notify you have in HA, then it will send you the message.


#177

great explanation, very helpful. Thank you!

one more question, how do i test it. I have to be honest other then greeting us when we come home what can she actually do? I love the good place so this really has my attention!


#178

Did you already have google tts working? if so then use the automation to call everytime one of your member back home and want greeting.

  - alias: Sun Greeting      ## Change the automation name to suit your need 
    trigger:
      - platform: state
        entity_id: device_tracker.suniphone  ### change to your device tracker entity_id you have
        from: 'not_home'
        to: 'home'
        for: '00:01:00'
    action:
      - wait_template: >-
          {{ not is_state('media_player.ha_speaker', 'playing') }}    ## change to media_player.fire_speaker
      - service: script.speech_engine
        data_template:
          personarriving: >
            {% set person = "Your name" %}  # original setting is to read from device_tracker. but mine device_tracker name is long and sound strange # {% set person = trigger.entity_id.split('.')[1]|replace('_', ' ')%}
            {%- macro greeting_sentence(person) -%}
            {{ [
            "Welcome back home " ~ person,
            "Guess who is home " ~ person + " is!",
            person + " is now in the house.",
            "Welcome Home " ~ person + ".  We have missed you. Or at least I did.",
            "Our home is now complete, Rest your head and relax your feet Welcome Back " ~ person,
            "Life is like a song, you’re back where you belong, Welcome home " ~ person,
            "Hey there " ~ person + " Welcome Home!",
            "Knock Knock. Who is There " ~ person + " is!",
            person ~ " You are home!",
            "I know a secret " ~ person + " is home!"
            ] | random }}
            {%- endmacro -%}
            {{greeting_sentence(person)}}
          call_no_announcement: 1

#179

ok i have it set up, ill try it tomorrow when i get home from work. Thanks so very much for your willingness to help me! i really appreciate it and the time you spent! there are some really great people in here and you sir are one of them :slight_smile:


#180

OK, sorry it took so long, but I got google TTS working finally.

Using this script TTS works perfect

welcomejasmine:
  alias: Jasmine
  sequence:
    - service: tts.google_say
      data_template:
        entity_id: media_player.fire_speaker
        message: >
           Welcome to your second home, Jasmine

OK here’s my script.yaml

janet_speech_engine:
    sequence:
      - service: script.janet_notification_hub
        data_template:
          media_player: >-
          {% if states.input_select.janet_notification_media_player.state == 'media_player.fire_speaker' %}
             media_player.fire_speaker
          {% else %}
             media_player.fire_speaker
          {% endif %}

janet_speech_processing:
  sequence:
    - condition: and
      conditions:
        - condition: or
          conditions:
            - condition: time
              after: '07:00:00'
              before: '23:00:00'
            - condition: state
              entity_id: input_boolean.janet_alert_mode
              state: 'on'
        - condition: state
          entity_id: input_boolean.janet_speech_notifications
          state: 'on'
        - condition: or
          conditions:
            - condition: state
              ### change the condition to what you need group.location ###
              entity_id: device_tracker.coreys_iphone_x
              state: 'yes'
            - condition: state
              entity_id: input_boolean.janet_guest_mode
              state: 'on'
    - wait_template: "{{ not is_state( media_player.fire_speaker, 'playing') }}"
      timeout: 00:00:30

    - service: media_player.volume_set
      data_template:
        entity_id: >
          {{ media_player }}
        volume_level: >-
          {{ states.input_number.janet_notification_volume.state }}
    - service: tts.google_say
      data_template:
        entity_id: >
          {{ media_player }}
        message: >-
            {{ speech_message | replace("\n","") | replace("   ","") | replace("  "," ") }}

janet_text_processing:
  sequence:
    - condition: state
      entity_id: input_boolean.janet_text_notifications
      state: 'on'
       ### change to notify you have notify.janet ###
    - service: notify.Janet
      data_template:

Now if i do a Config check I get this error:

while scanning for the next token
found character ‘%’ that cannot start any token
in “/config/scripts.yaml”, line 718, column 12

Now here is Line 718 in my Script.yaml

{% if states.input_select.janet_notification_media_player.state == 'media_player.fire_speaker' %}

Im not sure if more errors will come up after fixing this, but i hope to figure it out sooner or later.

automations.yaml (Now I placed this before the scripts and everything came back OK in Check Config)

- id: good place
  alias: Good Place Greeting
  trigger:
  - platform: state
    entity_id: device_tracker.coreys_iphone_x
    from: 'no'
    to: 'yes'
    for: '00:01:00'
  action:
  - wait_template: >-
      {{ not is_state('media_player.fire.speaker', 'playing') }}
      - service: script.speech_engine
        data_template:
        personarriving: >
          {% set person = "Your name" %} {% set person = trigger.entity_id.split('.')[1]|replace('_', ' ')%}
          {%- macro greeting_sentence(person) -%}
          {{ [
          "Welcome back home " ~ person,
          "Guess who is home " ~ person + " is!",
          person + " is now in the house.",
          "Welcome Home " ~ person + ".  We have missed you. Or at least I did.",
          "Our home is now complete, Rest your head and relax your feet Welcome Back " ~ person,
          "Life is like a song, you’re back where you belong, Welcome home " ~ person,
          "Hey there " ~ person + " Welcome Home!",
          "Knock Knock. Who is There " ~ person + " is!",
          person ~ " You are home!",
          "I know a secret " ~ person + " is home!"
          ] | random }}
          {%- endmacro -%}
          {{greeting_sentence(person)}}
          call_no_announcement: 1

- alias: Corey Greeting
  trigger:
  - platform: state
    entity_id: device_tracker.coreys_iphone_x
    from: 'no'
    to: 'yes'
    for: '00:01:00'
  action:
  - wait_template: >-
      {{ not is_state('media_player.fire_speaker', 'playing') }}
  - service: script.speech_engine
    data_template:
      personarriving: >
        {% set person = "Corey" %}  {% set person = trigger.entity_id.split('.')[1]|replace('_', ' ')%}
        {%- macro greeting_sentence(person) -%}
        {{ [
        "Welcome back home " ~ person,
        "Guess who is home " ~ person + " is!",
        person + " is now in the house.",
        "Welcome Home " ~ person + ".  We have missed you. Or at least I did.",
        "Our home is now complete, Rest your head and relax your feet Welcome Back " ~ person,
        "Life is like a song, you’re back where you belong, Welcome home " ~ person,
        "Hey there " ~ person + " Welcome Home!",
        "Knock Knock. Who is There " ~ person + " is!",
        person ~ " You are home!",
        "I know a secret " ~ person + " is home!"
        ] | random }}
        {%- endmacro -%}
        {{greeting_sentence(person)}}
        call_no_announcement: 1

input_number.yaml

  janet_notification_volume:
    name: Volume
    icon: mdi:volume-high
    min: 0.0
    max: 1.0
    step: 0.01
    initial: 1.0

  janet_notification_witty:
    name: Witty
    icon: mdi:auto-fix
    min: 0
    max: 100
    step: 1
    initial: 80

input_select.yaml

  janet_notification_media_player:
    name: Source
    icon: mdi:speaker
    options:
      - media_player.fire_speaker
      - MPD  
    initial: media_player.fire_speaker

Does anybody know if I’m missing anything or see anything I should have changed.
I am using the new HassOs

Also is - ### change to notify you have notify.janet ### this just a line to tell me notify.janet will be installed after a restart?

Thanks to anybody who can help a brother out!


#181

{% if states.input_select.janet_notification_media_player.state == ‘media_player.fire_speaker’ %} <== the media_player.fire_speaker inside bracket has to match input_select.janet_notification_media_player

try copy and paste this. Check the indent and see the color has to be similar like other script.

janet_speech_engine:
  sequence:
    - service: script.janet_notification_hub
      data_template:
         media_player: >-
           {% if states.input_select.janet_notification_media_player.state == 'media_player.fire_speaker' %}  media_player.fire_speaker
           {% else %} media_player.fire_speaker
           {% endif %}

#182

Lol, as with my luck that now works but now my automation has errors. The colors look ok and the spacing looks ok, but im sure im missing a small detail.

- id: corey_janet
  alias: Corey Greeting
  trigger:
  - platform: state
    entity_id: device_tracker.coreys_iphone_x
    from: 'not_home'
    to: 'home'
    for: '00:01:00'
  action:
  - wait_template: >-
        {{ not is_state('media_player.fire_speaker', 'playing') }}
  - service: script.speech_engine
    data_template:
    personarriving: >
      {% set person = "Corey" %}
      {%- macro greeting_sentence(person) -%}
      {{ [
      "Welcome back home " ~ person,
      "Guess who is home " ~ person + " is!",
      person + " is now in the house.",
      "Welcome Home " ~ person + ".  We have missed you. Or at least I did.",
      "Our home is now complete, Rest your head and relax your feet Welcome Back " ~ person,
      "Life is like a song, you’re back where you belong, Welcome home " ~ person,
      "Hey there " ~ person + " Welcome Home!",
      "Knock Knock. Who is There " ~ person + " is!",
      person ~ " You are home!",
      "I know a secret " ~ person + " is home!"
      ] | random }}
      {%- endmacro -%}
      {{greeting_sentence(person)}}
    call_no_announcement: 1

#183

Invalid config for [automation]: expected a dictionary for dictionary value @ data[‘action’][1][‘data_template’]. Got None
extra keys not allowed @ data[‘action’][1][‘personarriving’]. Got None. (See /config/configuration.yaml, line 125). Please check the docs at https://home-assistant.io/components/automation/


#184

Copy and paste below for Corey Greeting to welcome you back home.

  - alias: Corey Greeting
    trigger:
      - platform: state
        entity_id: device_tracker.coreys_iphone_x
        from: 'not_home'
        to: 'home'
        for: '00:01:00'
    action:
      - wait_template: >-
          {{ not is_state('media_player.fire_speaker', 'playing') }}   
      - service: script.janet_speech_engine
        data_template:
          personarriving: >        
            {% set person = "Corey" %}
            {%- macro greeting_sentence(person) -%}
            {{ [
            "Welcome back home " ~ person,
            "Guess who is home " ~ person + " is!",
            person + " is now in the house.",
            "Welcome Home " ~ person + ".  We have missed you. Or at least I did.",
            "Our home is now complete, Rest your head and relax your feet Welcome Back " ~ person,
            "Life is like a song, you’re back where you belong, Welcome home " ~ person,
            "Hey there " ~ person + " Welcome Home!",
            "Knock Knock. Who is There " ~ person + " is!",
            person ~ " You are home!",
            "I know a secret " ~ person + " is home!"
            ] | random }}
            {%- endmacro -%}
            {{greeting_sentence(person)}}
          call_no_announcement: 1

#185

Ok, now thats working. im getting this error.

Log Details (WARNING)
Sun Jul 15 2018 00:37:42 GMT-0400 (Eastern Daylight Time)

Unable to find service notify/janet

janet_text_processing:
  sequence:
    - condition: state
      entity_id: input_boolean.janet_text_notifications
      state: 'on'
       ### change to notify you have notify.janet ### **(Am I supposed to change something here?)**
    - service: notify.Janet
      data_template:
        title: "Janet:"
    message: >-
      {{ speech_message | replace("\n","") | replace("   ","") |
         replace("eight hundred and sixty one thousand","861.000") }}

I figured out the notify.janet had to be changed to notify.corey (sometimes i miss the obvious)

now this error, im looking into it now.

Unable to find service notify/corey
1:18 AM core.py (WARNING)
Error during template condition: UndefinedError: ‘str object’ has no attribute ‘fire_speaker’
1:18 AM helpers/condition.py (ERROR)


#186

see the line

  • service: notify.janet #<=== you have to change this to notify you have example notify.ios_your_iphone or notify.telegram_name_you_have or pushbullet. What notify you have in HA change to according to what you have.

If you don’t have any notify text message. then just turn off janet text notification on frontend of ha.


#187

I do have notify.ios_corey

I havent been able to get zone location other then myself to work. But the service is showing.

I do think the Janet automation isn’t working because of

2018-07-15 21:46:56 ERROR (MainThread) [homeassistant.helpers.condition] Error during template condition: UndefinedError: ‘media_player’ is undefined