Home Assistant : Q&A, Tips & Tricks, Your Configs

w1tw0lf

Expert Member
Joined
Sep 29, 2009
Messages
1,034
Here is how I have an audio play on the google home speaker

Code:
service: media_player.play_media
target:
  entity_id: media_player.family_room_speaker
data:
  media_content_id: https://"url":8123/local/test.mp3
  media_content_type: audio/mp3

url: would be the address of home assistant. It should also work with /local/*.mp3 but haven't tried it.

Used this site. https://ttsmp3.com/ to create the mp3 from text.
 

xrapidx

Honorary Master
Joined
Feb 16, 2007
Messages
39,404
Here is how I have an audio play on the google home speaker

Code:
service: media_player.play_media
target:
  entity_id: media_player.family_room_speaker
data:
  media_content_id: https://"url":8123/local/test.mp3
  media_content_type: audio/mp3

url: would be the address of home assistant. It should also work with /local/*.mp3 but haven't tried it.

Used this site. https://ttsmp3.com/ to create the mp3 from text.
Quite a bit of extra work though? I also suppose it wouldn't work for dynamic autmoations?
 

w1tw0lf

Expert Member
Joined
Sep 29, 2009
Messages
1,034
Quite a bit of extra work though? I also suppose it wouldn't work for dynamic autmoations?
I only have 3 audio notifications at the moment. Each running on their own as different automations.

With dynamic I would say tts would be the best for a dynamic automation, but then also haven't tried done anything like that yet.
 

SAguy

Executive Member
Joined
Nov 4, 2013
Messages
8,832
Here is how I have an audio play on the google home speaker

Code:
service: media_player.play_media
target:
  entity_id: media_player.family_room_speaker
data:
  media_content_id: https://"url":8123/local/test.mp3
  media_content_type: audio/mp3

url: would be the address of home assistant. It should also work with /local/*.mp3 but haven't tried it.

Used this site. https://ttsmp3.com/ to create the mp3 from text.
Also cool, I didn't think about being able to just play any media.
I think I need to have some fanfare music play when I walk into the house after a night out drinking... my wife would love that.
 

w1tw0lf

Expert Member
Joined
Sep 29, 2009
Messages
1,034
Also cool, I didn't think about being able to just play any media.
I think I need to have some fanfare music play when I walk into the house after a night out drinking... my wife would love that.
Mine currently have a "welcome home" playing. Have a 10 minute delay on it, just to incase we not in the house yet
 

ebendl

Expert Member
Joined
Sep 27, 2004
Messages
4,496
I use the TTS notifications all the time. Originally started with my old fashioned intercom making a beep-noise and causing my dogs to go wild -- barking even if they were inside the house. Woke up the kids etc.

So switched over to a 433Mhz doorbell button + a Sonoff RF Bridge (with Tasmota) and TTS notifications just saying "Doorbell"

Much more civilised :)
 

xrapidx

Honorary Master
Joined
Feb 16, 2007
Messages
39,404
I use the TTS notifications all the time. Originally started with my old fashioned intercom making a beep-noise and causing my dogs to go wild -- barking even if they were inside the house. Woke up the kids etc.

So switched over to a 433Mhz doorbell button + a Sonoff RF Bridge (with Tasmota) and TTS notifications just saying "Doorbell"

Much more civilised :)
I've done the same, but have to keep changing the audio - dogs keep learning what it is and to balstic.
 

Fjorko

Expert Member
Joined
Jan 17, 2007
Messages
1,915
I have the opposite issue. I use node red to cast to my home mini speakers and it works as expected
But if I use the lovelace UI to send a text then it just beeps as if the speaker is tuning on then nothing.

Any idea on how to fix that?
The home minis have Google dns hard coded. If you use DYNDNS, for example Duckdns, then

1. block Google Dns IP (8.8.8.8) on your router
2. Install Adguard for home assistant and make that your internal DNS
3. Do a url rewrite of your external url to your internal IP with Adguard that points to the IP of your server hosting your media file you want to play on the minis.

This will force the minis to use Adguard as their DNS. So instead of Google then trying to resolve your external url, your internal dns will resolve it, see that there is a url rewrite rule, and be able to internally connect to the device that hosts your media. If you don't do this Google will try to resolve the name of that server, but will never be able to connect to it, hence the beeps only.

I do this to cast an alarm sound (mp3) that sits on an internal raspberry pi 4 to two nest minis at the same time when the alarm is triggered using the Alarmo plugin in for HA.

Hope that helps.

Oh I forgot to say, I do all this because my HA is running via SSL, so I'm forced to have a split brain dns setup. You may not need to do this if you're only using vanilla http.
 
Last edited:

TedLasso

Expert Member
Joined
Feb 23, 2016
Messages
2,642
I was trying to follow the
I added this under sensor:
sensor:
- platform: efergy
app_token: ""
utc_offset: -120
monitored_variables:
- type: instant_readings
- type: budget
- type: cost
period: day
currency: R
- type: amount
period: day
- type: current_values
- platform: integration
source: sensor.energy_consumed
name: "Energy Consumption"

then this:
utility_meter:
daily_energy:
source: sensor.energy_consumed
cycle: daily

This brings up the sensor under the energy tab. Strangely it is not a 100% match. Maybe someone more clever can point out the issue with the source code.

So I finally was trying to do this yesterday, and i was not winning. Guess what, 2021.11 has official Efergy support as an integration now. It still didn't work as expected (taking in the config from configuration.yaml) so I just deleted it and started again.

1636015334071.png

It seems to work well. I no longer have real time updates showing in HA, but the utilisation seems to match what I see in efergy app. Next stop. Maybe adding actual costs.

1636015264762.png
 

mrb13676

Active Member
Joined
Sep 30, 2007
Messages
73
I'm about at the smae point - total NOOB but have integrated the efergy hub onto the energy tab. I have no idea how to adjust the tarrif according to the stepped tariff implemented by CoJ - anyone had any success doing this?
 

xrapidx

Honorary Master
Joined
Feb 16, 2007
Messages
39,404
I'm about at the smae point - total NOOB but have integrated the efergy hub onto the energy tab. I have no idea how to adjust the tarrif according to the stepped tariff implemented by CoJ - anyone had any success doing this?
I created a sensor which basically does a if comparison on the monthly usage and adjusts the rate. Will try post it when I get access to my server, lost the keys with my laptops demise.
 

gg za

Well-Known Member
Joined
Jul 17, 2008
Messages
102
I created a sensor which basically does a if comparison on the monthly usage and adjusts the rate. Will try post it when I get access to my server, lost the keys with my laptops demise.
You can use a utility sensor with different tariffs based on time of use.

 

xrapidx

Honorary Master
Joined
Feb 16, 2007
Messages
39,404
I'm about at the smae point - total NOOB but have integrated the efergy hub onto the energy tab. I have no idea how to adjust the tarrif according to the stepped tariff implemented by CoJ - anyone had any success doing this?
Here's what I did:

Code:
    current_eskom_kw_rate:
      friendly_name: "Current Eskom Unit rate"
      value_template: "{% if (states.sensor.monthly_energy.state | float <= 600) %}
                        1.82
                        {% else %}
                        3.10
                        {% endif %}"
      unit_of_measurement: "R/kWh"
 

MidnightZA

Expert Member
Joined
Mar 9, 2013
Messages
1,722
The home minis have Google dns hard coded. If you use DYNDNS, for example Duckdns, then

1. block Google Dns IP (8.8.8.8) on your router
2. Install Adguard for home assistant and make that your internal DNS
3. Do a url rewrite of your external url to your internal IP with Adguard that points to the IP of your server hosting your media file you want to play on the minis.

This will force the minis to use Adguard as their DNS. So instead of Google then trying to resolve your external url, your internal dns will resolve it, see that there is a url rewrite rule, and be able to internally connect to the device that hosts your media. If you don't do this Google will try to resolve the name of that server, but will never be able to connect to it, hence the beeps only.

Ive been try to get this working last week and I gave up at one point. I have no idea how to do step 1 and 3.

I tried step 2 but I dont think its done correctly. If I google something like "dishwasher", Ill get some shopping ads at the top of the results, but if I click on it then it gives an error ( I think some dns error). Is that meant to happen with adguard or was there meant to be no ads at all?

EDIT: I should also mention im using duckdns to access my Pi from outside my network.
 
Top