Skip to content

Commit

Permalink
check for control.bowls.type before access while creating feeder device
Browse files Browse the repository at this point in the history
  • Loading branch information
Sickbart committed Dec 29, 2024
1 parent c04bab6 commit f440f1d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2842,7 +2842,7 @@ class Sureflap extends utils.Adapter {
promiseArray.push(this.setObjectNotExistsPromise(obj_name + '.bowls.0.last_filled_at', this.buildStateObject('last filled at', 'date', 'string')));
promiseArray.push(this.setObjectNotExistsPromise(obj_name + '.bowls.0.last_zeroed_at', this.buildStateObject('last zeroed at', 'date', 'string')));

if (this.sureFlapState.devices[deviceIndex].control.bowls.type === FEEDER_SINGLE_BOWL) {
if (this.objectContainsPath(this.sureFlapState.devices[deviceIndex], 'control.bowls.type') && this.sureFlapState.devices[deviceIndex].control.bowls.type === FEEDER_SINGLE_BOWL) {
// remove bowl 1 (e.g. after change from dual to single bowl)
promiseArray.push(this.deleteObjectFormAdapterIfExists(obj_name + '.bowls.1', true));
Promise.all(promiseArray).then(() => {
Expand Down

0 comments on commit f440f1d

Please sign in to comment.