19 Comments

Thank you so much for showing us how to do this! Super cool! The one question I have on the weather part is as soon as I put in the "Forecasted Conditions for..." section in YAML, it breaks it and it does not work anymore. No error, no message, etc. Any idea what I am doing wrong? You mentioned in the video to use the Template section to figure out the syntax (I think that is what you meant), which is where I suspect my issue is, but I am not clear what you mean. Any ideas on this? Thanks again!

Expand full comment

Hey, Top video. I'd appreciate your help please. In relation to the A.I for Kids, I'm getting an error in the Call a service "TTS", it's saying that the agent is undefined?? Any ideas please.

Expand full comment
author

Thanks! You probably didn’t save the response variable in a previous step. Double check you are saving it as “agent”.

Expand full comment

Excellent Job, the kids absolutely love it. The response variable was key for me. I was about to give up before coming across your video which lead me here. Appreciate you sharing.

Expand full comment

Awesome work, and has inspired me to implement several of my own as a result. They have encouraged my 4 year old in the mornings on the teeth brushing and listening to her parents :).

On the energy usage I took your concept but wanted it to start predicting my usage for the day given the past weeks usage and correlation to the weather and the forecast weather. So I am recording not only the kwh per day but also the min/max temp historical and rain/snow amounts. Here is my prompt:

Provide a good morning message that analyzes the past electricity usage and

weather to provide a electricity usage prediction for today based on the

forecasted weather. Historical data is provided as a set of arrays with

each value being a day. There should be a prediction for the amount of

kwh today based on the forecasted weather. You should infer the season for

[location] based on the date, temperature and if there is rain or snow

to help with the prediction. Be concise with your response, do not include

the location in the message and do not summarize the historical data in the

message.

electricity in kwh {{states('input_text.weekly_hydro_usage_json')}}

temp max celsius {{states('input_text.weekly_temperature_daily_max')}}

temp min celsius {{states('input_text.weekly_temperature_daily_min')}}

rain in mm {{states('input_text.weekly_rain_daily_amount')}}

snow in cm {{states('input_text.weekly_snow_daily_amount')}}

Weather forecast for today, temperature is in celsius, humidity is a

percentage and wind speeds in kilometers per hour -

{{daily_forecast['weather.forecast_home'].forecast[0]}}

example output responses:

Good morning, sunshine! Based on the historical electricity usage and

today's weather forecast, it looks like we're in late spring. With a

high of 23.7 degrees Celsius and a low of 15.8 degrees Celsius, plus

partly cloudy skies and no rain expected, your electricity usage for

today is predicted to be around 35 kilowatt hours. Enjoy your day, and

remember to keep those fans on standby!

----

Good morning, *****! Based on the weather forecast for today, we

have partly cloudy skies with a high of 23.7 degrees Celsius and a low

of 15.8 degrees Celsius. With no rain expected and a pleasant 40

percent humidity, it looks like a beautiful spring day ahead.

Given the historical electricity usage and today's forecast, we're

predicting an electricity usage of around 35 kilowatt hours. Enjoy

your day, and remember to keep those fans on standby for a comfortable

breeze!

The open AI config instructions I refined as well:

You are a witty, hilarious, and chipper AI that delivers messages over smart speakers in a home.

As these messages are read out loud so NEVER include emojis in your responses.

When writing measurement values in the message use the following information so they are read aloud properly: °C is degrees Celsius, kwh is kilowatt hours, km/h is kilometers per hour, mm is millimeter.

Can't wait to make some more AI automations with TTS. Super fun.

Expand full comment

Hi, thanks for the very educational video!

With text responses everything works great, however, for a light automation I want the response to be a list of integers (like "[10, 0, 255]"). Unfortunately, this results in an error as a 'list-response' does not work with the "agent.response.speech.plain.speech" format it seems.

I can't find any information on the attributes of the response variable, or how to use them. Can you help me and/or point me in the right direction?

Expand full comment

Hello! Thank you very much for sharing your project! I have rebuilt everything as it was described and everything works great!

Unfortunately, I get an error message every time the automation runs saying that I should replace the service “weather.get_forecast” with “weather.get_forecasts”. Unfortunately, the automation no longer works then. Can you help me with this?

Expand full comment
May 30·edited May 30

The problem is that the response has changed:

agent:

weather.home:

forecast:

- condition: partlycloudy

datetime: '2024-05-30T10:00:00+00:00'

so its now agent.weather.home.forecast

and needs to be written like this:

Forecasted Low Temperature for Today {agent['weather.home'].forecast[0].templow}}

Expand full comment

Can you ellaborate more?

I'm trying to replicate but will receive an error namely:

Error rendering data template: UndefinedError: 'dict object' has no attribute 'forecast'

Expand full comment

Have a look in the trace and the changed variables on the step where you get the response of the forecast, there you will see how it is nested.

Expand full comment

I guess the same with input_number.yesterdays_water_usage?

Also a collection automation that gets the current days consumption?

Can you show how?

Expand full comment
author

Just updated the post to include the full stats collection automation. Hope it helps!

Expand full comment

Hi, can you describe how you set the "input_number.yesterdays_energy_usage"? Are you running an automation?

Expand full comment
author

Hey! Yes, I have a Daily Stats Collection automation that runs at the end of the day and I grab the current days consumption and save it in a few places to helpers like this one.

Expand full comment

Perfect! Could you please share also the automation? So it would be easier to implement your solution 😬

Expand full comment
author

I updated the post to include the full daily stats collection automation. Hope it helps!

Expand full comment

Thank you so much. By importing your automation shoud I still create the helper? Or is created automatically?

I imported the automation but the helpers didn't appear :)

Expand full comment

Ok I solved creating the helpers

Expand full comment
author

Nice! Yeah you have to create those on your own.

Expand full comment