I am seeing a similar error, but in my case it is an error (not a warning) and I do know exactly which sensors are impacted, but I cannot figure out what changed with the way the RESTful sensors are being processed.
It seems to be a change with the RESTful integration, because I see this error …
JSON result was not a dictionary or list with 0th element a dictionary
5:07:33 PM – RESTful (WARNING) - message first occurred at 5:07:33 PM and shows up 40 times
It shows up 40 times because I have built 40 sensors. I then see this error related to the value_template of each sensor…
Template variable error: 'dict object' has no attribute 'forecasts' when rendering '{{ value_json.forecasts.tides.days[8].entries[3].type }}: {{ value_json.forecasts.tides.days[8].entries[3].dateTime|as_timestamp|timestamp_custom('%I:%M %p') }}'
5:07:33 PM – helpers/template.py (ERROR) - message first occurred at 5:07:33 PM and shows up 40 times
… which seems to follow the first error … I am reasoning there is no dict object (for some reason?) and therefore the template cannot find the attributes of that object.
All I can say is Thank you, Thank you, Thank you! The new troubleshooting history for automations is AMAZING. I recently migrated all my automations from node-red to home assistant, and diagnostics and troubleshooting were the one thing I really missed. This not only matches what was available there, but exceeds it.
Thank you again!
Supervisor should automatically be available in your integrations page, no need to install it’ll just be on this page:
I found it myself, but for some weird reason I can’t use that “my” link, it asks if I want to open the page in my home assistant, but when I click “open link” I get a 404 error?
Great release. The new automation features have been very helpful in cleaning up my config.
Being able to sort by last triggered showed me some automations that haven’t been working in quite some time. And then when trying to fix them you’ve got the debugging feature which makes it easy to troubleshoot. Filter capability is quite handy as well.
And I’m loving the Analytics website too. It’s cool to see the map fill in with users all over the globe.
Thanks for quick reply. The actual issue is that the value_template that gives the state of my RESTful sensors is failing (because there is apparently no dict object to get the values from), giving them no state. I have tested the REST request outside of Home Assistant (PostMAN), and the forecast attribute is definitely returned. If i just ignore it, I think I’ll just have a sensor with no state. Are you suggesting it is a timing thing, and at next refresh interval I will have data?
Hello,
I’ve this Error after install this new version : loading /config/configuration.yaml: Secrets not supported in this YAML
I don’t understand well what happen for secret in announced breaking change, we can’t use !secret in configuration.yaml with this version ?
I’ve for exemple configuration for influxDB in configuration.yaml with include !secret, we have to split on another yaml files to works ?
Yes, you’ll have data unless forecast is empty, which will result in that error. If you’re worried just check if forecast is defined or if it’s in the dictionary
{% if 'forecast' in value_json %}
...
{% endif %}
or
{% if value_json.forecast is defined %}
...
{% endif %}
Are you running Dwains UI Theme or Lovelace_gen? If so, wait for a fix. This was found in beta and both of these custom solutions need an update to address the issue.
OK. I understand that your strategy will avoid the error in the logs (which is a good thing), but I am sure that the response to my resource_template below, should always have data, and I am trying to understand what changed (the RESTful integration?) and whyno dict object is available to my template? I couldn’t find anything documented with the release.
Here is the resource configuration, which worked fine before upgrading::
lovelace gen already has the fix, here’s the code if you don’t want to wait. Replace the contents of config/custom_components/lovelace_gen/__init__.py with:
import os
import logging
import json
import io
import time
from collections import OrderedDict
import jinja2
from homeassistant.util.yaml import loader
from homeassistant.exceptions import HomeAssistantError
_LOGGER = logging.getLogger(__name__)
def fromjson(value):
return json.loads(value)
jinja = jinja2.Environment(loader=jinja2.FileSystemLoader("/"))
jinja.filters['fromjson'] = fromjson
llgen_config = {}
def load_yaml(fname, secrets = None, args={}):
try:
ll_gen = False
with open(fname, encoding="utf-8") as f:
if f.readline().lower().startswith("# lovelace_gen"):
ll_gen = True
if ll_gen:
stream = io.StringIO(jinja.get_template(fname).render({**args, "_global": llgen_config}))
stream.name = fname
return loader.yaml.load(stream, Loader=lambda _stream: loader.SafeLineLoader(_stream, secrets)) or OrderedDict()
else:
with open(fname, encoding="utf-8") as config_file:
return loader.yaml.load(config_file, Loader=lambda stream: loader.SafeLineLoader(stream, secrets)) or OrderedDict()
except loader.yaml.YAMLError as exc:
_LOGGER.error(str(exc))
raise HomeAssistantError(exc)
except UnicodeDecodeError as exc:
_LOGGER.error("Unable to read file %s: %s", fname, exc)
raise HomeAssistantError(exc)
def _include_yaml(ldr, node):
args = {}
if isinstance(node.value, str):
fn = node.value
else:
fn, args, *_ = ldr.construct_sequence(node)
fname = os.path.abspath(os.path.join(os.path.dirname(ldr.name), fn))
try:
return loader._add_reference(load_yaml(fname, ldr.secrets, args=args), ldr, node)
except FileNotFoundError as exc:
_LOGGER.error("Unable to include file %s: %s", fname, exc);
raise HomeAssistantError(exc)
def _uncache_file(ldr, node):
path = node.value
timestamp = str(time.time())
if '?' in path:
return f"{path}&{timestamp}"
return f"{path}?{timestamp}"
loader.load_yaml = load_yaml
loader.SafeLineLoader.add_constructor("!include", _include_yaml)
loader.SafeLineLoader.add_constructor("!file", _uncache_file)
async def async_setup(hass, config):
llgen_config.update(config.get("lovelace_gen"));
return True
# Allow redefinition of node anchors
import yaml
def compose_node(self, parent, index):
if self.check_event(yaml.events.AliasEvent):
event = self.get_event()
anchor = event.anchor
if anchor not in self.anchors:
raise yaml.composer.ComposerError(None, None, "found undefined alias %r"
% anchor, event.start_mark)
return self.anchors[anchor]
event = self.peek_event()
anchor = event.anchor
self.descend_resolver(parent, index)
if self.check_event(yaml.events.ScalarEvent):
node = self.compose_scalar_node(anchor)
elif self.check_event(yaml.events.SequenceStartEvent):
node = self.compose_sequence_node(anchor)
elif self.check_event(yaml.events.MappingStartEvent):
node = self.compose_mapping_node(anchor)
self.ascend_resolver()
return node
yaml.composer.Composer.compose_node = compose_node