mirror of
https://github.com/home-assistant/android
synced 2024-09-18 23:52:51 +00:00
Fix light sensor control (#1065)
This commit is contained in:
parent
366b02ed15
commit
16625e9614
|
@ -44,7 +44,7 @@ class LightControl {
|
||||||
RangeTemplate(
|
RangeTemplate(
|
||||||
entity.entityId,
|
entity.entityId,
|
||||||
0f,
|
0f,
|
||||||
255f,
|
100f,
|
||||||
(entity.attributes["brightness"] as? Number)
|
(entity.attributes["brightness"] as? Number)
|
||||||
?.toFloat()
|
?.toFloat()
|
||||||
?.div(255f)
|
?.div(255f)
|
||||||
|
@ -74,12 +74,13 @@ class LightControl {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
is FloatAction -> {
|
is FloatAction -> {
|
||||||
|
val convertBrightness = action.newValue.div(100).times(255)
|
||||||
integrationRepository.callService(
|
integrationRepository.callService(
|
||||||
action.templateId.split(".")[0],
|
action.templateId.split(".")[0],
|
||||||
"turn_on",
|
"turn_on",
|
||||||
hashMapOf(
|
hashMapOf(
|
||||||
"entity_id" to action.templateId,
|
"entity_id" to action.templateId,
|
||||||
"brightness" to action.newValue.toInt()
|
"brightness" to convertBrightness.toInt()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
true
|
true
|
||||||
|
|
Loading…
Reference in a new issue