-
-
Save xbmcnut/e238c00ec929e357e46462675dce3988 to your computer and use it in GitHub Desktop.
script: | |
speak_garage_status: | |
alias: 'Ask Google for Garage Status' | |
sequence: | |
- delay: | |
seconds: 2 | |
- service: tts.google_say | |
entity_id: | |
- media_player.kitchen_home | |
- media_player.insignia_speaker | |
data_template: | |
message: >- | |
The garage door is currently {{states('sensor.garage_status')}} | |
speak_pool_status: | |
alias: 'Ask Google for Pool Temperature' | |
sequence: | |
- delay: | |
seconds: 2 | |
- service: tts.google_say | |
entity_id: | |
- media_player.kitchen_home | |
- media_player.insignia_speaker | |
data_template: | |
message: >- | |
The pool temperature is currently {{states('sensor.pool_temperature')}} degrees | |
## Template takes only the time value in 24hr time ## | |
speak_next_high_tide: | |
alias: 'Ask Google for next High Tide time' | |
sequence: | |
- delay: | |
seconds: 2 | |
- service: tts.google_say | |
entity_id: | |
- media_player.kitchen_home | |
- media_player.insignia_speaker | |
data_template: | |
message: >- | |
The next high tide is at {{ as_timestamp(states.sensor.onetaunga_bay_tides.attributes.high_tide_time_utc) | timestamp_custom("%H:%M") }} |
Ok, so i first changed the switch wording to script, then restarted, and I also confirmed with the template tool that it is spitting out the right info ("22.26c")
But I can't seem to add script.speak_power_rates
to Lovelace? Do I do that by clicking the plus on the main dash, adding a toggle? I cant work out how to actually add it.
And I also again synced all the google devices and tried asking "turn on speak power rates", but again she "couldn't understand"..?
Update: I added the line service_name: google_say
to my TTS, and now when I go to Configurator>Scripts, and press play on this, it does broadcast the correct info to all my google speakers!
But still, when I ask google "hey google, turn on speak power price" she doesn't understand. Same goes for my "hey google, power price" routine..
Just add an entity to LL and start typing script...... and it should find your script. Then you can fire it from the dash. Let me know what happens.
@ptrg13 I'm unsure how Google integrates with Home Assistant on the do it yourself version as I use Nabu Casa. Best to test with a switch or light first (add the dummy component if you don't have any switches or lights yet) as those will show in the Google Home app once synched.
Yep, so I added it as a single entity, it by default said OFF. So I clicked on it, then clicked execute. When I did this, it ran, and all my devices responded correctly with the price.
So I think my google minis aren't triggering this when I ask them directly
Solved it! I needed to add the line: expose_by_default: true above my exposed entities, and voila! its working... ITS WORKING (in 8yo Anakin voice).
Thank you again for all your help, absolute ANZAC spirit! haha. I wouldn't have stood a chance without your ongoing help. :)
Well that's great to hear. Well done. It's awesome when you finally get something working!
There's one remaining (small) issue. My wife cannot run this script from her Google home account. When I make the identical routine on her phone, and run it, Google replies "not sure"..
Her GH can see all the room assigned switches etc, but c nt access the script.
I read on another forum that assigning a room to the script in the config can make these scripts "appear" as an item in GH, do you know if this is correct? (I think remember seeing an example that replicated the "- script" for each room. Reckon this can make them "appear" as they seem to do for some people?
Sorry, here's the correct link
https://community.home-assistant.io/t/cannot-share-some-linked-entities-in-google-home-app/137614
You all need to be part of one home with added people, not everyone with their own account. https://support.google.com/assistant/answer/9155535?hl=en
Yeah I thought that was it, but I checked and my wife is definitely already a home member ( already listed under "people in this home")
She can see a test added HA switch for a bhyve timer I added in her GH, but like mentioned in that thread, she can't "access" the script.
It doesn't show as a "device" (not does it for me), and when she replicates my routine, she gets a "sorry..."
If she doesn't have the routine and tries the same routine trigger I have "hey Google power price" Google says sorry (but I can ask the same question straight after and get the correct response)..
I've got my wife to test a script tonight and it does not work for here though other routines that don't use scripts do. I'll look into that room theory when I get some time.
Well, I’m not sure what I did, but I got it working? Like I mentioned, my wife could see the HA switches, so I went to Routines, created a new one, “add actions” then “browse popular actions”.
There it was, speak_power_rates, on her google home.
So I added it, made a voice trigger, and voila!
One final, some what unrelated question for you, absolutely fine if you can’t answer it or it’s outside your knowledge.
I am trying to setup a IFTTT trigger, from HA, to change a wifi light colour.
In other words, I’m hoping, when the power price is say below 24c, so send a trigger to IFTTT. A second trigger would be when price is between 24.01 and 35c, and a third trigger would be anything greater than 35c.
I’m not sure if a multi-option trigger can be sent beyond on/off, but even if it’s 3 individual triggers, that would be fine.
I’m looking at runing this in HA service tab (obviously with the ifttt and it’s API key added to my config)
Domain: ifttt
Service: tigger
Service domain: {"event": "EventName", "value1": "Hello World", "target": "YOUR_KEY_NAME1"}
I think the first 2 stay the same, but how would I translate my data required (say a first range trigger from -999c to 24.00c) ?
That way I could have a lamp set up which, being always on, will change colour based on the power price.
Cheers for any assistance (once again!)
Or would an automation and script be a better idea?
# Example configuration.yaml Automation entry
automation:
alias: Startup Notification
trigger:
platform: homeassistant
event: start
action:
service: script.ifttt_notify
data_template:
value1: 'HA Status:'
value2: "{{ trigger.event.data.entity_id.split('_')[1] }} is "
value3: "{{ trigger.event.data.to_state.state }}"
and
#Example Script to send TestHA_Trigger to IFTTT but with some other data (homeassistant UP).
ifttt_notify:
sequence:
- service: ifttt.trigger
data_template: {"event":"TestHA_Trigger", "value1":"{{ value1 }}", "value2":"{{ value2 }}", "value3":"{{ value3 }}"}
Edit, I have been experimenting (trial and many errors) in template with the following
value_template: "{% if states.sensor.amber_general_usage_price.state | float > 35.005 %} red {% endif %}"
value_template: "{% if states.sensor.amber_general_usage_price.state | float < 23.00 %} green {% endif %}"
value_template: "{% if states.sensor.amber_general_usage_price.state | 23.005 < float > 35.00 %} yellow {% endif %}"
The current price is dictating the red and green text to be output (currently only outputting green due to the price being below 23c right now). But I can’t get yellow working. Is there a particular format needed to do a greater than AND less than?
Is any of this event helpful in creating a trigger for IFTTT lol?
Probably best to post on HA forum as everyone gets to benefit from the solution. Personally, I wouldn't involved IFTTT unless you have no other choice as it will add unnecessary delays.
What do you mean by cloud config? Is this added to the config.yaml? Which files am I editing here?
What do you mean by cloud config? Is this added to the config.yaml? Which files am I editing here?
In configuration.yaml
## Includes ##
automation: !include automations.yaml
binary_sensor: !include_dir_merge_list binary_sensor
cloud: !include cloud.yaml
That points us to a file in your config folder called cloud.yaml
and all code above is in there.
What do you mean by cloud config? Is this added to the config.yaml? Which files am I editing here?
In
configuration.yaml
## Includes ## automation: !include automations.yaml binary_sensor: !include_dir_merge_list binary_sensor cloud: !include cloud.yaml
That points us to a file in your config folder called
cloud.yaml
and all code above is in there.
That's helpful, thank you. Any ideas why I am getting this error:
Since I couldn't add cloud.yaml, pasted the script code in script.yaml.
This what my script.yaml looks like:
script:
speak_last_feed:
alias: 'Ask Google for Last Feed'
sequence:
- delay:
seconds: 2
- service: tts.google_say
entity_id:
- media_player.bedroom_speaker
- media_player.kitchen_speaker
- media_player.living_room_speaker
data_template:
message: >-
The last feed was {{ as_timestamp('sensor.last_feeding')}}
This is what my configuration.yaml looks like
Example configuration.yaml entry
google_assistant:
project_id:
service_account: !include SERVICE_ACCOUNT.JSON
report_state: true
exposed_domains:
- switch
- input_boolean
- input_select
- script
- media_player
- sensor
entity_config:
switch.speak_last_feed:
name: speak_last_feed
aliases:
- Last Feed
-
@ptrg13 You can also copy
The power currently costs
{{states('sensor.amber_general_usage_price')}} cents` into Developer Tools > Template too and see if it spits out the right information.