Janet (The Good Place)

Can I use like this?

text_processing:
  sequence:
    - condition: state
      entity_id: input_boolean.text_notifications
      state: 'on'
          
    - service: notify.ios_sun_iphone
      data_template:
        title: "Janet:"
        message: >- 
          {{ speech_message | replace("\n","") | replace("   ","") | replace("eight hundred and sixty one thousand","861.000") }}

Work now. Thank you so much. I use ios platform.

She really answer me back. “Hi there,”

Can I put 2 services in text_processing? : one is ios and another one is tts.google_say?

1 Like

No sound from tts.google_say

This is from personal component. for ios (The text and speech notifications are turn on. Speaker is default ha speaker which I can type in from media_player to say out text. But no sound out from script.speech_engine.

text_processing:
  sequence:
    - condition: state
      entity_id: input_boolean.text_notifications
      state: 'on'
          
    - service: notify.ios_sun_iphone
      data_template:
        title: "Janet:"
        message: >- 
          {{ speech_message | replace("\n","") | replace("   ","") | replace("eight hundred and sixty one thousand","861.000") }}
          
    - service: tts.google_say
      data_template:
        title: "Janet:"
        message: >- 
          {{ speech_message | replace("\n","") | replace("   ","") | replace("eight hundred and sixty one thousand","861.000") }}

@Sunonline tts commands are managed in script speech_processing

1 Like

Try and work now. Very very good. I try from available calls like call_introduction. Have to restart few times.

1 Like

Created a a pull request for you to move everything into packages and renamed entities with janet_ The reason for that is so people can just drop that file in packages and it won’t conflict with any existing entities they have if the y have identical names, some of the ones used are pretty common.

https://github.com/Lentron/Janet---Home-Assistant/pull/1

2 Likes

If you feel up for adding me as a contributor/owner I can edit the repo directly to make it a little easier.

2 Likes

I will try your package this evening. I found that one of the automation. which has service automation.reload does effect other of my automation. So I didn’t use it. Also I have put delay on start up automation because I already have the tts.google say out on home assistant start, this to check that tts works and also my home-assistant has started.

I added the location inquiry skill. I haven’t added a sample automation yet, but it is called with:

 - service: script.janet_speech_engine
   data:
     call_location_inquiry: 1
     person: "Michael"

It took me a while to find a workaround for the limited for-loop functionality in yaml, but i got it eventually.

screenshot:

The packag file you have made have the + sign in front of every line which cannot use. After delete the +, I’m not sure whether it is correct with space and indent. The config pass but speech engine on startup didn’t work. So I seperate the script files out of the package.

I will try again this evening.

From the latest you made and post to github. You have to change the name (alias) of the automation to start with “Janet” as well to according to the group.
Example “Start Up” to “Janet Start Up”

Also the service in the automation
Example “- service: script.speech_engine” to “- service: script.janet_speech_engine”

For the automation Janet update available, regarding the sensor name if you don’t have that like I do. I disable this automation with #

I cannot use the package file you provided. HA can load but Janet will not greeting me. No sound and text at all. I have to seperate the script files from the package. I can put all automation in 1 package file.

Call location inquiry works nicely ^^
Thank you so much for your hard work and shares to all of us.

1 Like

@Sunonline I’m running Janet from the Github package now aswell ( instead of from my local files ), and i haven’t noticed any problems. But if you do, then make a pull request please.

Also, for upgrades sake:

  • script.speech engine should be a seperate file.
  • Every skill should also be a seperate file

This way with every update you only have to override script.speech_engine and copy/past the new skill, while you keep your own configuration.

Atm i’m working on a rain warning before a given event, for example:

  • After work it will be raining xx mm. You might want to change your schedule.
  • Before the meeting there will be xx mm rain. Maybe you should carpool.

I’ll post the update when I got it working.

I added the rain warning skill. I haven’t added a sample automation, but here is an example:

 - alias: "Rain: after work"
  trigger:
    - platform: time
      at: '16:15:00'
  conditions:
    - condition: time
      weekday:
        - mon
        - tue
        - wed
  action:
    - service: script.janet_speech_engine
      data:
        "call_greeting": 1
        "call_inform": 1
        "call_rain_warning": 1
        "Event": "after work"
      data_template:
        "WeatherRain": >-
          {{ states.sensor.buienradar_precipitation_forecast_total.state + " " + states.sensor.buienradar_precipitation_forecast_total.attributes.unit_of_measurement }} 

screenshot:

I use this for my rain sensor, but you can use any platform:

@Lentron Hi Mario, quick question:

Do you think is possible to add Janet some wine-skills? Like knowledge of wines, pairing, and a little wine-cellar management (which wine you have for example)?

I will reinstall HA and Janet this weekend and I would love something like that, happy to help you in writing or adding this skillset

2 Likes

@fdicarlo Marlo* If you can think of it, you can make it :slight_smile:

feel free to add any skill you’d like. I’m just setting a few rules:

  • It’s a family friendly package, so whatever you add has to be family friendly.
  • Any skill you add has to be usable by everyone ( add parameters instead of directly refering to sensor states in script.janet_speech_engine )
  • Any skill you add has to have a resulting message nomatter the outcome ( i.e. no result returns in unknown() + witty( error(), chance ) )
  • before i accept your pull request please post some sort of working example + a screenshot of the working result.

Welcome onboard :wink:

2 Likes

Been trying to get this working all day with no luck. Using the github package files (janet.yaml and janet_automations.yaml). When I try and call the janet_speech_engine service i get an error in the logs showing this:

2018-01-17 21:00:53 WARNING (MainThread) [homeassistant.components.script] Script script.janet_speech_engine already running.

I get no notifications via text or voice.

I’ve changed the media players to mine, I’ve changed the text notify to my html5 one, and I’ve made the changes advised above to rename some services to have janet_ infront of them.

Any ideas?

Hmm, is that the only error in that log? There should be one further up that is more descriptive of why the script failed.

Thats the only one when I call the service manually.

I just restarted homeassistant and on startup i get this error…

2018-01-17 21:16:25 ERROR (MainThread) [homeassistant.core] Error executing service <ServiceCall script.janet_speech_engine: call_greeting=1, call_introduction=1>
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/template.py", line 118, in async_render
    return self._compiled.render(kwargs).strip()
  File "/srv/homeassistant/lib/python3.5/site-packages/jinja2/environment.py", line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File "/srv/homeassistant/lib/python3.5/site-packages/jinja2/environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/srv/homeassistant/lib/python3.5/site-packages/jinja2/_compat.py", line 37, in reraise
    raise value.with_traceback(tb)
  File "<template>", line 156, in top-level template code
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/template.py", line 411, in forgiving_round
    value = round(float(value), precision)
jinja2.exceptions.UndefinedError: 'None' has no attribute 'state'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/core.py", line 1010, in _event_to_service_call
    yield from service_handler.func(service_call)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/script.py", line 163, in service_handler
    yield from script.async_turn_on(variables=service.data)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/script.py", line 215, in async_turn_on
    yield from self.script.async_run(kwargs.get(ATTR_VARIABLES))
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/script.py", line 151, in async_run
    yield from self._async_call_service(action, variables)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/script.py", line 181, in _async_call_service
    self.hass, action, True, variables, validate_config=False)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/service.py", line 80, in async_call_from_config
    config[CONF_SERVICE_DATA_TEMPLATE]))
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/service.py", line 76, in _data_template_creator
    for key, item in value.items()}
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/service.py", line 76, in <dictcomp>
    for key, item in value.items()}
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/service.py", line 78, in _data_template_creator
    return value.async_render(variables)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/template.py", line 120, in async_render
    raise TemplateError(err)
