Skip to content

Commit

Permalink
#39 Humidity plus adjustment should be in range 0..100
Browse files Browse the repository at this point in the history
  • Loading branch information
magx2 committed Sep 10, 2019
1 parent 3b17de3 commit 3e36e46
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main/kotlin/pl/grzeslowski/jsuplaservermock/InitDb.kt
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,12 @@ open class InitDb(private val deviceService: DeviceService) : CommandLineRunner
channel.function.caption = "Humidity channel #${channel.id}"

// https://github.com/SUPLA/supla-cloud/wiki/Channel-Functions-parameters
channel.param3 = random.nextInt(2000) - 1000
do {
channel.param3 = random.nextInt(2000) - 1000
} while (BigDecimal(channel.param3)
.divide(BigDecimal(100.0), CEILING)
.add(channel.state.humidity)
.toInt() in 0..100)

return channel
}
Expand Down

0 comments on commit 3e36e46

Please sign in to comment.