Shellies Discovery Script

Great. Thank you!

Getting this error when running discovery automation
Error rendering data template: UndefinedError: ‘trigger’ is undefined Any advice?

This error appears when you start the script manually. This script can’t be start manually. Please read OP or documentation on GitHub.

Seems like that this script might become the only way rather than the integration:

CoAP executions commands removed completely (status messages work same as before)

So how do I handle temperature units now? I updated, removed temp_unit from my discovery automation and now my 2 Shellies H&T report temperatures in the mid 150’s - which would be bad if it was true :wink:

Home Assistant’s frontend automatically converts temperature units. Change to Celsius in Shelly WWW panel.

Thank you.

Hi, I can’t get the plugin to work. I configured everything, but I can’t find my Shelly H&T.

I’ve been using your script for months and it has worked well. However, I just installed a new Shelly 1 with the latest firmware and the script doesn’t detect it. I’m running HA 0.102.2 and firmware 20191127-095418/v1.5.6@0d769d69. Since it wasn’t detected, I upgraded from an old version of the script to the latest but it still doesn’t work. The new script discovered “input” and “longpush” entries on the old devices but not the new Shelly 1.

One difference I noticed with the new Shelly firmware is the absence of the custom “Will Topic” and “Will Message” fields. Not sure if that has anything to do with it. “Enable action execution via MQTT” is enabled.

Ideas? Thanks.

I found the problem. There was something wrong with the mqtt server field, even though it showed the correct address and port. Perhaps some non-plain text got pasted into it. Re-entering it and then saving fixed the problem.

Hi,

I am struggling to make the binary_sensor for longpushes work in automations. The way shelly firmware sends mqtt messages for longpushes makes it very difficult to use directly the binary sensor in automations.

The shelly2.5 sends a “1” to “shellies/device/longpush/” topic everytime a longpush is detected. However, it does not send a “0” when the longpush finishes. As a result, the HA binary_sensor related to this stays on until the next longpush which, as it is already on, it does not get detected and does not trigger an event. Is this the expected behaviour?

I have solved this by using directly a trigger on the MQTT message getting a “1” but I was wondering if there is something that I am missing and it works for you guys. @Bieniu maybe a solution is to make the binary_sensor “clever” so when the longpush finishes (by looking at the corresponding input) we can reset it back to 0 again so it is ready for the next longpush?

Regards,

I can’t help you without any debug information. Have you read this?

@Bieniu, the easiest way to check/debug is by looking at the longpush binary_sensor associated with a shelly device. Just longpress your switch connected to shelly and the longpush binary_sensor turns on (which is OK). But al least mine stays on and if I longpush the switch again it just stays on. It does not turns off until I normally short-press the switch.

Just to make sure I am using the shelly as a momentary switch.

I am not sure if this is the expected behaviour or not! At least for me it makes more sense to just turning the binary_sensor on just when the longpush is made and off when it finishes…

If it helps I can sure provide all needed logs (currently using all latest versions of HA, discovery script and shelly firmware).

Regards,

I don’t use longpush in my configuration so I don’t know that problem. When I back to home I will check this. Automations with two triggers like that doesn’t work for you?

trigger:
  - platform: state
    entity_id: binary_sensor.shelly-<ID>_longpush
    from: "off"
    to: "on"
  - platform: state
    entity_id: binary_sensor.shelly-<ID>_longpush
    from: "on"
    to: "off"

Yes they do work!

However, as I said, the first triggers only the first time a longpress is done, if you longpress the switch again it is not triggered.

There is no at all topic longpush with payload 0 after first long push usage?

New version: 0.13.2

Changelog:

  • add power sensor for Shelly Dimmer

Not that I could see when I subscribed directly to the mqtt Shelly topic.

Yes, there is no topic longpush with payload 0 after long push usage with firmware 1.5.6.