From: Bernhard Tittelbach Date: Sat, 16 Nov 2013 21:13:11 +0000 (+0000) Subject: gasleak alert spaceapi X-Git-Url: https://git.realraum.at/?a=commitdiff_plain;h=d660271629ff32c40cff4fdff4449a39fe950159;p=svn42.git gasleak alert spaceapi --- diff --git a/go/r3-netstatus/main.go b/go/r3-netstatus/main.go index 0bb8d0e..a15c4ba 100644 --- a/go/r3-netstatus/main.go +++ b/go/r3-netstatus/main.go @@ -111,6 +111,8 @@ func EventToXMPP(bot *r3xmppbot.XmppBot, events <- chan interface{}, xmpp_presen last_frontdoor_ajar = event case r3events.BackdoorAjarUpdate: xmpp_presence_events_chan <- r3xmppbot.XMPPMsgEvent{Msg: fmt.Sprintf("Backdoor is %s (%s)",IfThenElseStr(event.Shut,"now shut.","ajar!"),time.Unix(event.Ts,0).String()), DistributeLevel: r3xmppbot.R3OnlineOnlyInfo, RememberAsStatus: false} + case r3events.GasLeakAlert: + xmpp_presence_events_chan <- r3xmppbot.XMPPMsgEvent{Msg: fmt.Sprintf("ALERT !! GasLeak Detected !!! (%s)", time.Unix(event.Ts,0).String()), DistributeLevel: r3xmppbot.R3NeverInfo, RememberAsStatus: false} case r3events.BoreDoomButtonPressEvent: xmpp_presence_events_chan <- r3xmppbot.XMPPMsgEvent{Msg: button_msg, DistributeLevel: r3xmppbot.R3OnlineOnlyInfo} xmpp_presence_events_chan <- button_status diff --git a/go/r3-netstatus/webstatus.go b/go/r3-netstatus/webstatus.go index 224fdc4..3da6e7d 100644 --- a/go/r3-netstatus/webstatus.go +++ b/go/r3-netstatus/webstatus.go @@ -107,6 +107,9 @@ func EventToWeb(ps *pubsub.PubSub) { spaceapidata.MergeInSensor(spaceapi.MakeTempCSensor(fmt.Sprintf("Temp%d",event.Sensorindex),tempsensorlocation, event.Value)) case r3events.IlluminationSensorUpdate: spaceapidata.MergeInSensor(spaceapi.MakeIlluminationSensor("Photodiode","LoTHR","1024V/5V", event.Value)) + case r3events.GasLeakAlert: + spaceapidata.AddSpaceEvent("GasLeak", "alert", "GasLeak Alert has been triggered") + publishStateToWeb() } } }