Quantcast
Channel: Configuration - Home Assistant Community
Viewing all 95295 articles
Browse latest View live

Reuse value_template

$
0
0

@basvankuijck wrote:

I currently have this sensor:

---
platform: template
sensors:
  garbage_paper:
    friendly_name: 'Papier'
    entity_id: sensor.time, sensor.afval
    value_template: >-
      {% set date = strptime(state_attr('sensor.afval', 'paper'), '%Y-%m-%dT%H:%M:%S%z') %}
      {% set diff = as_timestamp(date) - as_timestamp(strptime(states.sensor.date_time.state, "%Y-%m-%d, %H:%M")) %}      
      {% set days = diff | timestamp_custom("%j") | int %}
      {% set hours = (diff / 3600) | int %}
      {% if days == 1 %}Morgen{% elif days == 2 %}Overmorgen{% elif days > 0 %}Over {{ days }} dagen{% elif hours > 0 %}Over {{ hours }} uur{% else %}Zometeen{% endif %}
      
  garbage_organic:
    friendly_name: 'GFT'
    entity_id: sensor.time, sensor.afval
    value_template: >-
      {% set date = strptime(state_attr('sensor.afval', 'organic'), '%Y-%m-%dT%H:%M:%S%z') %}
      {% set diff = as_timestamp(date) - as_timestamp(strptime(states.sensor.date_time.state, "%Y-%m-%d, %H:%M")) %}      
      {% set days = diff | timestamp_custom("%j") | int %}
      {% set hours = (diff / 3600) | int %}
      {% if days == 1 %}Morgen{% elif days == 2 %}Overmorgen{% elif days > 0 %}Over {{ days }} dagen{% elif hours > 0 %}Over {{ hours }} uur{% else %}Zometeen{% endif %}

  garbage_other:
    friendly_name: 'Rest + Plastic'
    entity_id: sensor.time, sensor.afval
    value_template: >-
      {% set date = strptime(state_attr('sensor.afval', 'other'), '%Y-%m-%dT%H:%M:%S%z') %}
      {% set diff = as_timestamp(date) - as_timestamp(strptime(states.sensor.date_time.state, "%Y-%m-%d, %H:%M")) %}      
      {% set days = diff | timestamp_custom("%j") | int %}
      {% set hours = (diff / 3600) | int %}
      {% if days == 1 %}Morgen{% elif days == 2 %}Overmorgen{% elif days > 0 %}Over {{ days }} dagen{% elif hours > 0 %}Over {{ hours }} uur{% else %}Zometeen{% endif %}

Which parses pickup dates for my garbage bins into readable date formats (in Dutch).

As you can see the value_template for each sensor is almost identical (apart from the attribute definition; paper, organic, other). It all works well, but I’m not happy with the duplication of the ‘code’.

Isn’t there a way this can be improved so I can only have one place that handles the parsing of these dates.

Maybe in the lovelace card itself? Any ideas are welcome.

Posts: 3

Participants: 2

Read full topic


Room with light for 16 hours with sun sensor

$
0
0

@GenGT wrote:

Hello,

I need some help to do what i want as simple as possible, and if you could help me it would be great.

I want a room with light during 16 hours, from 6:00 to 22:00 so I have a light bulb to do so. The room is illuminated during the sun light, so the light will be only enabled when the sun is down and between the time range.

For example sun rise is on at ‘7:00’ and sun set is on at ‘21:00’, so I need to turn on the light only from 6 to 7 in the morning, and 21 to 22 in the night.

A big thanks for advanced

Posts: 3

Participants: 2

Read full topic

Google Calendar Event - where are the reminders?

$
0
0

@honikos wrote:

Hi there!
I need a hint from experts.
Integration of google calendar card works well, but I am not able to show reminders or tasks as events on frontend. Reminders and tasks seem to be system generated google calendars and events from this calendars are shown by users choice in the calendar . Seems something to to with google calendar api. Is there a workaround?

Thanks for help!

Posts: 1

Participants: 1

Read full topic

Wink in trouble?

$
0
0

@Dayve67 wrote:

I have been seeing some news about Wink is in trouble and could possibly stop working.

With about 90% of my devices on the wink hub I’m a little concerned if they will continue to work. What would you guys suggest is an alternative to integrate my devices? Maybe smartthings or will local control still work with the Wink hub?

