Janet (The Good Place)

which media player from your source support tts.google_say. click on the 3 dots from your media player you will see text to speech. if support then you can use that media player. check the name to of the media player in source to match the entity id. not every media_player you have support tts, so you have to check which one is support.

Mine I use his old speech_engine which i have to state the entity_id that match from input_select.

example:

input_select:
  notification_media_player:
    name: Source
    icon: mdi:speaker
    options:
      - HA
      - LG
    initial: HA

example from my script speech_engine

speech_engine:
  sequence:      
    - service: script.notification_hub
      data_template:
        media_player: >-
          {% if states.input_select.notification_media_player.state == 'LG' %}  <== this from input_select
             media_player.lg_tv_remote  <=== entity_id of my media_player
          {% else %}
             media_player.ha_speaker  <=== default is this entity_id to be used from input_select is HA
          {% endif %}
          
        speech_message: >-

If anyone is interested here is a simple automation to change the TTS output, change to suit your setup:

#TTS Output Change

  - alias: Janet Change Output Night
    trigger:
      - platform: state
        entity_id: switch.wemo_bedroom
        to: 'on'
    
    condition:
      condition: and
      conditions:
        - condition: time
          after: '21:00:00'
          before: '06:59:00'
          
    action:
      - service: input_select.select_option
        data:
          entity_id: input_select.janet_notification_media_player
          option: "Master Bedroom - Home"
      - service: input_number.set_value
        data:
          entity_id: input_number.janet_notification_volume
          value: '0.45'
          
  - alias: Janet Change Output Day
    trigger:
      - platform: time
        at: '07:01:00'
    
    condition:
      condition: and
      conditions:
        - condition: time
          after: '07:00:00'
          before: '20:59:00'
          
    action:
      - service: input_select.select_option
        data:
          entity_id: input_select.janet_notification_media_player
          option: "Kitchen - Home"
2 Likes

Hi i am new to hass.io. How do I install this?

Great piece of work @Lentron

I’m looking for a strategy to move all my notifications (text and TTS) over to Janet and am wondering whether it is best to move all templates I currently have in automations and scripts entirely to Janet as skills or rather use the CustomMessage.

I have larger templates e.g. for looping over all entities in a battery_group to let me know of any batteries that are running low. Would I create a new skill like this in the janet_speech_engine script:

{%- macro check_low_batteries() -%}
  {%- for ... -%}
    ...
  {%- endfor -%}
{%- endmacro -%}

And then invoke it like this in the automation:

action:
  - service: script.janet_speech_engine
    data:
      check_low_batteries: 1

Or rather using the CustomMessage like this:

action:
  - service: script.janet_speech_engine
    data_template:
      CustomMessage: >
        {%- macro check_low_batteries() -%}
          {%- for ... -%}
            ...
          {%- endfor -%}
        {%- endmacro -%}

@geoffrey , thankyou for your feedback. As to your question, I think it would be great for the community if you’re willing to add your automations to the Janet Skills. This way everyone can benefit from the automations you made. If you’d like I can add you to the Github, so you can add these skills yourself.

I haven’t added new skills in a while already, but there is still much room for improvement. Your help would be greatly appreciated.

Some I put as custom message and some I put as call. I this it is depend, but both works.

The automation can make janet to inform you without asking in certain condition like event after work auotmation that Mr. Lentron has provided.

I have recently, use conversation to ask janet also, I feel like both way communication and I love it so much.
Then I just register telegram bot polly and since I have conversation added already. I can text via telegram bot to inform me the status of the house that I put in conversation.

I use this guide to communicate between telegram bot to home assistant to turn on-off light, switch whatever I want. This guide is so useful.

I love home assistant. Janet, conversation, telegram bot

3 Likes

@Sunonline do you have a github? I would like see yours configs.

Sorry. I don’t have or save anything on github.

But if you are interesting to use janet, conversation or telegram bot like the video. I can help with that ^^

So you can share with us janet.yaml? It was very cool.

Extra automation skill to greet people that are back home.

  - alias: Sun Greeting
    trigger:
      - platform: state
        entity_id: device_tracker.suniphone
        from: 'not_home'
        to: 'home'
        for: '00:01:00'
    action:
      - wait_template: >-
          {{ not is_state('media_player.ha_speaker', 'playing') }}    
      - service: script.speech_engine
        data_template:
          personarriving: >
            {% set person = "Sun" %}  # 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
1 Like

Extra automation to check my family location

  - alias: My Family Location
    trigger:
      - platform: state
        entity_id: input_boolean.whoishome_status
        from: 'off'
        to: 'on' 
    action:
      - wait_template: >-
          {{ not is_state('media_player.ha_speaker', 'playing') }}    
      - service: script.speech_engine
        data_template:
          whoishome: >
            {%- if is_state('device_tracker.suniphone', 'home') and is_state('device_tracker.dianaiphone', 'home') -%}
              You are both home.
            {%- else -%}          
              Diana is at {{ states("sensor.diana_open_street_map") }} and Sun is at {{ states("sensor.sun_open_street_map") }} .
            {% endif %}  
          call_no_announcement: 1         
          call_bye: 1          
      - delay: 00:00:15
      - service: input_boolean.turn_off
        entity_id: input_boolean.whoishome_status

