Water shutoff valve integration (SmartHome Select + Relay)

DHL Shipment has been given a release by Customs in USA. Should have the valves in a couple of days!


and
 they arrived! Quick test shows them working off of a basic 12v supply out of the junk bin, more to come on Friday when mimolite (hopefully) gets here.

Has anyone got the mimolite working with analog input? If so, we should be able to get a positive confirmation of both open and closed states if we send a different dc voltage.

Here’s a video of it being manually activated in both directions

Very cool Jason, thanks for taking the lead. When you’re manually triggering the valve, is it like a momentary signal like a garage door opener button, or more like regular on/off switch?

1 Like

And to just confirm, that is the Smarthome SELECT Electronic Water Shutoff Valve, 3/4-inch, 12V DC, correct?

@johnconstantelo
The logic board in the motor itself regulates the open and close functions. It took several seconds of 12v power for the valve to move in one direction or the other. Not sure if momentary can be extended for long enough and then cut the power, or if latched will be absolutely required. A regular switch works fine.

It always cut itself off when the open or close action was fully completed.

The wiring should be GND from power source to black wire on valve. +12v DC to output COM on mimolite and then Red and Green wires to either NC or NO on the mimolite depending on whether you want “ON” to mean “OPEN” or if you want “ON” to be “Closed”

@zuperman4ever
Since the smarthome was backordered at the time, I did a bit of research and ended up buying a few samples of a slightly better design directly from China. TOFINE-THA20T

If anyone is near NYC and wants to trade a valve for a mimolite, I’ll gladly meet up. Assuming I don’t burn any up by doing something silly while I test this out, I should have at least one spare. :smile:

I’m going to start just using the one output to indicate a “fully closed” signal as a short to keep things simple at first and get familiar with the mimolite. From the manual, I definitely think we can use the ADC with the two signals if we apply a simple voltage divider so there is significant difference between the two states.

Voltage Divider
http://www.microbuilder.eu/Tutorials/Fundamentals/MeasuringBatteryVoltage.aspx

Mimolite tech appendix – if it doesn’t load the PDF the first time, refresh. It seems to check the referrer to avoid direct deeplinks.
http://www.fortrezz.com/index.php/component/jdownloads/finish/4/16?Itemid=0

Hooked it all up and used the mimolite garage door device type to try out the basics. I’ve confirmed that we can:

  1. open and close the valve – using latched mode (leave the momentary jumper in place)
  2. use a pair of the wires to either measure “fully open” or “fully closed” as a contact sensor

Valve:
black = gnd

Mimolite:
COM = +12v
NC = Green
NO = Red
Mimolite contact sensor:
EIther White + Yellow OR Gray and Black depending on what state you care most about.

I didn’t see the code for the “MimoLite Garage Door Controller” in the IDE when going in to create a custom device type, so I haven’t started working on:
a. the analog input to measure both OPEN and CLOSED
b. tracking down why it gets stuck on “ACTUATE” sometimes and required a second click in the iphone app.

@wackware @Ben – Any pointers?

Thanks @storageanarchy for this note. I was playing around with the garage door device type, and it switched the mimolite to momentary mode.

Note that with the MiMoLite, if you want to CHANGE the
setting of the jumper (momentary/constant), you need to follow these
steps

Exclude the MiMoLite from your ST network
Remove the power to the MiMoLite
Change the jumper
Power on the MiMoLite
Re-associate with your ST network

This because the jumper state is ONLY READ when the device is powered on while NOT associated to a Z-Wave network (I found out the hard way).

Thanks to @cesaldar for some extremely helpful sample code. This reliably opens and closes the valve + reports on the contact status using yellow and white for “fully closed signal”

Todo:
-power failure alarm
-maybe ADC for measuring both states
 might be overkill

metadata {
    // Automatically generated. Make future change here.
    definition (name: "Mimo Lite Valve Controller", author: "jr0") {
        capability "Polling"
        capability "Refresh"
        capability "Switch"
        capability "Contact Sensor"
    }

    // simulator metadata
    simulator {
        status "on":  "command: 2003, payload: FF"
        status "off": "command: 2003, payload: 00"

        // reply messages
        reply "2001FF,delay 100,2502": "command: 2503, payload: FF"
        reply "200100,delay 100,2502": "command: 2503, payload: 00"

        // status messages
        status "open":  "command: 2001, payload: FF"
        status "closed": "command: 2001, payload: 00"
    }

    // UI tile definitions
    tiles {
        standardTile("switch", "device.switch", width: 2, height: 2, canChangeIcon: true) {
            state "on", label: '${name}', action: "switch.off", icon: "st.switches.switch.on", backgroundColor: "#79b821"
            state "off", label: '${name}', action: "switch.on", icon: "st.switches.switch.off", backgroundColor: "#ffa81e"
        }
        standardTile("contact", "device.contact", inactiveLabel: false) {
            state "open", label: '${name}', icon: "st.valves.water.open", backgroundColor: "#79b821"
            state "closed", label: '${name}', icon: "st.valves.water.closed", backgroundColor: "#ffa81e"
        }
        standardTile("refresh", "device.switch", inactiveLabel: false, decoration: "flat") {
            state "default", label:'', action:"refresh.refresh", icon:"st.secondary.refresh"
        }
        valueTile("alarm", "device.alarm", inactiveLabel: false) {
            state "alarm", label:'${currentValue}'
        }


        main (["switch", "contact"])
        details(["switch", "contact", "refresh", "alarm"])
    }
}

