Vote for Shelly UNI

Yeah, I'm already trying. Right now, I'm playing around with Arduino and Tasmota. With Tasmota I had my first success, kind of, by getting the Ikea Air Quality Sensor online. Not into Hubitat, but at least online. :sweat_smile: With Arduino, it is a different story right now, which was basically my fault. I've used an old power supply to build a switch and burned my last D1 mini. Now I have to wait, till the next shipment.

You're absolutely right about that. And @ogiewon is really supportive. For me, one big reason to find one of this easier solutions is to make things accessible for people who like to tinker, but like me have no idea about programming and are either too scared to try, or just lack the time. That's one reason why I love the Shelly modules. They give you this great experience of "I've built it by myself! This is my thingie!", but still make it so much easier for you, to build this stuff. I remember, when I build my first Smart Roller Shutter, using the Shelly 2.5. It felt great, was easy to do, and now it is my personal Roller Shutter, which cost me a fraction of the price of commercial ones (80€ for a fully functional black out Roller Shutter of 1,5 m in width, 1.5 m in length).

That's one reason, why I'm often times posting my mini projects and "Idiot"-solutions to give other people this experience, a staring point, and especially for people who want to have all this comfort-smart-devices but don't have that much money, a possibility to build those by themselves, without any deeper knowledge. :slight_smile:

2 Likes

Is there currently a way to suppress update of voltage if same as previous value?

Hubitat should do that for you, since I don't use the isStateChange: true flag. The default behavior is to not fire duplicate events when the value has not changed.

If you look at the Events view of the ADC child device, do you see multiple entries with the same value?

Interesting... the device events show this.

But the entries in the database using node-red shows this...
image

I don't use node-red. How does it connect to Hubitat?

It's using websockets to connect to the hub. I followed the thread below.

