0.115: B-Day release! Media browser, tags, automations & WTH

A number of Template Sensors that had been working flawlessly now report as UNKNOWN until I manually go to Server Controls and reload Template Entities.

Anyone else experiencing the same thing?

3 Likes

beware that the official shelly integration for shellyem is not pulling the solar export data (energy_returned/ total_returned). as a temporary stopgap you can create a rest sensor for this as below.

- platform: rest
  name: shellyem_energy_returned
  resource: http://192.168.1.75/emeter/0/returned_energy
  value_template: '{{ value_json.total_returned | multiply(0.001) | round(2) }}'
  unit_of_measurement: kWh

Thanks a lot, config worked fine afer wake up :grinning:

severel minutes later, the sensors are anavailable. should they not send the same information to HAas they send to the Shelly App. Or is the prolbem, that HA try to get the information and canā€™t wake up the device? if this ist the problem, these battery powered sensors are not usabel :disappointed_relieved:

Which sensors for doors, smoke, water and gas could you recommend?

It looks like you have templates that reference each other or themselves with an expensive filter. It likely wasnā€™t an issue before because we could not discover all the referenced states in older versions so the loop never triggered.

It would be great if you could post a copy of your template entities configuration somewhere so we can help look for a loop. Iā€™m also curious about the filter as Iā€™ve not seen one that expensive yet.

We also have additional debug log coming in 0.115.1 to help find these type of loops:

1 Like

So upon initial restart after update I saw all of the warnings about entity_id in templates, so I removed them thinking the constant logging of that message was causing a weird issue, so both of those profile.svgs are with entity_id: removed from all template sensorsā€¦
Also Im not sure if you remember I had some of those weird templates in the thread discussing now(), sensor.time etcā€¦ (I know you may not as you are a busy guy, so Iā€™ll try to find it)ā€¦ I will try to update again with the entity_id still thereā€¦ (will it use the entity_id if it needs to with 0.115? or is it completely ignored?)

Also, im not sure what you mean by ā€œan expensive filterā€ā€¦ what am I looking for?

Thanks. I remember now that the scripts and automation action syntax are basically interchangeable.

The entity_id is completely ignored now so it shouldnā€™t make any difference besides silencing the warning.

For the filter, you are looking for templates with a pipe character ā€œ|ā€ in them (sorry that is probably a lot of them).

ok tried to update history_stats from the latest git repo.

Now I get a new error:

Platform error sensor.history_stats - cannot import name 'DOMAIN' from 'custom_components.history_stats' (unknown location)

Has the custom component been upgraded to work with 0.115

Doesnā€™t appear so. Lets hope itā€™s looked into soon.

So Iā€™ll have to kind of go through my config as a lot of my template sensors are mixed in in separate includes etcā€¦ but in a quick look for the | pipe these are some I found quicklyā€¦

the first few are in the ā€œfile_outā€ for tensorflow, but are referenced in automations again in same mannerā€¦ others are just the first ones that stood out as ā€œweirdā€ ones to meā€¦

EDIT: upon looking I noticed that Lovelace Gen/Button Card Templates have tons of this type of thing in my Lovelace yaml, does this count also?:

 unlock: {{ lock_unlock|default('tap') }}

Also, my config is a messā€¦ when I get a minute I will try to upload on GitHub and give you access as I donā€™t wanna flood the thread with my garbageā€¦

