Shelly Device Handlers for Hubitat

I have no info on HomeKit integration. But I'll try to check if there is anything in the Window Shade child device that needs to be additionally configured (like operating modes list for thermostats)

P.S.: One thing that come to my mind right away is a scale factor: Could it be that HomeKit expects [0..1] range while device provides [0..100]? In this case anything more than 0 could be threated as 'open' state

1 Like

One inconsistensy/error is present in the driver related to the window shade:
Driver sets windowShade attribute value directly from the device report. But device has state 'stopped' that should be mapped to 'partially open' as listed in the attribute enumeration.

Not sure if this one can be the cause. Will fix it shortly.

1 Like

I'm new to the forum. I have 4 x Shelly 1's that work well with the HE system driver.

I've just added a Shelly Plus 1 and I noticed that no child device (switch) is created. I've read this thread which is great and downloaded the Switch Relay Driver 3.0.10. I can see new attributes in the parent device when it is polled, but alas no child device.

Can someone steer me in the right direction please?

I found a clue in the Shelly Technical Documentation. By running /rpc/shelly.getdeviceinfo, I get a JSON returned that contains:

{
"name": null,
"id": "shellyplus1-441793d6xxxx",
"mac": "441793D6xxxx",
"slot": 0,
"model": "SNSW-001X16EU",
"gen": 2,
"fw_id": "20231219-133950/1.1.0-g34b5d4f",
"ver": "1.1.0",
"app": "Plus1",
"auth_en": false,
"auth_domain": null
}

I note that the Shelly Switch Relay driver code doesn't contain a code for this model? Does that mean that this driver doesn't support Shelly Plus 1 and if so, is there another driver or resource that might help me?

Tim

The one that has version 3.0.10 is the driver for Gen 1 devices. I can't say if it will work with your Gen 2 device. Some Gen 2 devices have a bit of backward compatibility.

The driver in the PLUS subfolder should be a better choice (version 1.0.2).

All those drivers have no 'child device' functionality and operate as an instance-per-component. I.e. if for example you have dual channel device you'll need to install 2 device instances specifying channel id for each of them. In your specific case you have a single channel device, So you need only a single instance of the driver.

The one with child devices is a different driver from different repository, and it's referenced in the thread later.

1 Like

Did you try this driver?

1 Like

Thanks for the detailed reply Dmitry - I'll take a look.

I have had success (simply turn on/off the relay) using the ShellyPlus Generic driver from Sebastian Yepes: https://raw.githubusercontent.com/syepes/Hubitat/master/Drivers/Shelly/ShellyPlus%20Generic.groovy

Thanks Bruno, I'll check it out.

I'm starting to use Hubitat Package Manager and realising that there are many contributors that aren't in the HPM list of repos.

1 Like

This is quite nice clean code driver.

It's is not as generic as the one that Bruno had referenced as it is specialized for 2-channel devices. And it is poll-based so if device changes it's state by some external event/condition it will not report immediately but only after poll interval.

The main drawback is that only a first channel for dual-channel devices is available to dashboard due to the use of on/off default value for the channel index - dashboard cannot provide channel index. And RM will require custom actions to do that.

This driver is Gen 2+ and has no channel limitations. Child devices spawn accordingly. (no addons support yet)
It has live event stream from device so it gets events instantly (like button/switch interactions).
There is unbound input support (including "Button Controller" application compatibility) and script interaction support.
With Shelly scripts you can do additonal dashboard tiles with custom information and virtual actions (scripts are presented as virtual switches with start/stop = on/off and few attributes for getting events back)
Allows to adjust voltage/amperage/etc thresholds per child device to avoid event spam and adjust to any specific case accordingly - Shellies with live event stream open can be quite chatty.

1 Like

Driver is updated:

Added 'em1' component experimental support (Shelly Pro EM and Shelly Pro EM3 in monophase profile mode; some 'mini' devices also fit here)
Fixed 'cover' component mapping for 'stopped'/'partially open' state.

1 Like

Thanks for updating this state mapping, I appreciate it!

I've looked further into the HomeKit issue and I don't see it relating to the driver implementation. With a virtual driver synthesising position and windowShade (state) attributes, I experience the same issue. I'll post elsewhere to try and investigate further.

I read few post in this forum.. And I can try to help within the scope of the driver.

At least one post mentions dependency on position value. So could you track this attribute in different states and post results here? Meybe there will be a chance to see some dependency.

Can someone please let me know if there's a driver that works with Shelly Plus 1 with Shelly Plus Add-On? I'm looking for a driver that will report temperature from the the Add-on!

1 Like

I can add 'Shelly Add-on support'. But I need a bit of help with testing)
From driver perspective the only difference is child device id range that is not continuous.

P.S.: I have an idea how to add add-on related childs in generic way. Going to update the driver soon for testing.

1 Like

Driver is updated:

  • Changed component enumeration logic from total count to ID lists. Different addon modules now expected to be properly visible to the driver.

  • Changed internal naming for temperature sensors that are related to switches and/or dimmers. Those will be recreated after 'Configure' operation. This is needed to avoid id conflict between Shelly Plus 1/2 build-in sensors and add-on sensors.

  • For add-on module 'temperature' and 'input' components are expected to be supported.

peripheral type component type support
ds18b20 temperature yes
dht22 temperature, humidity yes
digital_in input yes
analog_in input yes
voltmeter voltmeter needs new child device

Needs testing.

2 Likes

Thank you very much Dmitry, I'm happy to assist with testing but I live in Australia and the Shelly Plus 1 modules are out of stock everywhere here atm. Been told they expect stock at the start of April. I'll 100% test as soon as I can get my hands on one.

1 Like

Good news, I seem to have resolved the issue with HomeKit. The driver casts the position to a Float for the event value. By removing the cast and refreshing the devices, everything started reporting the proper status in HomeKit. It appears to expect an integral number.

events << [name: "position", value: params.current_pos as Float, unit: "%"]
                                                       ^^^^^^^^

What tipped me off was the built-in Mirror app was configured at one point to mirror the cover child device to a built-in Virtual Window Shade device. The Mirror app was reporting a NumberFormatException in the logs.

java.lang.NumberFormatException: For input string: "95.0" on line 416 (method sourceHandler)

1 Like

Driver it updated with your fix)

Thanks!

1 Like

i bought this one Shelly EM Wi-Fi Energy Meter - SmartHome

will the drivers work with this one?

looks like HPM does not have it for shelly EM?