Skip to content

Commit

Permalink
Added the status change message to the switch (over WS)
Browse files Browse the repository at this point in the history
  • Loading branch information
RaHoni committed Oct 2, 2020
1 parent a4033e2 commit 7d47b34
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/scala/PrivateHome/Devices/Switch.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import PrivateHome.Devices.MQTT.mqttSwitch
import PrivateHome.UI.commandAddDevice
import PrivateHome.{data, editXML}
import PrivateHome.data.idTest
import PrivateHome.UI.Websocket.websocket
import org.json4s.JsonAST.JObject
import org.json4s.{CustomSerializer, JsonAST}
import org.json4s.JsonDSL._
Expand Down Expand Up @@ -36,6 +37,7 @@ abstract class Switch(private val setupID: String, setupKeepStatus: Boolean, var
def Status(state: Float): Unit = {
_status = state
if (setupKeepStatus) data.saveStatus(id,state)
websocket.broadcastMsg(("Command" -> "statusChange") ~ ("answer" -> (("id" -> id) ~ ("status" -> state) ~ ("type" -> switchtype))))
}

def id: String = setupID
Expand Down

0 comments on commit 7d47b34

Please sign in to comment.