- "/home/homeassistant/.homeassistant/www/cam_captures/tensorflow/side_yard/{{ as_timestamp(states.automation.tensorflow_side_yard_camera_image_processing.attributes.last_triggered)|timestamp_custom('%Y_%m_%d__%H_%M_%S-0400') }}.jpg"
- 'Philips room is {{states('sensor.sensor_temperature')|round}} degrees'
      message: >
        {% if is_state('person.amy','home') %}
           Momma is already home
        {% elif states.proximity.amy_home.attributes.dir_of_travel == 'stationary' %}
           Okay I will let you know when she leaves {{ states('sensor.amy_places_formatted_address') }}
        {% elif states.proximity.amy_home.attributes.dir_of_travel == 'away_from' %}
           Momma is still driving away from home, I'll let you know when she leaves after stopping somewhere
        {% elif states.proximity.amy_home.attributes.dir_of_travel == 'towards' %}
           Momma is at {{ states('sensor.amy_places_formatted_address') }} and should be home in {{states.sensor.amy_to_home.attributes.duration | round(0)}} minutes
        {% elif states.proximity.amy_home.attributes.dir_of_travel == 'towards*' %}
           Momma is at {{ states('sensor.amy_places_formatted_address') }} and should be home in {{states.sensor.amy_to_home.attributes.duration | round(0)}} minutes
        {% else %}
           I'm having trouble tracking her right now
        {%-endif-%}
      message: >
        {% if states.proximity.amy_home.attributes.dir_of_travel == 'towards' %}
           Attention kids Momma left {{ states('sensor.amy_places_formatted_address') }} and should be home in {{states.sensor.amy_to_home.attributes.duration | round(0)}} minutes
        {% elif states.proximity.amy_home.attributes.dir_of_travel == 'away_from' %}
           Momma left {{ states('sensor.amy_places_formatted_address') }} and seems to be going somewhere else
        {% else %}
           Attention kids Momma left {{ states('sensor.amy_places_formatted_address') }} {{relative_time(states.person.amy.last_updated)}} ago
        {%-endif-%}
      entity_id: >
        {% if is_state('sensor.darksky_precip','Rain') and states.sensor.sun_elevation.state|int <0 %}
           script.camera_motion_snap
        {% elif is_state('sensor.darksky_precip','Snow') and states.sensor.sun_elevation.state|int <0 %}
           script.camera_motion_snap
        {% elif is_state('sensor.darksky_precip','Sleet') and states.sensor.sun_elevation.state|int <0 %}
           script.camera_motion_snap
        {% elif is_state('sensor.darksky_precip','Hail') and states.sensor.sun_elevation.state|int <0 %}
           script.camera_motion_snap
        {% else %}
           script.camera_motion_snapandpush
        {%-endif-%}
        value_template: >-
          {% set input = states['input_datetime']['door_keypad_2_date_start'] %}
          {% set time_now = states['sensor']['date_time'].state | replace(',', '') ~ ':00' %}
          {% set access_schedule = states['input_select']['door_keypad_2_access_schedule'].state %}
          {{ (access_schedule == 'Temporary' or access_schedule == 'Recurring') and input.state == time_now }}
      message: >
        {% set people_home = states | selectattr('entity_id', 'in', state_attr('group.family','entity_id')) | selectattr('state','in',['home']) | map(attribute='name') | list %}
        {% if people_home | length == 1 %}
        {{ people_home[0] }} is at home
        {% elif people_home | length == 0 %}
          The house is empty
        {% else %}
        {{ people_home[:-1] | join(', ') }}{{',' if people_home | length > 2 else ''}} and {{ people_home[-1]}} are home
        {% endif %}
    value_template: >
      {{ trigger.from_state is not none and
        trigger.from_state.state|float <= 99 }}
  action:
    - service: input_datetime.set_datetime
      data_template:
        entity_id: >
          {% if trigger.entity_id == 'sensor.front_door_lock_battery_level' %}
            input_datetime.front_door_lock_batteries
          {% elif trigger.entity_id == 'sensor.side_door_lock_battery_level' %}
            input_datetime.side_door_lock_batteries
          {% elif trigger.entity_id == 'sensor.garage_door_lock_battery_level' %}
            input_datetime.garage_door_lock_batteries
          {% elif trigger.entity_id == 'sensor.bedroom_contact_sensor_battery' %}
            input_datetime.bedroom_contact_sensor_battery
          {% elif trigger.entity_id == 'sensor.sump_pump_alarm_battery_level' %}
            input_datetime.sump_pump_alarm_battery
          {% elif trigger.entity_id == 'sensor.front_door_sensor_battery' %}
            input_datetime.front_door_sensor_battery
          {% elif trigger.entity_id == 'sensor.front_doorbell_sensor_battery' %}
            input_datetime.front_doorbell_sensor_battery
          {% elif trigger.entity_id == 'sensor.side_door_sensor_battery' %}
            input_datetime.side_door_sensor_battery
          {% elif trigger.entity_id == 'sensor.side_doorbell_sensor_battery' %}
            input_datetime.side_doorbell_sensor_battery
          {% elif trigger.entity_id == 'sensor.scene_switch_battery_level' %}
            input_datetime.scene_switch_battery
          {% elif trigger.entity_id == 'sensor.multisensor_battery_level' %}
            input_datetime.multisensor_battery
          {% elif trigger.entity_id == 'sensor.motion_sensor_battery_level' %}
            input_datetime.motion_sensor_battery
          {% endif %}
        date: "{{ as_timestamp(now())|timestamp_custom('%Y-%m-%d') }}"

