Richdem
(Richard Carter)
April 5, 2019, 12:13am
1
Hi All,
I am pretty new to Home Assistant, I have it running on an old Dell laptop with Linux Mint. I managed to get my lights connected to my Wink Hub 2 working and now I would like to experiment further. I have been trying to create a horizontal stack card showing sunrise time and sunset time. I am really struggling to understand how to do this. I tried watching youtube videos but they all seem to use the older lovelace UI and make entries in the configuration.yaml
I am using the latest version and can add the horizontal stack card right from the interface but I do not know how to ad the code to get it working
Any help would be greatly appreciated
Lovelace is the current interface. If you select to edit the UI you can then use that menu again to access and edit the raw yaml behind the interface.
Richdem
(Richard Carter)
April 5, 2019, 12:57am
3
Thank you but how do I add new sensors such as sunrise & sunset?
Here is an example from another thread:
Maybe the documentation helps:
You can see that the times shown in the /dev-state are in UTC.
When you display the values in your GUI, however, they are automatically converted to your local timezone by using the entries in your configuration file. Same is valid for using these times in automations, conditions, etc.
Use this set up as a template sensor:
- platform: template
sensors:
# Sunset & Sunrise
next_sunrise:
friendly_name: Sunrise
value_template: '{{ as_timestam…
1 Like
First you need a template sensor:
sensor:
- platform: template
sensors:
nextsunrise:
entity_id: sun.sun
friendly_name: 'Next Sunrise'
value_template: >
{{ as_timestamp(states.sun.sun.attributes.next_rising) | timestamp_custom(' %I:%M %p') | replace(" 0", "") }}
icon_template: mdi:weather-sunset-up
nextsunset:
entity_id: sun.sun
friendly_name: 'Next Sunset'
value_template: >
{{ as_timestamp(states.sun.sun.attributes.next_setting) | timestamp_custom(' %I:%M %p') | replace(" 0", "") }}
icon_template: mdi:weather-sunset-down
then in Lovelace:
- type: vertical-stack
cards:
- type: entities
title: Season, Sun & Moon Phase
show_header_toggle: false
entities:
- sensor.nextsunrise
- sensor.nextsunset
I have a vertical stack but you get the idea?
looks like this:
27 Likes
Richdem
(Richard Carter)
April 5, 2019, 2:01am
6
That is exactly what I wanted. I copied the 1st block of text in to my configuration.yaml but got the following error when I checked it.
I put it in the section where I have other sensors
petro
(Petro)
April 5, 2019, 2:04am
7
Your spacing is off. Post your yaml if you can’t figure it out. The error is telling you where to look, the spacing it wants starts at line 54 and screws up at 57. So you have to determine if the spacing is correct at 54 or 57
yeah when I pasted the yaml it got mangled… I edited…
Richdem
(Richard Carter)
April 5, 2019, 2:07am
9
so your original post is now correct?
Richdem
(Richard Carter)
April 5, 2019, 2:14am
11
OK the config worked,
For the 2nd block of text do I create a manual card?
paste it in using raw mode
Richdem
(Richard Carter)
April 5, 2019, 2:23am
13
Perfect,
It worked ! I added an entity card with both sunrise & sunset. Is that correct?
Thank you David and to everyone else that helped
1 Like
Hi
Followed your steps, and got this error in raw mode:
No card type found
[
{
“type”: “vertical-stack”,
“cards”: [
{
“type”: “entities”,
“title”: “Season, Sun & Moon Phase”,
“show_header_toggle”: false,
“entities”: [
“sensor.nextsunrise”,
“sensor.nextsunset”
]
}
]
}
]
I got rid of the error msg. But the sensor.nextsunrise and sensor.nextsunset, the hassio cant find, how do i set up those?
david78455
(David78455)
October 9, 2019, 8:35pm
16
Thanks for your answer, I also used it
Can you please explain how can I set a sensor that will get the value of the sunset with offset ?
Regards
David
Mutt
(Muttley)
October 9, 2019, 9:05pm
17
you mean get the sunset and then subtract 30 mins from that ???
Why would you need that ?
david78455
(David78455)
October 10, 2019, 6:55pm
18
Yes exactly.
Pray time depend on the sunset with some offset
Regards
David
petro
(Petro)
October 10, 2019, 7:00pm
19
So i might be making an assumption here, but did you know about islamic_prayer_times component ?
david78455
(David78455)
October 10, 2019, 7:06pm
20
No. I am a Jewish
I am familiar with the Jewish Calendar
but it does not help me in my case
Regards
David