def parse(String description) {
    def result = null
    def cmd = zwave.parse(description, [0x20: 1, 0x84: 1, 0x30: 1, 0x70: 1])
    if (cmd) {
        result = createEvent(zwaveEvent(cmd))
    }
    log.debug "Parse returned ${result?.descriptionText}"
    return result
}

def sensorValueEvent(Short value) {
    if (value) {
        createEvent(name: "contact", value: "open", descriptionText: "$device.displayName is open")
    } else {
        createEvent(name: "contact", value: "closed", descriptionText: "$device.displayName is closed")
    }
}

def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicReport cmd) {
    [name: "switch", value: cmd.value ? "on" : "off", type: "physical"]
}


def zwaveEvent(physicalgraph.zwave.commands.basicv1.BasicSet cmd)
{
    sensorValueEvent(cmd.value)
}

def zwaveEvent(physicalgraph.zwave.commands.switchbinaryv1.SwitchBinaryReport cmd) {
    [name: "switch", value: cmd.value ? "on" : "off", type: "digital"]
}

def zwaveEvent(physicalgraph.zwave.commands.sensorbinaryv1.SensorBinaryReport cmd)
{
    sensorValueEvent(cmd.sensorValue)
}

def zwaveEvent(physicalgraph.zwave.commands.alarmv1.AlarmReport cmd)
{
    sensorValueEvent(cmd.sensorState)
}

def zwaveEvent(physicalgraph.zwave.Command cmd) {
    // Handles all Z-Wave commands we aren't interested in
    [:]
}

def on() {
    delayBetween([
        zwave.basicV1.basicSet(value: 0xFF).format(),
        zwave.switchBinaryV1.switchBinaryGet().format()
    ])
}

def off() {
    delayBetween([
        zwave.basicV1.basicSet(value: 0x00).format(),
        zwave.switchBinaryV1.switchBinaryGet().format()
    ])
}

def poll() {
    zwave.switchBinaryV1.switchBinaryGet().format()
}

def refresh() {
    zwave.switchBinaryV1.switchBinaryGet().format()
}
1 Like

This rocks Jason, great job. Were these valve easy to get, especially if only ordering 1? If you have spares, I’d buy one from ya’ if you’re selling!

Question about your installation. Where are you installing your valve at and what material is the piping? Are you dealing with Copper with Stainless steal valve? If so I was caution on the galvanic corrosion issue with the valve being stainless steal
 But if it is PVC then there is no issue.

In my case, it will be installed indoors on the source leading to hot water heater. I was going to use an existing soldered brass fitting on copper pipe, as that should address the corrosion issue.

copper->brass->stainless steel valve->brass->copper — since it’s a threaded fitting, there will also be Teflon in-between.

I could also chop it all off and just do Pex for that small section if folks think that’s a better idea.

1 Like

Have you considered submitting this? Looks awesome.

@mager I hope to have some time to work on the code a little more this weekend and tidy things up a bit.

Does anyone have a firm handle on how configuration parameters work via the device type definiton? It seems that my battery alert wasn’t firing because the device wasn’t configured with:

zwave.associationV1.associationSet(groupingIdentifier:3, nodeId:zwaveHubNodeId).format()//subscribe to power alarm

However, I’m not clear on how the “config” section in the device handler is executed. Do I need to exclude the device from the network and rejoin it for the configuration to apply?

Similarly, has anyone attached a push alert so your phone would be alerted to the mimolite losing power?

With the help from Jason who started this thing going, and who let me buy a spare valve from him, here’s what I’ve been able to do with this valve and a MIMOLite (sharing a common power supply):

Now it’s time to get this installed on the main water line!

Kudo’s to @jr0 for starting this post, and for the collaborative nature of the ST community.

4 Likes

I bought a valve from the same place Jason. Just waiting for it to get to my place.

Very cool. Did you order the same one, or a slightly different setup?

Same setup but brass instead of stainless steal