homeassistant.exceptions.TemplateError: UndefinedError: 'None' has no attribute 'state'

@davemc The only state that is being called in janet_speech_engine is that of tne media_player input_select. It was referencing to: notification_media_player instead of janet_notification_media_player

i just fixed that in the github, see if that fixes the error for you

Thanks, now instead of that error on startup, I just get the first one, like if I had called it manually.

2018-01-17 21:28:35 WARNING (MainThread) [homeassistant.components.script] Script script.janet_speech_engine already running.

I’m completely stumped.

Is anyone running it directly from the github package files with no additional files? Nothing split down anymore?

Edit: Still getting the same error, even with the changes.

2018-01-17 21:38:24 ERROR (MainThread) [homeassistant.core] Error executing service <ServiceCall script.janet_speech_engine: call_introduction=1, call_greeting=1>
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/template.py", line 118, in async_render
    return self._compiled.render(kwargs).strip()
  File "/srv/homeassistant/lib/python3.5/site-packages/jinja2/environment.py", line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File "/srv/homeassistant/lib/python3.5/site-packages/jinja2/environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/srv/homeassistant/lib/python3.5/site-packages/jinja2/_compat.py", line 37, in reraise
    raise value.with_traceback(tb)
  File "<template>", line 156, in top-level template code
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/template.py", line 411, in forgiving_round
    value = round(float(value), precision)
jinja2.exceptions.UndefinedError: 'None' has no attribute 'state'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/core.py", line 1010, in _event_to_service_call
    yield from service_handler.func(service_call)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/script.py", line 163, in service_handler
    yield from script.async_turn_on(variables=service.data)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/components/script.py", line 215, in async_turn_on
    yield from self.script.async_run(kwargs.get(ATTR_VARIABLES))
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/script.py", line 151, in async_run
    yield from self._async_call_service(action, variables)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/script.py", line 181, in _async_call_service
    self.hass, action, True, variables, validate_config=False)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/service.py", line 80, in async_call_from_config
    config[CONF_SERVICE_DATA_TEMPLATE]))
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/service.py", line 76, in _data_template_creator
    for key, item in value.items()}
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/service.py", line 76, in <dictcomp>
    for key, item in value.items()}
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/service.py", line 78, in _data_template_creator
    return value.async_render(variables)
  File "/srv/homeassistant/lib/python3.5/site-packages/homeassistant/helpers/template.py", line 120, in async_render
    raise TemplateError(err)
homeassistant.exceptions.TemplateError: UndefinedError: 'None' has no attribute 'state'