mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-04-12 03:57:27 +00:00
Merge pull request #231 from PepperDash/feature/RemoteOccupancy-Info-Update
Update RemoteOccupancy Info to send data via string
This commit is contained in:
commit
c98cd05a5c
1 changed files with 23 additions and 8 deletions
|
|
@ -105,7 +105,9 @@ namespace PepperDash.Essentials.Core.Fusion
|
||||||
// Default poll time is 5 min unless overridden by config value
|
// Default poll time is 5 min unless overridden by config value
|
||||||
public long SchedulePollInterval = 300000;
|
public long SchedulePollInterval = 300000;
|
||||||
|
|
||||||
public long PushNotificationTimeout = 5000;
|
public long PushNotificationTimeout = 5000;
|
||||||
|
|
||||||
|
private const string RemoteOccupancyXml = "<Occupancy><Type>Local</Type><State>{0}</State></Occupancy>";
|
||||||
|
|
||||||
protected Dictionary<int, FusionAsset> FusionStaticAssets;
|
protected Dictionary<int, FusionAsset> FusionStaticAssets;
|
||||||
|
|
||||||
|
|
@ -115,7 +117,10 @@ namespace PepperDash.Essentials.Core.Fusion
|
||||||
// For use with occ sensor attached to a scheduling panel in Fusion
|
// For use with occ sensor attached to a scheduling panel in Fusion
|
||||||
protected FusionOccupancySensorAsset FusionOccSensor;
|
protected FusionOccupancySensorAsset FusionOccSensor;
|
||||||
|
|
||||||
public BoolFeedback RoomIsOccupiedFeedback { get; private set; }
|
public BoolFeedback RoomIsOccupiedFeedback { get; private set; }
|
||||||
|
|
||||||
|
private string _roomOccupancyRemoteString;
|
||||||
|
public StringFeedback RoomOccupancyRemoteStringFeedback { get; private set; }
|
||||||
|
|
||||||
protected Func<bool> RoomIsOccupiedFeedbackFunc
|
protected Func<bool> RoomIsOccupiedFeedbackFunc
|
||||||
{
|
{
|
||||||
|
|
@ -1365,14 +1370,24 @@ namespace PepperDash.Essentials.Core.Fusion
|
||||||
var occSensorShutdownMinutes = FusionRoom.CreateOffsetUshortSig(70, "Occ Shutdown - Minutes", eSigIoMask.InputOutputSig);
|
var occSensorShutdownMinutes = FusionRoom.CreateOffsetUshortSig(70, "Occ Shutdown - Minutes", eSigIoMask.InputOutputSig);
|
||||||
|
|
||||||
// Tie to method on occupancy object
|
// Tie to method on occupancy object
|
||||||
//occSensorShutdownMinutes.OutputSig.UserObject(new Action(ushort)(b => Room.OccupancyObj.SetShutdownMinutes(b));
|
//occSensorShutdownMinutes.OutputSig.UserObject(new Action(ushort)(b => Room.OccupancyObj.SetShutdownMinutes(b));
|
||||||
|
|
||||||
|
|
||||||
|
RoomOccupancyRemoteStringFeedback = new StringFeedback(() => _roomOccupancyRemoteString);
|
||||||
|
Room.RoomOccupancy.RoomIsOccupiedFeedback.LinkInputSig(occSensorAsset.RoomOccupied.InputSig);
|
||||||
|
Room.RoomOccupancy.RoomIsOccupiedFeedback.OutputChange += RoomIsOccupiedFeedback_OutputChange;
|
||||||
|
RoomOccupancyRemoteStringFeedback.LinkInputSig(occSensorAsset.RoomOccupancyInfo.InputSig);
|
||||||
|
|
||||||
|
|
||||||
Room.RoomOccupancy.RoomIsOccupiedFeedback.LinkInputSig(occSensorAsset.RoomOccupied.InputSig);
|
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
void RoomIsOccupiedFeedback_OutputChange(object sender, FeedbackEventArgs e)
|
||||||
|
{
|
||||||
|
_roomOccupancyRemoteString = String.Format(RemoteOccupancyXml, e.BoolValue ? "Occupied" : "Unoccupied");
|
||||||
|
RoomOccupancyRemoteStringFeedback.FireUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
/// Helper to get the number from the end of a device's key string
|
/// Helper to get the number from the end of a device's key string
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>-1 if no number matched</returns>
|
/// <returns>-1 if no number matched</returns>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue