mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 22:27:07 +00:00
Remove unnecessary assignment of Template.hass from dweet (#123667)
This commit is contained in:
parent
33a22ae208
commit
82bedb1ab5
@ -51,8 +51,6 @@ def setup_platform(
|
|||||||
device = config.get(CONF_DEVICE)
|
device = config.get(CONF_DEVICE)
|
||||||
value_template = config.get(CONF_VALUE_TEMPLATE)
|
value_template = config.get(CONF_VALUE_TEMPLATE)
|
||||||
unit = config.get(CONF_UNIT_OF_MEASUREMENT)
|
unit = config.get(CONF_UNIT_OF_MEASUREMENT)
|
||||||
if value_template is not None:
|
|
||||||
value_template.hass = hass
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
content = json.dumps(dweepy.get_latest_dweet_for(device)[0]["content"])
|
content = json.dumps(dweepy.get_latest_dweet_for(device)[0]["content"])
|
||||||
@ -60,7 +58,7 @@ def setup_platform(
|
|||||||
_LOGGER.error("Device/thing %s could not be found", device)
|
_LOGGER.error("Device/thing %s could not be found", device)
|
||||||
return
|
return
|
||||||
|
|
||||||
if value_template.render_with_possible_json_value(content) == "":
|
if value_template and value_template.render_with_possible_json_value(content) == "":
|
||||||
_LOGGER.error("%s was not found", value_template)
|
_LOGGER.error("%s was not found", value_template)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user