-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move all device models into the core module. That one needs anyway to…
… know about these for hybrid approaches. And over time inconsistencies regarding where stuff lives came in.
- Loading branch information
Showing
112 changed files
with
622 additions
and
420 deletions.
There are no files selected for viewing
4 changes: 1 addition & 3 deletions
4
...otlin/klanglicht/model/preferences/Dmx.kt → ...digits/kotlin/klanglicht/model/dmx/Dmx.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...klanglicht/model/preferences/DmxDevice.kt → .../kotlin/klanglicht/model/dmx/DmxDevice.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 3 additions & 4 deletions
7
...anglicht/rest/hybrid/model/HybridScene.kt → ...in/klanglicht/model/hybrid/HybridScene.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../rest/lightmanager/model/json/Actuator.kt → ...licht/model/lightmanager/json/Actuator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...tmanager/model/json/ActuatorProperties.kt → ...l/lightmanager/json/ActuatorProperties.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ht/rest/lightmanager/model/json/Device.kt → ...nglicht/model/lightmanager/json/Device.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ht/rest/lightmanager/model/json/Marker.kt → ...nglicht/model/lightmanager/json/Marker.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...t/rest/lightmanager/model/json/Project.kt → ...glicht/model/lightmanager/json/Project.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...cht/rest/lightmanager/model/json/Scene.kt → ...anglicht/model/lightmanager/json/Scene.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ightmanager/model/json/SceneProperties.kt → ...odel/lightmanager/json/SceneProperties.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
.../rest/lightmanager/model/json/Settings.kt → ...licht/model/lightmanager/json/Settings.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...t/rest/lightmanager/model/xml/Actuator.kt → ...glicht/model/lightmanager/xml/Actuator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ht/rest/lightmanager/model/xml/Command.kt → ...nglicht/model/lightmanager/xml/Command.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...t/rest/lightmanager/model/xml/Lightman.kt → ...glicht/model/lightmanager/xml/Lightman.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...icht/rest/lightmanager/model/xml/Scene.kt → ...langlicht/model/lightmanager/xml/Scene.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...licht/rest/lightmanager/model/xml/Zone.kt → ...klanglicht/model/lightmanager/xml/Zone.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 0 additions & 10 deletions
10
...-core/src/main/kotlin/de/visualdigits/kotlin/klanglicht/model/preferences/ShellyDevice.kt
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...langlicht/model/preferences/ColorState.kt → ...lin/klanglicht/model/shelly/ColorState.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...glicht-core/src/main/kotlin/de/visualdigits/kotlin/klanglicht/model/shelly/ShellyColor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package de.visualdigits.kotlin.klanglicht.model.shelly | ||
|
||
import de.visualdigits.kotlin.klanglicht.model.color.RGBColor | ||
import de.visualdigits.kotlin.klanglicht.model.hybrid.HybridScene | ||
import de.visualdigits.kotlin.klanglicht.model.parameter.Fadeable | ||
import de.visualdigits.kotlin.klanglicht.model.preferences.Preferences | ||
import de.visualdigits.kotlin.klanglicht.model.shelly.client.ShellyClient | ||
|
||
class ShellyColor( | ||
val ipAddress: String, | ||
val color: RGBColor, | ||
val gain: Float | ||
) : Fadeable<ShellyColor> { | ||
|
||
fun write() { | ||
ShellyClient.setColor(ipAddress, color, gain) | ||
} | ||
|
||
fun fade( | ||
other: ShellyColor, | ||
fadeDuration: Long, | ||
preferences: Preferences | ||
) { | ||
val dmxFrameTime = preferences.dmx.frameTime // millis | ||
val step = 1.0 / fadeDuration.toDouble() * dmxFrameTime.toDouble() | ||
var factor = 0.0 | ||
|
||
while (factor < 1.0) { | ||
fade(other, factor).write() | ||
factor += step | ||
Thread.sleep(dmxFrameTime) | ||
} | ||
other.write() | ||
} | ||
|
||
override fun fade(other: Any, factor: Double): ShellyColor { | ||
return if (other is ShellyColor) { | ||
ShellyColor(ipAddress, color.fade(other.color, factor), gain) | ||
} else { | ||
throw IllegalArgumentException("Cannot not fade another type") | ||
} | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
...licht-core/src/main/kotlin/de/visualdigits/kotlin/klanglicht/model/shelly/ShellyDevice.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package de.visualdigits.kotlin.klanglicht.model.shelly | ||
|
||
import de.visualdigits.kotlin.klanglicht.model.color.RGBColor | ||
import de.visualdigits.kotlin.klanglicht.model.shelly.client.ShellyClient | ||
import de.visualdigits.kotlin.klanglicht.model.shelly.status.Light | ||
import de.visualdigits.kotlin.klanglicht.model.shelly.status.Status | ||
|
||
|
||
data class ShellyDevice( | ||
val name: String = "", | ||
val model: String = "", | ||
val command: String = "", | ||
val ipAddress: String = "", | ||
val gain: Float = 0.0f | ||
) { | ||
|
||
override fun toString(): String { | ||
return "Shelly $name [$ipAddress] $model" | ||
} | ||
|
||
fun setPower( | ||
command: String, | ||
turnOn: Boolean, | ||
transitionDuration: Long | ||
): String { | ||
return ShellyClient.setPower( | ||
ipAddress = ipAddress, | ||
command = command, | ||
turnOn = turnOn, | ||
transitionDuration = transitionDuration | ||
) | ||
} | ||
|
||
fun setGain( | ||
gain: Int, | ||
transitionDuration: Long | ||
): String { | ||
return ShellyClient.setGain( | ||
ipAddress = ipAddress, | ||
gain = gain, | ||
transitionDuration = transitionDuration | ||
) | ||
} | ||
|
||
fun getStatus(): Status { | ||
return ShellyClient.getStatus(ipAddress) | ||
} | ||
|
||
fun setColor( | ||
rgbColor: RGBColor, | ||
gain: Float = 1.0f, | ||
transitionDuration: Long = 0, | ||
turnOn: Boolean = true, | ||
): Light { | ||
return ShellyClient.setColor( | ||
ipAddress = ipAddress, | ||
rgbColor = rgbColor, | ||
gain = gain, | ||
transitionDuration = transitionDuration, | ||
turnOn = turnOn | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
...core/src/main/kotlin/de/visualdigits/kotlin/klanglicht/model/shelly/status/ActionStats.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package de.visualdigits.kotlin.klanglicht.model.shelly.status | ||
|
||
|
||
class ActionStats( | ||
val skipped: Int? = null | ||
) |
2 changes: 1 addition & 1 deletion
2
...nglicht/rest/shelly/model/status/Cloud.kt → ...n/klanglicht/model/shelly/status/Cloud.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
.../main/kotlin/de/visualdigits/kotlin/klanglicht/model/shelly/status/ExternalTemperature.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package de.visualdigits.kotlin.klanglicht.model.shelly.status | ||
|
||
class ExternalTemperature |
3 changes: 3 additions & 0 deletions
3
...ht-core/src/main/kotlin/de/visualdigits/kotlin/klanglicht/model/shelly/status/Humidity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package de.visualdigits.kotlin.klanglicht.model.shelly.status | ||
|
||
class Humidity |
2 changes: 1 addition & 1 deletion
2
...nglicht/rest/shelly/model/status/Input.kt → ...n/klanglicht/model/shelly/status/Input.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...nglicht/rest/shelly/model/status/Meter.kt → ...n/klanglicht/model/shelly/status/Meter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
...glicht-core/src/main/kotlin/de/visualdigits/kotlin/klanglicht/model/shelly/status/Mqtt.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package de.visualdigits.kotlin.klanglicht.model.shelly.status | ||
|
||
|
||
class Mqtt( | ||
val connected: Boolean? = null | ||
) |
2 changes: 1 addition & 1 deletion
2
...nglicht/rest/shelly/model/status/Relay.kt → ...n/klanglicht/model/shelly/status/Relay.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
...icht-core/src/main/kotlin/de/visualdigits/kotlin/klanglicht/model/shelly/status/Sensor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package de.visualdigits.kotlin.klanglicht.model.shelly.status | ||
|
||
class Sensor |
2 changes: 1 addition & 1 deletion
2
...glicht/rest/shelly/model/status/Status.kt → .../klanglicht/model/shelly/status/Status.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...t/rest/shelly/model/status/Temperature.kt → ...glicht/model/shelly/status/Temperature.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...glicht/rest/shelly/model/status/Update.kt → .../klanglicht/model/shelly/status/Update.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...cht/rest/shelly/model/status/WifiState.kt → ...anglicht/model/shelly/status/WifiState.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.