Posts: 6

Participants: 4

Read full topic

Emby intergration after restart of HA

$
0
0

@Dayve67 wrote:

Just setup the Emby integration with HA. Got all my TV’s and computers added to lovelace. Everything is fine until i restart HA and some of the devices change the entity names to something different and then i need to go in to lovelace and update the entity name to see them again.

Is anyone also seeing this and is there a way around it?

Posts: 1

Participants: 1

Read full topic

Unwanted delay in light Automation

$
0
0

@f00dagi wrote:

Hi!

I want to turn on multiple lights at the same time.

I have so far tried automation, group lights and scenes but have been unsuccessful. The easiest setup seems to be an automation triggered by a time stamp as code example below. What happens when I run the automation is that the first light turn on immediately but there is an (exact) delay of 10 seconds between each following light turning on. Adding more lights to the automation adds additional 10 seconds of delay between each light turning on. If I trigger two lights manually they both switch on immediately.

Any advice is most welcome!

- id: '1570825239747'
  alias: Time
  trigger:
  - at: '12:08'
    platform: time
  condition: []
  action:
  - data:
      entity_id: light.lounge_vagg
    service: light.turn_on
  - data:
      entity_id: light.lounge_tak
    service: light.turn_on

Posts: 5

Participants: 4

Read full topic

Theme not fully changing in automation

$
0
0

@koenhaemels wrote:

Hi

My themes changes properly when switching it in my profile.
But when i use it in an automation my theme isn’t fully changing. The background color for example stays the same while all of the rest changes. Any help for this?

- id: '1551955724336'
  alias: Set Clear Theme
  trigger:
  - at: '10:00:00'
    platform: time
  condition: []
  action:
  - data:
      name: clear
    service: frontend.set_theme
- id: '1551955789664'
  alias: Set Dark Theme
  trigger:
  - at: '22:00:00'
    platform: time
  condition: []
  action:
  - data:
      name: dark
    service: frontend.set_theme

Posts: 4

Participants: 2

Read full topic

Anyone have logic for detecting bedtime?

$
0
0

@jwelter wrote:

I have an input_boolean for bedtime that gets set at 11:30pm and off at 5:30am. Also a manual over-ride and tied into Alexa so we can tell her to enter/exit bedtime mode.

But would like to add some more intelligence that if we go to bed before 11:30 this mode would be turned on earlier.

Anyone have a good example of similar? Perhaps using the bayesian sensor?

Posts: 8

Participants: 8

Read full topic


Shopping_list api marking complete

$
0
0

@k-9 wrote:

I’m trying to make items complete on my shopping list through the api. I can successfully get all the items on my shopping list, add new items and even clear all the completed items on the shopping list all through api calls. But when it comes to updated an item to completed I can’t seem to make it work.

this url will return all my items:
http://homeassistant.local:8123/api/shopping_list/

I can add items with this url using json in body name: test
http://home assistant.local:8123/api/shopping_list/item

according to this page: https://github.com/home-assistant/home-assistant/blob/a119932ee590b9115afc97ddf56b9a95fd9f2c00/homeassistant/components/shopping_list/init.py
i should be able to use http://home assistant.local:8123/api/shopping_list/item/{ENTER MY ITEM ID }
to update my items as being complete , but all i get is {“message”:“Item not found”}

Anybody try this before? Anybody had any success?

Posts: 1

Participants: 1

Read full topic

Template Switch not working

$
0
0

@michelde wrote:

Hi,

I want to achieve to play my Sonos speaker when I turn on a switch. Using an automation is working fine, but I don’t understand why it’s not working with a template switch. So my automation which works looks:

- id: '1572181424930'
  alias: Sonos Kitchen
  description: ''
  trigger:
  - entity_id: switch.sonos_kuche_switch
    from: 'off'
    platform: state
    to: 'on'
  condition: []
  action:
  - data:
      entity_id: media_player.kuche
    service: media_player.media_play

Now I disabled this automation and created a template switch as follows:

- platform: template
  switches:
    sonos_kuche_switch_template:
      friendly_name: "Kitchen Radio Switch"
      value_template: "{{ is_state('switch.sonos_kuche_switch', 'on') }}"
      turn_on:
      - data:
          entity_id: media_player.kuche
        service: media_player.media_play
      turn_off:
      - data:
          entity_id: media_player.kuche
        service: media_player.media_pause

