arsaboo
(Arsaboo)
February 1, 2018, 7:54pm
122
That won’t work. The trigger here is an event, so trigger.entity_id
will be none
. You can use something like (and modify it for other sensors):
action:
- service: customizer.set_attribute
data_template:
entity_id: 'sensor.forecast_1'
attribute: friendly_name
value: >
{%- set day = (as_timestamp(now()) + (1 * 86400)) | timestamp_custom("%A", True) -%}
{%- set month = (as_timestamp(now()) + (1 * 86400)) | timestamp_custom("%-m", True) -%}
{%- set date = (as_timestamp(now()) + (1 * 86400)) | timestamp_custom("%-d", True) -%}
{{ day }} ({{month}}/{{date}})
1 Like
Mmhh ok i, and for other sensor? Sorry I didn’t understand the logic
arsaboo
(Arsaboo)
February 1, 2018, 7:57pm
124
Do the same for every sensor to be initialized.
raccettura
(raccettura)
February 1, 2018, 7:58pm
125
How are you dealing with graphs? Or just not something you care about?
Now that I think about it, getting temp and humidity into one graph would be awesome.
DetroitEE
(Andrew)
February 1, 2018, 8:05pm
126
Sometimes I’ll look at the history graph for the current temperature, but I don’t have a use for much more than that. I’m sure it can be done.
Is it possible to display this in an iframe?
Firstly, thanks for publishing this and to arsaboo for improving it.
I’ve spent a sum of 18 hours trying to make this work.
I give up.
Can someone please tell me what I am doing wrong?
> 2018-02-09 20:31:11 INFO (MainThread) [homeassistant.setup] Setting up http
> 2018-02-09 20:31:11 INFO (MainThread) [homeassistant.setup] Setup of domain http took 0.0 seconds.
> 2018-02-09 20:31:11 INFO (MainThread) [homeassistant.setup] Setting up api
> 2018-02-09 20:31:11 INFO (MainThread) [homeassistant.setup] Setting up system_log
> 2018-02-09 20:31:11 INFO (MainThread) [homeassistant.setup] Setting up websocket_api
> 2018-02-09 20:31:11 INFO (MainThread) [homeassistant.setup] Setup of domain api took 0.0 seconds.
> 2018-02-09 20:31:11 INFO (MainThread) [homeassistant.setup] Setup of domain system_log took 0.0 seconds.
> 2018-02-09 20:31:11 INFO (MainThread) [homeassistant.setup] Setup of domain websocket_api took 0.0 seconds.
> 2018-02-09 20:31:11 INFO (MainThread) [homeassistant.setup] Setting up frontend
> 2018-02-09 20:31:11 INFO (MainThread) [homeassistant.setup] Setup of domain frontend took 0.0 seconds.
> 2018-02-09 20:31:11 ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: required key not provided @ data['action']. Got None
> required key not provided @ data['trigger']. Got None. (See ?, line ?). Please check the docs at (link)
> 2018-02-09 20:31:11 INFO (MainThread) [homeassistant.setup] Setting up python_script
> 2018-02-09 20:31:11 INFO (MainThread) [homeassistant.setup] Setting up updater
> 2018-02-09 20:31:11 ERROR (MainThread) [homeassistant.config] Invalid config for [sensor.darksky]: value must be at most 7 @ data['forecast'][0]. Got 16. (See ?, line ?). Please check the docs at (link)
> 2018-02-09 20:31:12 INFO (MainThread) [homeassistant.setup] Setting up sensor
> 2018-02-09 20:31:13 INFO (MainThread) [homeassistant.setup] Setting up group
> 2018-02-09 20:31:13 INFO (MainThread) [homeassistant.setup] Setting up discovery
> 2018-02-09 20:31:13 INFO (MainThread) [homeassistant.setup] Setting up sun
> 2018-02-09 20:31:13 INFO (MainThread) [homeassistant.setup] Setting up map
> 2018-02-09 20:31:13 INFO (MainThread) [homeassistant.setup] Setting up nest
> 2018-02-09 20:31:13 INFO (MainThread) [homeassistant.setup] Setup of domain python_script took 1.3 seconds.
> 2018-02-09 20:31:13 INFO (MainThread) [homeassistant.setup] Setup of domain updater took 1.3 seconds.
> 2018-02-09 20:31:13 INFO (MainThread) [homeassistant.setup] Setup of domain sensor took 0.2 seconds.
> 2018-02-09 20:31:13 INFO (MainThread) [homeassistant.setup] Setup of domain group took 0.2 seconds.
> 2018-02-09 20:31:13 INFO (MainThread) [homeassistant.setup] Setup of domain discovery took 0.2 seconds.
> 2018-02-09 20:31:13 INFO (MainThread) [homeassistant.setup] Setup of domain sun took 0.0 seconds.
> 2018-02-09 20:31:13 INFO (MainThread) [homeassistant.setup] Setup of domain map took 0.0 seconds.
> 2018-02-09 20:31:13 INFO (MainThread) [homeassistant.setup] Setup of domain nest took 0.0 seconds.
> 2018-02-09 20:31:13 INFO (MainThread) [homeassistant.setup] Setting up config
> 2018-02-09 20:31:13 INFO (MainThread) [homeassistant.setup] Setting up cloud
> 2018-02-09 20:31:13 INFO (MainThread) [homeassistant.setup] Setting up google_assistant
> 2018-02-09 20:31:13 INFO (MainThread) [homeassistant.setup] Setting up tts
> 2018-02-09 20:31:13 INFO (MainThread) [homeassistant.setup] Setup of domain config took 0.0 seconds.
> 2018-02-09 20:31:13 INFO (MainThread) [homeassistant.setup] Setting up automation
> 2018-02-09 20:31:13 INFO (MainThread) [homeassistant.setup] Setting up script
> 2018-02-09 20:31:13 INFO (MainThread) [homeassistant.setup] Setup of domain cloud took 0.0 seconds.
> 2018-02-09 20:31:13 INFO (MainThread) [homeassistant.setup] Setup of domain google_assistant took 0.0 seconds.
> 2018-02-09 20:31:13 INFO (MainThread) [homeassistant.setup] Setup of domain tts took 0.0 seconds.
> 2018-02-09 20:31:13 INFO (MainThread) [homeassistant.setup] Setup of domain automation took 0.0 seconds.
> 2018-02-09 20:31:13 INFO (MainThread) [homeassistant.setup] Setup of domain script took 0.0 seconds.
> Failed config
> automation:
> - action: [source /config/packages/weather.yaml:92]
> - data_template: [source /config/packages/weather.yaml:94]
> entityid: {{trigger.entity_id}}
> service: python_script.dark_sky_friendly_names
> alias: Update friendly names
> id: update_friendly_names
> initial_state: on
> trigger: [source /config/packages/weather.yaml:82]
> - platform: state
> entity_id: [source /config/packages/weather.yaml:84]
> - sensor.forecast_1
> - sensor.forecast_2
> - sensor.forecast_3
> - sensor.forecast_4
> - sensor.forecast_5
> - sensor.forecast_6
> - sensor.forecast_7
>
> sensor.darksky:
> platform: darksky
> api_key: a1bb1560e5557947f00171272a0a670e
> forecast: [source /config/packages/weather.yaml:7]
> - 16
> - 2
> - 3
> - 4
> - 5
> - 6
> - 7
> monitored_conditions: [source /config/packages/weather.yaml:15]
> - summary
> - precip_probability
> - wind_speed
> - cloud_cover
> - icon
> - temperature_min
> - temperature_max
> - daily_summary
> - hourly_summary
>
> Successful config (partial)
> automation:
> - action: ?
> - data_template: ?
> entityid: <homeassistant.helpers.template.Template object at 0x74720a50>
> service: python_script.dark_sky_friendly_names
> alias: Update friendly names
> hide_entity: False
> id: update_friendly_names
> initial_state: True
> trigger: ?
> - platform: state
> entity_id: ?
> - sensor.forecast_1
> - sensor.forecast_2
> - sensor.forecast_3
> - sensor.forecast_4
> - sensor.forecast_5
> - sensor.forecast_6
> - sensor.forecast_7
> sensor.darksky:```
weather.yaml:
```> # Download the Dark Sky icons from (link)
> # and save them under /www/icons/dark_sky/ in your configuration directory.
>
> sensor:
> - platform: darksky
> api_key: mykeyfromdarkskies
> forecast:
> - 16
> - 2
> - 3
> - 4
> - 5
> - 6
> - 7
> monitored_conditions:
> - summary
> - precip_probability
> - wind_speed
> - cloud_cover
> - icon
> - temperature_min
> - temperature_max
> - daily_summary
> - hourly_summary
>
> - platform: season
> - platform: template
> sensors:
> forecast_0:
> friendly_name: "Today"
> value_template: >
> {{states.sensor.dark_sky_daily_high_temperature.state|round(0)}}°/{{states.sensor.dark_sky_daily_low_temperature.state|round(0)}}°/{{states.sensor.dark_sky_precip_probability.state|round(0)}}%
> entity_picture_template: >-
> {{ '/local/icons/dark_sky/' ~ states.sensor.dark_sky_icon.state ~ '.png'}}
>
> forecast_1:
> value_template: >
> {{states.sensor.dark_sky_daily_high_temperature_1.state|round(0)}}°/{{states.sensor.dark_sky_daily_low_temperature_1.state|round(0)}}°/{{states.sensor.dark_sky_precip_probability_1.state|round(0)}}%
> entity_picture_template: >-
> {{ '/local/icons/dark_sky/' ~ states.sensor.dark_sky_icon_1.state ~ '.png'}}
>
> forecast_2:
> value_template: >
> {{states.sensor.dark_sky_daily_high_temperature_2.state|round(0)}}°/{{states.sensor.dark_sky_daily_low_temperature_2.state|round(0)}}°/{{states.sensor.dark_sky_precip_probability_2.state|round(0)}}%
> entity_picture_template: >-
> {{ '/local/icons/dark_sky/' ~ states.sensor.dark_sky_icon_2.state ~ '.png'}}
>
> forecast_3:
> value_template: >
> {{states.sensor.dark_sky_daily_high_temperature_3.state|round(0)}}°/{{states.sensor.dark_sky_daily_low_temperature_3.state|round(0)}}°/{{states.sensor.dark_sky_precip_probability_3.state|round(0)}}%
> entity_picture_template: >-
> {{ '/local/icons/dark_sky/' ~ states.sensor.dark_sky_icon_3.state ~ '.png'}}
>
> forecast_4:
> value_template: >
> {{states.sensor.dark_sky_daily_high_temperature_4.state|round(0)}}°/{{states.sensor.dark_sky_daily_low_temperature_4.state|round(0)}}°/{{states.sensor.dark_sky_precip_probability_4.state|round(0)}}%
> entity_picture_template: >-
> {{ '/local/icons/dark_sky/' ~ states.sensor.dark_sky_icon_4.state ~ '.png'}}
>
> forecast_5:
> value_template: >
> {{states.sensor.dark_sky_daily_high_temperature_5.state|round(0)}}°/{{states.sensor.dark_sky_daily_low_temperature_5.state|round(0)}}°/{{states.sensor.dark_sky_precip_probability_5.state|round(0)}}%
> entity_picture_template: >-
> {{ '/local/icons/dark_sky/' ~ states.sensor.dark_sky_icon_5.state ~ '.png'}}
>
> forecast_6:
> value_template: >
> {{states.sensor.dark_sky_daily_high_temperature_6.state|round(0)}}°/{{states.sensor.dark_sky_daily_low_temperature_6.state|round(0)}}°/{{states.sensor.dark_sky_precip_probability_6.state|round(0)}}%
> entity_picture_template: >-
> {{ '/local/icons/dark_sky/' ~ states.sensor.dark_sky_icon_6.state ~ '.png'}}
>
> forecast_7:
> value_template: >
> {{states.sensor.dark_sky_daily_high_temperature_7.state|round(0)}}°/{{states.sensor.dark_sky_daily_low_temperature_7.state|round(0)}}°/{{states.sensor.dark_sky_precip_probability_7.state|round(0)}}%
> entity_picture_template: >-
> {{ '/local/icons/dark_sky/' ~ states.sensor.dark_sky_icon_7.state ~ '.png'}}
>
> automation:
> - id: update_friendly_names
> alias: "Update friendly names"
> initial_state: 'on'
> trigger:
> - platform: state
> entity_id:
> - sensor.forecast_1
> - sensor.forecast_2
> - sensor.forecast_3
> - sensor.forecast_4
> - sensor.forecast_5
> - sensor.forecast_6
> - sensor.forecast_7
> action:
> - service: python_script.dark_sky_friendly_names
> data_template:
> entityid: '{{trigger.entity_id}}'
>
> group:
> weather_card_forecast:
> name: Forecast
> view: no
> icon: mdi:sun
> entities:
> - sensor.forecast_1
> - sensor.forecast_2
> - sensor.forecast_3
> - sensor.forecast_4
> - sensor.forecast_5
> - sensor.forecast_6
> - sensor.forecast_7```
configuration.yaml:
```>
> homeassistant:
> # Name of the location where Home Assistant is running
> name: myaddress
> # Location required to calculate the time the sun rises and sets
> latitude: mylatitude
> longitude: mylongitude
> # Impacts weather/sunrise data (altitude above sea level in meters)
> elevation: myelevation
> # metric for Metric, imperial for Imperial
> unit_system: metric
> # Pick yours from here: (link)
> time_zone: Europe/London
> # Customization file
> customize: !include customize.yaml
> # Custom Packages
> packages: !include_dir_named packages
>
> python_script: ```
My icons are saved on:
/www/icons/dark_sky/
and also on
/www/dark_sky/
the www folder is in my config directory
I am running hass.io on a raspberry pi 3, it's the latest version.
Currently my frontend looks like this:
[frontend image](https://imgur.com/a/r7BwU)
Any help appreciated.
Apologies for the formatting, I don't know how to paste code like the OP...
atomicpapa
(Glenn Morrison)
February 9, 2018, 8:48pm
129
why is one of your sensors named forecast_16? should be forecast_1. That might have something to do with it
arsaboo
(Arsaboo)
February 9, 2018, 8:56pm
130
Please delete all the codes and paste hastebin links, if that is easier. Hard to debug otherwise…
Oh yes that’s a typo, thanks. I corrected it and still get the same error.
DetroitEE
(Andrew)
February 9, 2018, 8:58pm
132
Please edit your post to use the code blocks. https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code-and-syntax-highlighting
The easier way is to use 3 of the ` symbol at the beginning and end of the code block.
Sorry, I’m crap at doing this as you can see but I am trying…
arsaboo
(Arsaboo)
February 9, 2018, 9:06pm
135
Your indentation in weather.yaml is off. Please check it against the original file .
Even after saving the raw file from git and just adding my token from dark skies it still does not work…
I tried to modify the indentation in every way imaginable but still get errors…
When I said that I wasted 18 hours cumulatively trying to fix this, I was definitely not joking.
Yesterday I started at 5PM and went to bed at 2AM.
arsaboo
(Arsaboo)
February 9, 2018, 9:09pm
137
Use http://www.yamllint.com/ to validate your YAML file.
I used a similar site yesterday and it said that it was valid…
I used your suggested one now and look at it:
I would really, really like to get this to work, can’t anybody please help? I am not asking for things to be dished out on a plate for me, because I’ve been trying to fix the problem but it’s just not working. My YAML is valid according to the tool above.
arsaboo
(Arsaboo)
February 11, 2018, 2:34pm
140
Can you paste everything again on hastebin.com (it retains the indentation) again?
Sure, I will paste it now, give me some minutes, thanks.