The only thing that stands out is that you have a bare states, as its going to enumerate all states.

You can replace

states | selectattr('entity_id', 'in', state_attr('group.family','entity_id'))

with

expand('group.family')

and it will only iterate the enitiy ids in the group.

1 Like

Love the Media Browser Player, but is there a way to mount a different drive? Would love to be able to mount any local network drive/directory.

4 Likes

Ok, Iā€™ll try that first and upgrade againā€¦ also I gave you access to my private HA repo on git, feel free to look at more of my sensors if youā€™d likeā€¦ please excuse the mess, I am not very organizedā€¦my 3 year journey with HA has had itā€™s ups and downsā€¦ as I am sure you will be able to tell from my codeā€¦ itā€™s also not secret-safe :grimacing:

I removed Kodi from my yaml and tried the integration. It takes a while to get to the second step but then it reports unexpected error on the web socket step (I have remote control enabled). If I leave the port blank it eventually places the integration into the UI but no entities are created.

I gave up, deleted the integration, replaced the yaml and restarted. I get this error:

2020-09-17 19:35:43 INFO (MainThread) [homeassistant.components.media_player] Setting up media_player.kodi
2020-09-17 19:37:58 ERROR (MainThread) [homeassistant.components.kodi.config_flow] Unexpected exception
  File "/srv/homeassistant/lib/python3.7/site-packages/pykodi/kodi.py", line 135, in connect
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/kodi/config_flow.py", line 75, in validate_ws
  File "/srv/homeassistant/lib/python3.7/site-packages/pykodi/kodi.py", line 137, in connect
pykodi.kodi.CannotConnectError
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/kodi/config_flow.py", line 221, in async_step_import
  File "/srv/homeassistant/lib/python3.7/site-packages/homeassistant/components/kodi/config_flow.py", line 82, in validate_ws
homeassistant.components.kodi.config_flow.WSCannotConnect

I have the media players on a different network than HA with specific routes in a router (not that that should matter). The setup was working fine in 0.114.

if you are doing the YAML import make sure kodi is turned on when you import it

if you are doing the YAML import make sure kodi is turned on when you import it

I guess Iā€™m not sure if ā€œturned onā€ is equivalent to running? I have dedicated ā€œmedia centersā€ where Kodi is always running (and itā€™s running when I restarted) ā€“ I took that to mean ā€œturned onā€.

Hi there,
So, might be because my english is not that perfect and I cannot ask google a good question, but, since 114 release HA Chrome application no longer works as a standalone app - it opens a new chrome tab instead and this is annoying. Am I doing something wrong or is there a bug or new chrome limitation that breaks this functionality? Thanks

The release is awesome! I am having trouble setting up the smart meter texas integration. I put in my username and password and it returns failed to connect. Any ideas? The username and password work on the site.

Edit: I tried again this morning and it worked fine.