Hi all. Got hassio working pretty sweet over the past week.
With the daily greeting I wanted to add a few simple commands in the TTS.
Example "today is Monday 18th July, the time is 7am’
Woukd anyone be so kind as to help me do this? I have installed the time and date sensors but I either get 18/07/2018 and 07:00 or nothing. I want to parse the day and date to spoken day, spoken date spoken month’ it’s more foe the kids to learn the days etc.
Seems simple but has me stuffed.
Ty
Ps I am also getting the below random errors in the log
Timer got out of sync. Resetting
01:39 core.py (ERROR)
Error scanning devices
01:38 components/device_tracker/netgear.py (WARNING)
Error talking to API
01:38 /usr/local/lib/python3.6/site-packages/pynetgear/init.py (ERROR)
Timer got out of sync. Resetting
01:36 core.py (ERROR)
Timer got out of sync. Resetting
01:24 core.py (ERROR)
Have some other small issues but first things first
{{ strptime(states('sensor.date')~'T'~states('sensor.time'), '%d/%m/%YT%H:%M').strftime('Today is %A %d %B, the time is %I %p') }}
For example, when I do this on the Template Editor page:
{{ strptime(states('sensor.date')~'T'~states('sensor.time'), '%Y-%m-%dT%H:%M').strftime('Today is %A %d %B, the time is %I %p') }}
I get this:
Today is Thursday 19 July, the time is 11 AM
Note that I’m using a slightly different format string in strptime since with my localization the date is printed differently (e.g., ‘2018-07-19’.)
Regarding the errors you’re seeing, I do see “Timer got out of sync. Resetting” from time to time. I don’t know about the netgear device_tracker errors since I’m not using that.
hypothetical / not required but a ‘would be nice’ is there any way to add a th or st to the date? ie Today is friday 20th july’ if its too hard or a lot of code dont worry just asking - thanks heaps for what you provided btw
script:
my_script:
service: tts.google_say
entity_id: media_player.bedroom_speaker
data_template:
message: >
{% set date = strptime(states('sensor.date'), '%d/%m/%Y') %}
{% set time = strptime(states('sensor.time'), '%H:%M') %}
{% set day = date.day %}
{% if day in (1,21,31) %}
{% set day = day ~ 'st' %}
{% elif day in (2,22) %}
{% set day = day ~ 'nd' %}
{% elif day in (3,23) %}
{% set day = day ~ 'rd' %}
{% else %}
{% set day = day ~ 'th' %}
{% endif %}
Today is {{ date.strftime('%A') }} {{ day }} {{
date.strftime('%B') }}, the time is {{ time.strftime('%I:%M %p') }}
There used to be instructions at the top of the page, but a week or so ago they disappeared for some reason. Basically, select the code and click the </> button.
crap you are good. Thanks so much.
If you are able to help i have a list of things im trying to get working if you have any suggestions?
this is i think a known issue, ive seen it online heaps. Cannot play local mp3 audio in an automation unless you have it in the format “https://xxxxxxx.duckdns.org:8123/local/dadshome.mp3” - i am testing at the moment adding in 192.168.0.119 xxxxx. duck.dns.org into the hosts files in /etc/ (still testing not sure if it will break anything yet)
Here is my trello board of what im trying to do next
I also need to sort out all these time sync errors + stop the “ding” on wake of the google mini’s and stop them going to sleep - but also play a notification without stopping the current music (or resume music after notification)
PS i have a mix of scripts and automations, i really need to standardize things into their own individual scripts…
Heres a chuck from my scripts.yaml (for a laugh or cringe) remember i’m a beginner…
1531882980062:
alias: Wakeup G Normal
sequence:
- service: tts.google_say
entity_id: media_player.girls
data_template:
message: 'Good Morning Penny and Phoebe!. Time to wake up! It is 7AM and you
have to get up out of bed and ready for school! Todays uniform is your normal
dress, pretty one. The weather for today is {{states.sensor.weather_hourly_summary.state}}
Have a wonderful day!'
1531866666062:
alias: ReadCal
sequence:
- service: tts.google_say
entity_id: media_player.bedroom_speaker
data_template:
message: 'You have the following on for today {{states.calendar.ourcalendar007.attributes.message}} at {{ as_timestamp(states.calendar.ourcalendar007.attributes.start_time) | timestamp_custom("%I:%M %p") }}'
153696969696969:
alias: ReadDayDate
sequence:
- service: tts.google_say
entity_id: media_player.gpmdp
data_template:
message: '{{ strptime(states("sensor.date")~"T"~states("sensor.time"), "%Y-%m-%dT%H:%M").strftime("Today is %A %B %d") }}'
#####################################
# REALLY great read day date time #
#####################################
80808080808080:
alias: DATEDAYTIMEREAD
sequence:
- service: tts.google_say
entity_id: media_player.bedroom_speaker
data_template:
message: >
{% set date = strptime(states('sensor.date'), '%d/%m/%Y') %}
{% set time = strptime(states('sensor.time'), '%H:%M') %}
{% set day = date.day %}
{% if day in (1,21,31) %}
{% set day = day ~ 'st' %}
{% elif day in (2,22) %}
{% set day = day ~ 'nd' %}
{% elif day in (3,23) %}
{% set day = day ~ 'rd' %}
{% else %}
{% set day = day ~ 'th' %}
{% endif %}
Today is {{ date.strftime('%A') }} {{ day }} {{
date.strftime('%B') }}, the time is {{ time.strftime('%I:%M %p') }}
You should post these problems in the correct forum thread.
Since it’s related to the Node-Red add-on, go there: Home Assistant Community Add-on: Node-RED
I posted the same issue there yesterday.
lol! Everything is relative. You’ve already done a shit ton more with HA than I’ll probably ever do!
I looked over your stuff, and honestly, I really don’t have any experience with most of what you’re trying to do. The only thing that I can think of is my Life360 integration, which works with iOS and Android. It’s the best location service I’ve found and I’ve been using it for years. Yes, it does require a cloud server, and yes their API isn’t formally documented or supported, but it does work and I know many people are using it. If you’re at all interested, check out: