Skip to content

Commit

Permalink
fix TypeError stat
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucky-ESA committed May 9, 2024
1 parent b7c2081 commit c9793c5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ The adapter can control the mower and you can change config params like mowtimes
### **WORK IN PROGRESS**

- (Lucky-ESA) mowTimeExtend restricted input
- (Lucky-ESA) Fixed TypeError

### 3.0.1 (2024-05-08)

Expand Down
10 changes: 8 additions & 2 deletions lib/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -2288,12 +2288,18 @@ module.exports = {
val: data.cfg.modules.HL.enabled == null ? 0 : data.cfg.modules.HL.enabled,
ack: true,
});
let hl_status = "NO camera";
let on = 0;
if (data && data.dat && data.dat.modules && data.dat.modules.HL) {
hl_status = data.dat.modules.HL.stat == null ? "NOK" : data.dat.modules.HL.stat;
on = data.dat.modules.HL.on == null ? 0 : data.dat.modules.HL.on;
}
await this.setStateAsync(mower.serial_number + ".modules.HL.status", {
val: data.dat.modules.HL.stat == null ? "NOK" : data.dat.modules.HL.stat,
val: hl_status,
ack: true,
});
await this.setStateAsync(mower.serial_number + ".modules.HL.on", {
val: data.dat.modules.HL.on == null ? 0 : data.dat.modules.HL.on,
val: on,
ack: true,
});
}
Expand Down

0 comments on commit c9793c5

Please sign in to comment.