Skip to content

Commit

Permalink
Fix beams crash
Browse files Browse the repository at this point in the history
  • Loading branch information
tsightler committed Aug 18, 2021
1 parent 0953594 commit 0b61e35
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions devices/beam.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ class Beam extends RingSocketDevice {
}

publishData() {
if (this.entity.motion.hasOwnProperty('state_topic')) {
if (this.entity.hasOwnProperty('motion') && this.entity.motion.hasOwnProperty('state_topic')) {
const motionState = this.device.data.motionStatus === 'faulted' ? 'ON' : 'OFF'
this.publishMqtt(this.entity.motion.state_topic, motionState, true)
}
if (this.entity.light.hasOwnProperty('state_topic')) {
if (this.entity.hasOwnProperty('light') && this.entity.light.hasOwnProperty('state_topic')) {
const switchState = this.device.data.on ? 'ON' : 'OFF'
this.publishMqtt(this.entity.light.state_topic, switchState, true)
if (this.entity.light.hasOwnProperty('brightness_state_topic')) {
Expand Down

0 comments on commit 0b61e35

Please sign in to comment.