Extra automation to check alarm clock status. Most of the skill or in speech_engine which have to be add in.

  - alias: Alarm Clock Status
    trigger:
      - platform: state
        entity_id: input_boolean.alarm_clock_status
        from: 'off'
        to: 'on' 
    action:
      - wait_template: >-
          {{ not is_state('media_player.ha_speaker', 'playing') }}     
      - service: script.speech_engine
        data:
          call_greeting: 1
          call_alarm_clock_check: 1
          call_no_announcement: 1 
          call_bye: 1           
      - delay: 00:00:15
      - service: input_boolean.turn_off
        entity_id: input_boolean.alarm_clock_status   

in speech_engine

  {%- macro alarm_clock_check() -%}
    Alarm clock weekday status is {{ states('input_boolean.alarmclock_wd_enabled') }} at {{ states('sensor.alarmclock_wd_time_template') }} and alarm clock weekend status is {{ states('input_boolean.alarmclock_we_enabled') }} at {{ states('sensor.alarmclock_we_time_template') }}.
  {%- endmacro -%}

  {% if call_alarm_clock_check == 1 %}
    {{ alarm_clock_check() }}
  {% endif %}

Extra automation for security check

  - alias: Security Status
    trigger:
      - platform: state
        entity_id: input_boolean.security_status
        from: 'off'
        to: 'on' 
    action:
      - wait_template: >-
          {{ not is_state('media_player.ha_speaker', 'playing') }}     
      - service: script.speech_engine
        data:
          call_greeting: 1
          call_inform: 1          
          call_security_check: 1
          call_no_announcement: 1 
          call_bye: 1              
      - delay: 00:00:15
      - service: input_boolean.turn_off
        entity_id: input_boolean.security_status  

speech_engine

  {%- macro security_check() -%}
    S1C alarm status is {{ states('sensor.key_fob') }}. SSH alarm status is {{ states('alarm_control_panel.ssh') }}. Office camera motion status is {{ states('switch.office_camera_motion') }} and office camera record status is {{ states('switch.office_camera_alarm') }}.
  {%- endmacro -%}   

  {% if call_security_check == 1 %}
    {{ security_check() }}
  {% endif %}

Extra automation for system check

  - alias: System Status
    trigger:
      - platform: state
        entity_id: input_boolean.system_status
        from: 'off'
        to: 'on' 
    action:
      - wait_template: >-
          {{ not is_state('media_player.ha_speaker', 'playing') }}     
      - service: script.speech_engine
        data:
          call_greeting: 1
          call_inform: 1          
          call_system_check: 1
          call_no_announcement: 1 
          call_bye: 1               
      - delay: 00:00:15
      - service: input_boolean.turn_off
        entity_id: input_boolean.system_status 

speech_engine

  {%- macro system_check() -%}
    CPU temperature is {{ states('sensor.cpu_temp') }} °C. Processor is running at {{ states('sensor.processor_use') }} %. Memory used is {{ states('sensor.memory_use_percent') }} %. Disk used is {{ states('sensor.disk_use_percent_') }} % and your last reboot is {{ states('sensor.ha_last_reboot') }}.
  {%- endmacro -%}  

  {% if call_system_check == 1 %}
    {{ system_check() }}
  {% endif %}

Extra automation home assistant status

  - alias: Home Assistant Status
    trigger:
      - platform: state
        entity_id: input_boolean.homeassistant_status
        from: 'off'
        to: 'on' 
    action:
      - wait_template: >-
          {{ not is_state('media_player.ha_speaker', 'playing') }}     
      - service: script.speech_engine
        data:
          call_greeting: 1
          call_inform: 1          
          call_homeassistant_check: 1
          call_no_announcement: 1 
          call_bye: 1            
      - delay: 00:00:15
      - service: input_boolean.turn_off
        entity_id: input_boolean.homeassistant_status

speech_engine

Home Assistant installed version is {{ states('sensor.installed_ha_version') }}. Database size is {{ states('sensor.ha_db_size') }} Megabytes. Uptime running is {{ states('sensor.ha_uptime') }}. SSL certificate is expiring in {{ states('sensor.ssl_cert_expiry') }} days and currently {{ states('sensor.connected_clients') }} clients are connected to Home Assistant.
  {%- endmacro -%}

  {% if call_homeassistant_check == 1 %}
{{ homeassistant_check() }}
  {% endif %}

@Sunonline thanks friend.

Your welcome.

can u tell me more about that sensor open_street_map? how its configure?

I use this for open street map

1 Like