I did a little bit of tinkering, and the eventsocket interface (ws://<hub>/eventsocket) sends every event, even if they are duplicates and isStateChange is set to false.

This is a difference in behavior from events elsewhere in Hubitat. For example, if you used this attribute with a trigger in Rule Machine, you'd only see it triggered as often as what shows up in the Events list for the device in Hubitat.

1 Like

Thanks for investigating that @tomw! I'll try and work around it on the node-red end.

I've been meaning to ask but keep getting sidetracked. When I go to the parent Shelly device and edit a setting, like the Refresh interval. The device becomes a totally new device somehow, the device ID gets changed and I have to reauthorize other apps that use it. Is there a way to preserve the device ID?

It just happened today after I changed the refresh rate from 30 to 60 secs.

1 Like

I noticed this happening as well - didn’t realize what I had done to cause that to happen, and didn’t spend the time to investigate… I’ll second that it would be nice if the device ID could remain…

1 Like

It is totally fixable. I'll send you guys some code to test out.

1 Like

I pushed the fix to retain child devices on save/re-configure. It is in version 0.0.24.

Thanks to @eibyer and @Sebastien for testing and feedback on the Shelly Uni support.

I made the same changes to the Button1 and i3 drivers, but they're not tested yet. If anyone has issues with those please let me know.

2 Likes

Hey @tomw thanks for your work on these drivers.

I've got my Uni working as a garage controller with the Hubitat built in "Garage Opener" app.

I had to add contact sensor capability to the input driver though - so just a something you can add back in for those that need it.

/*

 */

metadata
{
    definition(name: "Shelly Input Child", namespace: "tomw", author: "tomw", importUrl: "")
    {
        capability "Actuator"
        capability "Refresh"
        capability "Switch"
        capability "Contact Sensor"
        attribute "commStatus", "string"
    }
}

preferences
{
    section
    {
        input "inputNum", "text", title: "Input number of this child", required: true
    }
}

def setupDetails(details)
{
    device.updateSetting("inputNum", details.inputNum)
}

def setCallbackURLs(URL)
{
    getParent()?.getCommon()?.writeSettingAction("btn_on_url", inputNum.toInteger(), URL, true)
    getParent()?.getCommon()?.writeSettingAction("btn_off_url", inputNum.toInteger(), URL, true)
    getParent()?.getCommon()?.writeSettingAction("longpush_url", inputNum.toInteger(), URL, true)
    getParent()?.getCommon()?.writeSettingAction("shortpush_url", inputNum.toInteger(), URL, true)
}

def on()
{
    // do nothing, but refresh anyway
    runIn(1, refresh)
}

def off()
{
    // do nothing, but refresh anyway
    runIn(1, refresh)
}

def refresh()
{
    def input = readInput()
    if(input)
    {
        sendEvent(name: "switch", value: input.input ? "on" : "off")
        sendEvent(name: "contact", value: input.input ? "closed" : "open")
    }
}

def readInput()
{
    return getParent()?.getCommon()?.readStatus(false)?.inputs?.getAt(inputNum.toInteger())
}

I also needed to reverse the inputs in the Uni settings, but that will depend on what switches you used. In this case I used the cam switches build into the motor.

1 Like

Hello everyone,

First and foremost thanks to the coders for your work! I envy your capabilities!

Am not sure if this post is the appropriate thread, as I need some help with the Shelly i3.

I'm trying to use @tomw 's driver for the i3, however I'm running into some issues. The parent device is being created, along with 4 child devices, a common and three shellyButtonChilds. I can't seem to be able to get Hubitat to communicate with the i3. Any advice?

I'm planning a whole apartment build from scratch with 20shelly 4pm pro for light control and about 15shelly i3 for switching.

Thank you!

If you are getting the shellyButtonChild devices created then Hubitat was at least able to reach the Shelly device to query its capabilities.

What do you mean when you say that they were not able to communicate? Are you not seeing events in Hubitat for changes at the wired inputs on the i3?

Thanks for the fast reply!

I cannot seem to get any interactions in either direction, that is, whenever I try to click either of the 'hold, on, off, push, etc..' buttons on the hubitat interface nothing changes on the i3's own web-interface and whenever I press a physical momentary switch connected to the i3 I'm not getting any feedback on Hubitat either.

I am able to toggle the shelly 4pm on and off, if I feed it's IP address into the button url in the i3's web-interface and press the physical switch. I can also manipulate the shelly 4pm in it's hubitat device page, so I don't think it is a network issue.

I'm still very new to hubitat, so I'm assuming it is human error on my side with respect to using your drivers.

The Hubitat interface doesn't send anything towards the Shelly, so no issues with that not seeming to do anything. :wink:

But the physical interactions on the Shelly side should be mirrored into Hubitat. Maybe something failed in configuration or was broken by some code changes I made recently.

Can you show screenshots of the Shelly web interface configuration with some of the action URLs exposed? And will you please turn on debug logging on the Shelly i3 virtual device on the Hubitat side and send logs of a Configure and the time period when you press the momentary switch on the Shelly side?

Hey again, sorry for the delay but I was unable to get back onto my machine for a while.

so i'm attaching some items:

Hubitat interface - ChildDevice:

Hubitat Interface - Parent Device:

Shelly Interface - Action Url calling the 4pm relay (obviously bypassing hubitat in this manner)

Hubitat Logs: Device 149 & 151 are the Parent/Child Logs. Am noticing there is quite a lot of lag before they get updated, between the actual button press and event coming up.


looking forward to your thoughts!

OK... few things I noticed.

Dev 149

There was a critical bug in the i3 driver which was resulting in the "Cannot get property 'mac'" error. Please do a Repair in HPM to get the fix for that.

Before you actually Configure again, I should note that I use the action URLs in my implementation, and the way I have it written now will overwrite any existing settings there. So, it'll blap over your 4pm relay URL. I can take a look at doing an append instead of replace (since they support multiple values), but I'd recommend only testing one i3 at a time until we find a good solution for that so that you don't have to re-do your settings for the 4pm.

Dev 151

I'm stumped on this error. Was this from manually executing the push() command on the child device page? If so, what value did you use for button number?

With testing help from @iNegibb , I think we got it all sorted out.

Version 0.0.25 contains the i3 fix as well as the improvement to retain any existing action URLs.

Having a Shelly device signal events to both Hubitat and another Shelly device directly is a cool use-case that I hadn't thought of, but that is now possible with this driver. :slight_smile: