Skip to content

Commit ae64b0f

Browse files
committed
fix: initialize gpio-switch state to off on startup
s.state was never set when the initial value is "off" (the default), leaving it as an empty string. Querying state before the first on/off command printed "Current state: " with no value. Signed-off-by: Fabian Wienand <fabian.wienand@blindspot.software>
1 parent 2d61fc9 commit ae64b0f

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

pkg/module/gpio/gpio.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,8 @@ func (s *Switch) Init() error {
256256
return s.on()
257257
}
258258

259+
s.state = off
260+
259261
return s.off()
260262
}
261263

0 commit comments

Comments
 (0)