diff --git a/hass-workstation-service/Communication/InterProcesCommunication/InterProcessApi.cs b/hass-workstation-service/Communication/InterProcesCommunication/InterProcessApi.cs index 6bc188a..16b0409 100644 --- a/hass-workstation-service/Communication/InterProcesCommunication/InterProcessApi.cs +++ b/hass-workstation-service/Communication/InterProcesCommunication/InterProcessApi.cs @@ -201,6 +201,7 @@ namespace hass_workstation_service.Communication.InterProcesCommunication { AvailableCommands.ShutdownCommand => new ShutdownCommand(_publisher, model.Name), AvailableCommands.RestartCommand => new RestartCommand(_publisher, model.Name), + AvailableCommands.HibernateCommand => new HibernateCommand(_publisher, model.Name), AvailableCommands.LogOffCommand => new LogOffCommand(_publisher, model.Name), AvailableCommands.CustomCommand => new CustomCommand(_publisher, model.Command, model.Name), AvailableCommands.PlayPauseCommand => new PlayPauseCommand(_publisher, model.Name), diff --git a/hass-workstation-service/Communication/InterProcesCommunication/ServiceContractModels.cs b/hass-workstation-service/Communication/InterProcesCommunication/ServiceContractModels.cs index 9a692ba..2ec85e5 100644 --- a/hass-workstation-service/Communication/InterProcesCommunication/ServiceContractModels.cs +++ b/hass-workstation-service/Communication/InterProcesCommunication/ServiceContractModels.cs @@ -110,6 +110,7 @@ namespace hass_workstation_service.Communication.InterProcesCommunication.Models ShutdownCommand, LogOffCommand, RestartCommand, + HibernateCommand, KeyCommand, PlayPauseCommand, NextCommand, diff --git a/hass-workstation-service/Data/ConfigurationService.cs b/hass-workstation-service/Data/ConfigurationService.cs index 7b63668..dbd655a 100644 --- a/hass-workstation-service/Data/ConfigurationService.cs +++ b/hass-workstation-service/Data/ConfigurationService.cs @@ -177,6 +177,9 @@ namespace hass_workstation_service.Data case "RestartCommand": command = new RestartCommand(publisher, configuredCommand.Name, configuredCommand.Id); break; + case "HibernateCommand": + command = new HibernateCommand(publisher, configuredCommand.Name, configuredCommand.Id); + break; case "LogOffCommand": command = new LogOffCommand(publisher, configuredCommand.Name, configuredCommand.Id); break; diff --git a/hass-workstation-service/Domain/Commands/HibernateCommand.cs b/hass-workstation-service/Domain/Commands/HibernateCommand.cs new file mode 100644 index 0000000..e2e3d7a --- /dev/null +++ b/hass-workstation-service/Domain/Commands/HibernateCommand.cs @@ -0,0 +1,17 @@ +using hass_workstation_service.Communication; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace hass_workstation_service.Domain.Commands +{ + public class HibernateCommand : CustomCommand + { + public HibernateCommand(MqttPublisher publisher, string name = "Hibernate", Guid id = default(Guid)) : base(publisher, "shutdown /h", name ?? "Hibernate", id) + { + this.State = "OFF"; + } + } +}