This commit is contained in:
parent
7077cf55fe
commit
7686d0af88
1 changed files with 15 additions and 12 deletions
|
@ -131,18 +131,21 @@ func lockCodeEditHandler(c echo.Context) error {
|
||||||
return fmt.Errorf("error pushing enabled state to lock %s (ZWaveDeviceID=%d ID=%d): %v", lock.Name, lock.ZwaveDeviceID, lock.ID, err)
|
return fmt.Errorf("error pushing enabled state to lock %s (ZWaveDeviceID=%d ID=%d): %v", lock.Name, lock.ZwaveDeviceID, lock.ID, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
newCode := c.FormValue("code")
|
newCode := "0000"
|
||||||
err = zwaveClient.SetNodeValue(ctx, int(lock.ZwaveDeviceID), zwavejs.NodeValue{
|
if enabled {
|
||||||
CCVersion: 1,
|
newCode := c.FormValue("code")
|
||||||
CommandClassName: zwavejs.CommandClassNameUserCode,
|
err = zwaveClient.SetNodeValue(ctx, int(lock.ZwaveDeviceID), zwavejs.NodeValue{
|
||||||
CommandClass: zwavejs.CommandClassUserCode,
|
CCVersion: 1,
|
||||||
Endpoint: 0,
|
CommandClassName: zwavejs.CommandClassNameUserCode,
|
||||||
Property: zwavejs.AnyType{Type: zwavejs.AnyTypeString, String: string(zwavejs.PropertyUserCode)},
|
CommandClass: zwavejs.CommandClassUserCode,
|
||||||
PropertyName: zwavejs.AnyType{Type: zwavejs.AnyTypeString, String: string(zwavejs.PropertyUserCode)},
|
Endpoint: 0,
|
||||||
PropertyKey: zwavejs.AnyType{Type: zwavejs.AnyTypeInt, Int: int(slot)},
|
Property: zwavejs.AnyType{Type: zwavejs.AnyTypeString, String: string(zwavejs.PropertyUserCode)},
|
||||||
}, zwavejs.AnyType{Type: zwavejs.AnyTypeString, String: newCode})
|
PropertyName: zwavejs.AnyType{Type: zwavejs.AnyTypeString, String: string(zwavejs.PropertyUserCode)},
|
||||||
if err != nil {
|
PropertyKey: zwavejs.AnyType{Type: zwavejs.AnyTypeInt, Int: int(slot)},
|
||||||
return fmt.Errorf("error pushing code to lock %s (ZWaveDeviceID=%d ID=%d): %v", lock.Name, lock.ZwaveDeviceID, lock.ID, err)
|
}, zwavejs.AnyType{Type: zwavejs.AnyTypeString, String: newCode})
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("error pushing code to lock %s (ZWaveDeviceID=%d ID=%d): %v", lock.Name, lock.ZwaveDeviceID, lock.ID, err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = queries.UpdateCodeSlot(ctx, db.UpdateCodeSlotParams{
|
err = queries.UpdateCodeSlot(ctx, db.UpdateCodeSlotParams{
|
||||||
|
|
Loading…
Reference in a new issue