Shellies Discovery error -

Any help would be appreciated. I’ve gone through all the docs and can’t seem to find a solution to this error in the shellies_discovery.py script.

"[homeassistant.components.automation.shellies_discovery] Shellies Discovery: Error executing script. Unexpected error for call_service at pos 1: Error rendering data template: UndefinedError: ‘dict object’ has no attribute ‘payload_json’

I’m running my own MQTT broker on a separate server and explorer shows everything working.
I’m using default Shelly device config on latest firmware, ver: 20200812-090904/v1.8.0@8acf41b0
I’m using the latest shellies_discovery.py script from #bieniu github.
I’m running Home Assistant 0.114.3

Here’s my automations.yaml
id: shellies_announce
alias: ‘Shellies Announce’
trigger:
platform: homeassistant
event: start
action:
service: mqtt.publish
data:
topic: shellies/command
payload: announce

  • id: shellies_discovery
    alias: ‘Shellies Discovery’
    mode: queued
    max: 999
    trigger:
    • platform: homeassistant
      event: start
    • platform: time_pattern
      hours: “/1”
      action:
      service: python_script.shellies_discovery
      data_template:
      id: ‘{{ trigger.payload_json.id }}’
      mac: ‘{{ trigger.payload_json.mac }}’
      fw_ver: ‘{{ trigger.payload_json.fw_ver }}’
      discovery_prefix: ‘homeassistant’
      qos: 1
      shelly1-C4E8B1:
      relay-0: “Backyard Twilight lights”

ext-temperature-0: true

ext-humidity-0: true

push_off_delay: false

force_update_sensors: true

  shelly1-C41BCB:
    relay-0: "Backyard Fountain"

Here’s my full log:

2020-08-26 16:29:07 INFO (MainThread) [homeassistant.components.automation.shellies_announce] Executing Shellies Announce
2020-08-26 16:29:07 INFO (MainThread) [homeassistant.components.automation.shellies_discovery] Executing Shellies Discovery
2020-08-26 16:29:07 INFO (MainThread) [homeassistant.components.automation.shellies_announce] Shellies Announce: Running script
2020-08-26 16:29:07 INFO (MainThread) [homeassistant.components.automation.shellies_announce] Shellies Announce: Executing step call service
2020-08-26 16:29:07 INFO (MainThread) [homeassistant.components.automation.shellies_announce] Initialized trigger Shellies Announce
2020-08-26 16:29:07 INFO (MainThread) [homeassistant.components.automation.shellies_discovery] Initialized trigger Shellies Discovery
2020-08-26 16:29:07 INFO (MainThread) [homeassistant.components.automation.shellies_discovery] Shellies Discovery: Running script
2020-08-26 16:29:07 INFO (MainThread) [homeassistant.components.automation.shellies_discovery] Shellies Discovery: Executing step call service
2020-08-26 16:29:07 ERROR (MainThread) [homeassistant.components.automation.shellies_discovery] Shellies Discovery: Error executing script. Unexpected error for call_service at pos 1: Error rendering data template: UndefinedError: ‘dict object’ has no attribute ‘payload_json’
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/template.py”, line 230, in async_render
return compiled.render(kwargs).strip()
File “/usr/local/lib/python3.8/site-packages/jinja2/environment.py”, line 1090, in render
self.environment.handle_exception()
File “/usr/local/lib/python3.8/site-packages/jinja2/environment.py”, line 832, in handle_exception
reraise(*rewrite_traceback_stack(source=source))
File “/usr/local/lib/python3.8/site-packages/jinja2/_compat.py”, line 28, in reraise
raise value.with_traceback(tb)
File “”, line 1, in top-level template code
File “/usr/local/lib/python3.8/site-packages/jinja2/sandbox.py”, line 407, in getattr
value = getattr(obj, attribute)
jinja2.exceptions.UndefinedError: ‘dict object’ has no attribute ‘payload_json’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/service.py”, line 132, in async_prepare_call_from_config
template.render_complex(config[CONF_SERVICE_DATA_TEMPLATE], variables)
File “/usr/src/homeassistant/homeassistant/helpers/template.py”, line 74, in render_complex
return {key: render_complex(item, variables) for key, item in value.items()}
File “/usr/src/homeassistant/homeassistant/helpers/template.py”, line 74, in
return {key: render_complex(item, variables) for key, item in value.items()}
File “/usr/src/homeassistant/homeassistant/helpers/template.py”, line 76, in render_complex
return value.async_render(variables)
File “/usr/src/homeassistant/homeassistant/helpers/template.py”, line 232, in async_render
raise TemplateError(err)
homeassistant.exceptions.TemplateError: UndefinedError: ‘dict object’ has no attribute ‘payload_json’

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 191, in _async_step
await getattr(
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 352, in _async_call_service_step
domain, service, service_data = async_prepare_call_from_config(
File “/usr/src/homeassistant/homeassistant/helpers/service.py”, line 135, in async_prepare_call_from_config
raise HomeAssistantError(f"Error rendering data template: {ex}") from ex
homeassistant.exceptions.HomeAssistantError: Error rendering data template: UndefinedError: ‘dict object’ has no attribute ‘payload_json’
2020-08-26 16:29:07 ERROR (MainThread) [homeassistant.components.automation.shellies_discovery] While executing automation automation.shellies_discovery
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/template.py”, line 230, in async_render
return compiled.render(kwargs).strip()
File “/usr/local/lib/python3.8/site-packages/jinja2/environment.py”, line 1090, in render
self.environment.handle_exception()
File “/usr/local/lib/python3.8/site-packages/jinja2/environment.py”, line 832, in handle_exception
reraise(*rewrite_traceback_stack(source=source))
File “/usr/local/lib/python3.8/site-packages/jinja2/_compat.py”, line 28, in reraise
raise value.with_traceback(tb)
File “”, line 1, in top-level template code
File “/usr/local/lib/python3.8/site-packages/jinja2/sandbox.py”, line 407, in getattr
value = getattr(obj, attribute)
jinja2.exceptions.UndefinedError: ‘dict object’ has no attribute ‘payload_json’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/service.py”, line 132, in async_prepare_call_from_config
template.render_complex(config[CONF_SERVICE_DATA_TEMPLATE], variables)
File “/usr/src/homeassistant/homeassistant/helpers/template.py”, line 74, in render_complex
return {key: render_complex(item, variables) for key, item in value.items()}
File “/usr/src/homeassistant/homeassistant/helpers/template.py”, line 74, in
return {key: render_complex(item, variables) for key, item in value.items()}
File “/usr/src/homeassistant/homeassistant/helpers/template.py”, line 76, in render_complex
return value.async_render(variables)
File “/usr/src/homeassistant/homeassistant/helpers/template.py”, line 232, in async_render
raise TemplateError(err)
homeassistant.exceptions.TemplateError: UndefinedError: ‘dict object’ has no attribute ‘payload_json’

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/components/automation/init.py”, line 430, in async_trigger
await self.action_script.async_run(variables, trigger_context)
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 802, in async_run
await asyncio.shield(run.async_run())
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 563, in async_run
await super().async_run()
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 183, in async_run
await self._async_step(log_exceptions=False)
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 191, in _async_step
await getattr(
File “/usr/src/homeassistant/homeassistant/helpers/script.py”, line 352, in _async_call_service_step
domain, service, service_data = async_prepare_call_from_config(
File “/usr/src/homeassistant/homeassistant/helpers/service.py”, line 135, in async_prepare_call_from_config
raise HomeAssistantError(f"Error rendering data template: {ex}") from ex
homeassistant.exceptions.HomeAssistantError: Error rendering data template: UndefinedError: ‘dict object’ has no attribute ‘payload_json’

I’ve encountered the same problem. Were you able to resolve it?