Shellies Discovery Script

It could be, be when I inject into mqtt using node red it seems to work as I see the message in the debug.

image

Did you add automations?

No. Your guide seems to suggest that’s optional. Maybe I misunderstood.

Than you have to check your automations for Shellies Script … ha-shellies-discovery shellies_announce and shellies_discovery automation

Thanks guys. That’s a bit better. Making progress. What I am seeing now is this

Restart HA or run announce automation.

I had restarted already, but I ran the automations and they are there. Thank you :slight_smile:

1 Like

Sorry, one more question, topics. I have my system linked to node-red. What topic do I use for the devices? Like I said, this is my first time playing with MQTT…

You can check that in HA:

1 Like

Hi

My shellies discovery script no longer works, it’s not picking up new devices linked to my MQTT server.

Any idea why i would be seeing this error in my home assistant log ?

Shellies Discovery: Error executing script. Unexpected error for call_service at pos 1: Error rendering data template: UndefinedError: 'trigger' is undefined
Traceback (most recent call last):
  File "/home/homeassistant/lib/python3.7/site-packages/homeassistant/helpers/template.py", line 222, in async_render
    return compiled.render(kwargs).strip()
  File "/home/homeassistant/lib/python3.7/site-packages/jinja2/environment.py", line 1090, in render
    self.environment.handle_exception()
  File "/home/homeassistant/lib/python3.7/site-packages/jinja2/environment.py", line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File "/home/homeassistant/lib/python3.7/site-packages/jinja2/_compat.py", line 28, in reraise
    raise value.with_traceback(tb)
  File "<template>", line 1, in top-level template code
  File "/home/homeassistant/lib/python3.7/site-packages/jinja2/sandbox.py", line 407, in getattr
    value = getattr(obj, attribute)
jinja2.exceptions.UndefinedError: 'trigger' is undefined

“trigger is undefined” means you run the script manully. Only the automation can run the script.

i’m manually running the script from the Automations section, im clicking on the execute link next to the shellies_discover automation. is this wrong ? im only doing this because the home assistant is no longer detecting new shellies devices, ive added two recently and they are not in the devices list of HA.

Yes, this is wrong. Set debug for python_script log.

done, assume i must look at the main home assistant log ? I see lots of shellies messages no errors, but no mention of my new devices. Could it be because they are the new shellies dimmer 2 modules?

If they use other IDs than old Dimmers than they aren’t supported. Show me MQTT topics/payloads log.

Hi

Not sure which log you’re speaking about. Got this out of MQTT explorer, is it enough ?

{“id”:“shellydimmer2-E09806950890”,“mac”:“E09806950890”,“ip”:“192.168.1.196”,“new_fw”:false, “fw_ver”:“20200615-133340/v1.7.2@e39e9c86”}

I need all topics that device is sending. I assume that Dimmer 2 uses same topics as old Dimmer. You can test that version https://github.com/bieniu/ha-shellies-discovery/releases/tag/0.25.0

New version: 0.25.0

Changelog:

  • add support for Shelly Dimmer 2

thanks will test and let you know

does this help ?

It looks the same as for old Dimmer. Version 0.25.0 should work fine.