This is one of the most weird home automation ideas I had. I’m going to be tracking my bank account thanks to home assistant and enabling notifications on my Google mini or actually any device that supports notification.
Thanks to the starling bank integration in home assistant you are able to track the effective bank balance and the outstanding bank balance. These two sensors allow you to track your bank balance, I created an automation to track the state of the sensors before the event and then the state after the event. This enabled me to calculate how much money I received in my account. To achieve this I use some templating in my automation.yaml.
Project List
- Home Assistant
- Starling Bank Account
- Google Mini or Alexa
- Nabu casa or an alternative to connect to voice assistants.
Links
Watch this video for more information:
Code
Check the name of the sensor in the developer tools, to do the notifications I’m using a script all broadcast_all
Add the following code to automation.yaml
- id: "new_bank_balance"
alias: New Bank Balance Announcement
trigger:
- platform: state
entity_id: sensor.starling_effective_balance
action:
- service: script.broadcast_all
data:
message: "You have just received £{{ (trigger.to_state.state| float - trigger.from_state.state| float)| round(2) }} which gives you a total balance of £{{ (trigger.to_state.state| float)| round(2) }}"
condition:
- condition: template
value_template: "{{ trigger.to_state.state| float > trigger.from_state.state| float }}"
Scripts.yaml
This script enables you to pass a message and broadcast to speakers thanks to Nabu Casa text to speech.
You will need to change the entity_id of the media player, the language to your own language
broadcast_all:
description: "Broadcast all of devices"
fields:
title:
description: "The Title of the notification"
example: "Example text"
message:
description: "The content"
example: "Example text"
sequence:
- service: tts.cloud_say
data:
entity_id: media_player.kitchen_speaker
message: "{{ message }}"
language: en-GB