mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-11 10:45:00 +00:00
fix: bring modifications made to plugin over
This commit is contained in:
@@ -43,7 +43,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
protected override void RegisterActions()
|
||||
|
||||
{
|
||||
AddAction("/presets/fullStatus", (id, content) =>
|
||||
AddAction("/fullStatus", (id, content) =>
|
||||
{
|
||||
this.LogInformation("getting full status for client {id}", id);
|
||||
try
|
||||
@@ -56,7 +56,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
}
|
||||
});
|
||||
|
||||
AddAction("/presets/recall", (id, content) =>
|
||||
AddAction("/recall", (id, content) =>
|
||||
{
|
||||
var p = content.ToObject<PresetChannelMessage>();
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
RecallPreset(dev, p.Preset.Channel);
|
||||
});
|
||||
|
||||
AddAction("/presets/save", (id, content) =>
|
||||
AddAction("/save", (id, content) =>
|
||||
{
|
||||
var presets = content.ToObject<List<PresetChannel>>();
|
||||
|
||||
|
||||
@@ -2,7 +2,10 @@
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Core.Logging;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PepperDash.Essentials.AppServer.Messengers
|
||||
{
|
||||
@@ -56,10 +59,32 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
||||
|
||||
private void SendFullStatus()
|
||||
{
|
||||
var stateObject = new JObject();
|
||||
stateObject[_propName] = JToken.FromObject(itemDevice, serializer);
|
||||
PostStatusMessage(stateObject);
|
||||
try
|
||||
{
|
||||
this.LogInformation("Sending full status");
|
||||
|
||||
var stateObject = new ISelectableItemsStateMessage<TKey>
|
||||
{
|
||||
Items = itemDevice.Items,
|
||||
CurrentItem = itemDevice.CurrentItem
|
||||
};
|
||||
|
||||
PostStatusMessage(stateObject);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
this.LogError("Error sending full status: {0}", e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class ISelectableItemsStateMessage<TKey> : DeviceStateMessageBase
|
||||
{
|
||||
[JsonProperty("items")]
|
||||
public Dictionary<TKey, ISelectableItem> Items { get; set; }
|
||||
|
||||
[JsonProperty("currentItem")]
|
||||
public TKey CurrentItem { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user