Using the developer tools I can see that the state of the new template switch is evaluated correct using the value template. But for some reason my turn_on and turn_off actions are not working.

Does anyone what I’m making wrong?

Posts: 3

Participants: 3

Read full topic

Multizone Audio Questions - HA Newb

$
0
0

@samgreco wrote:

I have HA dealing with all of my lighting, including using MQTT and Node-Red to communicate with my old software that supports UPB lighting that HA does not. It works really well. I have been learning scripting and using it for scene controls. And that works great.

Also have Google Home working well.

But I am having a difficult time wrapping my head around multizone audio/music using the hardware I have and local MP3 files, etc. And how to deal with the UI once I get the backend working Selecting music to send to the zones, etc.

Here’s what I have:
Vaux LA-1600A 16X16 stereo matrix switch/controller. Using it to control 5 sources of audio and 11 zones of output, going to a 18 channel amplifier (9 stereo zones) and a couple of receivers. It is controllable via RS232.

Inputs are MP3 files coming from 3 sets of outputs on a media server to 3 of the inputs on the Vaux. AN AM/FM tuner, And a Chromecast. I have more outputs on the server available and am think to use one set for TTS output.

So I have no idea where to even start making this work. I want to be able to select from the 25,000+ MP3 files I have and send them to any of the zones. Or Pandora, Spotify, etc to the Chromecast and then to the Vaux’s ins and outs.

I know that the norm around here is to use multiple chromecasts, squeezeboxes, or RPis. But I have the infrastructure in place already, with a central equipment location and all of the speakers wired in ceiling. Plus, we tend to “group” zones on the fly around here. So we’ll be listening to music in the kitchen and then decide to add the office or the living room as we go. And with 11 zones, it’s hard to imagine preassigned groups for all of the possibilities.

Hope this all makes sense. I’d be greatful for any help.

Posts: 1

Participants: 1

Read full topic

P1 Gas Meter incremental values

$
0
0

@HanSyt wrote:

I am using a Wemos D1 mini to sent my P1 Meter readings through MQTT to HA. This works like a charm for Electricity. However, when it comes to gas usage, the P1 only sents the total amount of gas that is used.
I would like to read the incremental values in a graph, to find out where most gas is used (eg showering, heating).

So fat I manged to do so by using automation to read the triggers from_state and its current state.
Code (hope I get it right in this post)

# Check previous reading
 - alias: "Get Gas usage Delta"
   trigger:
    - platform: state
      entity_id: sensor.p1_gas_usage
   action:
    - service: var.set
      # value_template: {{ (((trigger.to_state.state|float) - (trigger.from_state.state|float)) *1000) | round(2) }}
      data_template:
        entity_id: var.diff_gas_usage
        value: 1 # {{ (((states('trigger.to_state') | float) - (states('trigger.from_state') | float)) *1000) | round(2) }}
    - service: notify.notify
      data_template:
        title: 'Gas Usage:'
        message: >-
          Momentarely Gas Usage {{ (((trigger.to_state.state|float) - (trigger.from_state.state|float)) *1000) | round(2) }}

The good news is, the automation above is able to sent a message with the amount of gas used. That’s nice, but not enough, I would like to have a graph.
So I used the “var” integration to define a variable:

var:
  diff_gas_usage:
    friendly_name: "Diff Gas Usage"
    unit_of_measurement: "dm3"
    initial_value: 0
    icon: mdi:counter

This works, I have a graph, I can manipulate it from the automation, settings its value form 0 to 1 vv.
Only ane thing is not working, the formula used in the message is not working to assign its value to the variable (diff_gas_usage). I already used value_template: instead of value: but config check doesn’t accept it.

Anyone an idea what I’m missing to set the value?

I know that the state does not change to zero at the moment, due to there is no state change, probably will sove this later with mqtt topic update time, or set it back to zero directly after.

Posts: 1

Participants: 1

Read full topic

How to change Hass.Io Docker installation configuration folder?

$
0
0

@Ricardo_Franco wrote:

Hey guys ,

Recently moved from Home Assistant to Hass.io docker install .

In Home Assistant it was easy to pick the configuration folder from a parameter at runtime.

How can I change my default configuration folder in a docker installation of Hass.io ?

