Skip to content

Commit

Permalink
Merge pull request #889 from tsightler/dev
Browse files Browse the repository at this point in the history
Release v5.7.1
  • Loading branch information
tsightler authored Aug 17, 2024
2 parents 6f383e8 + 812e829 commit a4f849c
Show file tree
Hide file tree
Showing 8 changed files with 218 additions and 59 deletions.
2 changes: 1 addition & 1 deletion devices/base-ring-device.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default class RingDevice {
: entity.component === 'camera'
? { topic: entityStateTopic }
: {},
...entity.component.match(/^(switch|number|light|fan|lock|alarm_control_panel|select|button)$/)
...entity.component.match(/^(switch|number|light|fan|lock|alarm_control_panel|select|button|valve)$/)
? { command_topic: `${entityTopic}/command` }
: {},
...entity.hasOwnProperty('device_class')
Expand Down
2 changes: 1 addition & 1 deletion devices/lock.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default class Lock extends RingSocketDevice {
}

publishState() {
var lockState
let lockState
switch(this.device.data.locked) {
case 'locked':
lockState = 'LOCKED'
Expand Down
55 changes: 55 additions & 0 deletions devices/valve.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import RingSocketDevice from './base-socket-device.js'

export default class Valve extends RingSocketDevice {
constructor(deviceInfo) {
super(deviceInfo, 'alarm')
this.deviceData.mdl = 'Water Valve'

this.entity.valve = {
component: 'valve'
}
}

publishState() {
let valveState
switch(this.device.data.valveState) {
case 'open':
case 'closed':
valveState = this.device.data.valveState
break;
default:
// HA doesn't support broken state so setting unknown state is the best we can do
valveState = 'None'
}
this.mqttPublish(this.entity.valve.state_topic, valveState)
this.publishAttributes()
}

// Process messages from MQTT command topic
processCommand(command, message) {
switch (command) {
case 'valve/command':
this.setValveState(message)
break;
default:
this.debug(`Received message to unknown command topic: ${command}`)
}
}

// Set valve target state on received MQTT command message
setValveState(message) {
this.debug(`Received set valve state ${message}`)
const command = message.toLowerCase()
switch(command) {
case 'open':
case 'close': {
let valveState = command === 'open' ? 'opening' : 'closing'
this.mqttPublish(this.entity.valve.state_topic, valveState)
this.device.sendCommand(`valve.${command}`)
break;
}
default:
this.debug('Received invalid command for valve')
}
}
}
7 changes: 7 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## v5.7.1
**New Features**
- Add experimental support for Zooz water valves. This support is currently untested, but was developed using user data dumps kindly contributed from several users and also based on a similar PR submitted for ring-homebridge from another user. Please feel free to open an issue on the Github project page if you have problems with this device and thanks to all involved for their support.

**Dependency Updates**
- ring-client-api v13.1.0

## v5.7.0
This release migrates to the new FCM HTTP v1 API for push notifications as the legacy FCM/GCM APIs have been deprecated for some time and shutdown of those legacy APIs started in late July 2024. While the transition to this new API should be transparent for most users, the under the hood changes are signfiicant including an entirely new push notification format. While the goal is to make this transition as seemless as possible, it is impossible to guarantee 100% success. If you experience issues with motion/ding notification from cameras, doorbells or intercoms after upgrading to this version, please follow the standard push notification troubleshooting steps as follows:

Expand Down
3 changes: 3 additions & 0 deletions lib/ring.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import SmokeCoListener from '../devices/smoke-co-listener.js'
import Switch from '../devices/switch.js'
import TemperatureSensor from '../devices/temperature-sensor.js'
import Thermostat from '../devices/thermostat.js'
import Valve from '../devices/valve.js'
import debugModule from 'debug'
const debug = debugModule('ring-mqtt')

Expand Down Expand Up @@ -365,6 +366,8 @@ export default new class RingMqtt {
} else {
return new TemperatureSensor(deviceInfo)
}
case RingDeviceType.WaterValve:
return new Valve(deviceInfo)
case RingDeviceType.BeamsSwitch:
case 'access-code':
case 'access-code.vault':
Expand Down
Loading

0 comments on commit a4f849c

Please sign in to comment.