I have multiple templates I want to try and being limited to using /usr/share/hassio/homeassistant as my main configuration folder would be extremely cumbersome for being able to switch easily between each different setup .

Couldn’t really find any info on how to do this .

Thanks !

Posts: 2

Participants: 2

Read full topic

Show last 5 edited images from a folder

$
0
0

@Craig_McGowan wrote:

I have my doorbell cam capturing images in motion and the Deepstack to tell if there is a person detected, if so, an image is saved with a timestamp, as well as a latest image.

I’m showing the latest image in HA, which is simple as I know the file name remains the same. However, how would I show the last 5 images captured by the camera?

They would be the last 5 files modified in a folder but I can’t work out how to get this information to display them dynamically?

Thanks for any assistance

Posts: 1

Participants: 1

Read full topic

Password Reset Hass.io Web User (in Docker?)

$
0
0

@PeachShooter wrote:

Hi folks;
I’m sure its been answered before but i had terrible luck w/ search.

My setup:
Hass.io (in docker ce) on Ubuntu 18. Raspberry PI 4B

After i uploaded my new config and automation yaml through git - the reboot seems to have crapped out my webui user/password.

How do i reset it? I have access to the images via docker exec /bin/bash

Web search determined i need to remove the ./storage folder (can’t seem to locate this).

Any help is appreciated!!

Cheers,
Peachez.

Posts: 1

Participants: 1

Read full topic


ERROR (MainThread) [homeassistant.setup] Error during setup of component config Traceback

$
0
0

@hschroyen wrote:

Hello,

After years of using homeassistant my installation seems to be broken.
I have the habit of checking the config before a reboot…so also this time.
I rebooted but it did not come back.

The error log shows most of the lines as info and the first line with an error is

2019-10-27 21:00:44 ERROR (MainThread) [homeassistant.setup] Error during setup of component config
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 168, in _async_setup_component
    hass, processed_config
  File "/usr/src/homeassistant/homeassistant/components/config/__init__.py", line 66, in async_setup
    await asyncio.wait(tasks)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 389, in wait
    return await _wait(fs, timeout, return_when, loop)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 482, in _wait
    await waiter
concurrent.futures._base.CancelledError
2019-10-27 21:00:44 ERROR (MainThread) [homeassistant.setup] Error during setup of component group
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 168, in _async_setup_component
    hass, processed_config
  File "/usr/src/homeassistant/homeassistant/components/group/__init__.py", line 212, in async_setup
    await _async_process_config(hass, config, component)
  File "/usr/src/homeassistant/homeassistant/components/group/__init__.py", line 369, in _async_process_config
    mode=mode,
  File "/usr/src/homeassistant/homeassistant/components/group/__init__.py", line 484, in async_create_group
    await component.async_add_entities([group], True)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 251, in async_add_entities
    await asyncio.wait(tasks)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 389, in wait
    return await _wait(fs, timeout, return_when, loop)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 482, in _wait
    await waiter
concurrent.futures._base.CancelledError

Nothing I did helps. Even not putting back config files.

Please help/advice

Regards

Posts: 3

Participants: 2

Read full topic

Any way to edit the date/time output from a entity to display in a different format?

$
0
0

@ghurty wrote:

I have an integration that i added that ads a few entities it creates. One of the outputs is date/time like this “2019-11-01 17:39:00-04:00”. Is there a way for me edit the way the time is displayed?

Thank you

Posts: 3

Participants: 3

Read full topic

Zooz ZSE29 - Automation with HA

$
0
0

@ozarn wrote:

Hello everyone,
My fist post here and i am a newbie when it comes to HA, just started. Please forgive my stupid questions . I am very excited to be part of this community .

I am running HA on a docker hosted on Ubuntu VM. I got a Aeotec USB controller and my first Z-wave device is a Zooz ZSE 29 motion sensor.
I was able to pair it with Z-wave controller and add it to HA. When i go to HA > Configuration > Z-Wave management i see it and its showing Node Complete & i can see multiple entities for it. It does show status “sleeping” and i am not sure if that is normal .
I tried to create a test automation: when motion is detected to turn the lights on outside. I tried manually and using HA GUI by going to devices > selecting Motion Sensor > and below was section for Automation & Do something when … Zooz ZSE29 Outdoor Motion Sensor Sensor Turned on.

here is automation using gui:

- id: '1572198965302'
  alias: Motion
  description: ''
  trigger:
  - device_id: ae5f4495bc264849afc0ca3e3e9632a8
    domain: binary_sensor
    entity_id: binary_sensor.zooz_zse29_outdoor_motion_sensor_sensor
    platform: device
    type: turned_on
  condition: []
  action:
  - device_id: b59974be66d540838d17170d4a30af31
    domain: light
    entity_id: light.hue_color_lamp_2
    type: turn_on

here is what i did manually:

- id: '1572205913130'
  alias: Test for Motion
  description: ''
  trigger:
  - device_id: ae5f4495bc264849afc0ca3e3e9632a8
    domain: binary_sensor
    entity_id: binary_sensor.zooz_zse29_outdoor_motion_sensor_sensor
    platform: device
    type: turned_on
  condition: []
  action:
  - data:
      entity_id: switch.outside_lights
    service: switch.turn_on

When i walk by, i see sensor blinks red but nothing happens. When trigger Automation manually, the lights turn on that means my automation is working.

Any pointers how to get this resolved? i spend many hours on it. How can i tell that Motion Sensor is sending a trigger to HA?

Front Yard Motion Sensor ZooZ Sleeping
node_id: 4
node_name: Zooz ZSE29 Outdoor Motion Sensor
manufacturer_name: Zooz
product_name: ZSE29 Outdoor Motion Sensor
query_stage: Complete
is_awake: false
is_ready: true
is_failed: false
is_info_received: true
max_baud_rate: 40000
is_zwave_plus: true
capabilities:

  • beaming
  • routing
  • zwave_plus
    neighbors:
  • 1
    sentCnt: 14
    sentFailed: 0
    retries: 0
    receivedCnt: 8
    receivedDups: 0
    receivedUnsolicited: 0
    sentTS: '2019-10-27 12:41:35:074 ’
    receivedTS: '2019-10-27 12:41:35:072 ’
    lastRequestRTT: 27
    averageRequestRTT: 30
    lastResponseRTT: 45
    averageResponseRTT: 52
    battery_level: 0
    wake_up_interval: 14400
    application_version: ‘1.04’
    friendly_name: Front Yard Motion Sensor ZooZ

Thanks in advance for support .

Posts: 13

Participants: 2

Read full topic

Binary sensor not updating with time change

$
0
0

@FutureTense wrote:

I have the following binary sensor which should return true if the current time falls in between the values of two input_datetime entities. If I set the “end” input_datetime to the current time the sensor reports True as expected. However, when the time moves past the end time the sensor still reports true.

I actually have an additional input_boolean as part of this binary_sensor (not shown) and if I turn it off and on after the time progresses the sensor reports the correct value.

Why isn’t the sensor updating every time “now().strftime(’%H%M’)” changes? Any ideas on how I can fix this?

    range_sensor:
      value_template: "{{

((states.input_datetime.starttime.attributes.timestamp  | timestamp_custom('%H%M', False) | int ) | int  <=  (now().strftime('%H%M')  | timestamp_custom('%H%M', False) | int)) and 

  ((states.input_datetime.endtime.attributes.timestamp  | timestamp_custom('%H%M', False) | int ) | int  >=  (now().strftime('%H%M')  | timestamp_custom('%H%M', False) | int)) }}"

Posts: 14

Participants: 4

Read full topic

Error rendering template: UndefinedError: 'value_json' is undefined

$
0
0

@pfertig wrote:

I’m attempting to use this sensor

  - platform: mqtt
    name: "washer_watts"
    state_topic: "tele/SNF-Washer/SENSOR"
#    value_template: "{{value_json.energy['Power']}}"
    qos: 2
    unit_of_measurement : "W"
    icon: mdi:flash-circle
    availability_topic: "tele/SNF-Washer/LWT"
    payload_available: "Online"
    payload_not_available: "Offline"

so that I can see how many watts are being used - to base n automation that will tell me when my washing machine has finished.
I get told that the sensor is unavailable, and in the template editor I get this error

Error rendering template: UndefinedError: ‘value_json’ is undefined

I’m probably muissing something really obvioius and or simpl but I’ve spent days pulliing my hair out over this. can’t get it to to work. Other than the above error I see none anywhere else.

Help Please.

Posts: 3

Participants: 3

Read full topic

Viewing all 95295 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>