public List <AlexaProperty> GetPropertyStates() { List <AlexaProperty> properties = new List <AlexaProperty>(); for (int x = 0; x <= 2; x++) { Temperature temp = new Temperature(Endpoint.GetValueAsync <double>(_premiseProperties[x]).GetAwaiter().GetResult()); AlexaProperty property = new AlexaProperty { @namespace = Namespace, name = _alexaProperties[x], value = new AlexaTemperature(Math.Round(temp.Fahrenheit, 1), "FAHRENHEIT"), timeOfSample = PremiseServer.UtcTimeStamp() }; properties.Add(property); } int mode = Endpoint.GetValueAsync <int>(_premiseProperties[3]).GetAwaiter().GetResult(); AlexaProperty thermostatMode = new AlexaProperty { @namespace = Namespace, name = _alexaProperties[3], value = ModeToString(mode), timeOfSample = PremiseServer.UtcTimeStamp() }; properties.Add(thermostatMode); return(properties); }
public List <AlexaProperty> GetPropertyStates() { List <AlexaProperty> properties = new List <AlexaProperty>(); double volume = Endpoint.GetValueAsync <double>("Volume").GetAwaiter().GetResult(); AlexaProperty volumeProperty = new AlexaProperty { @namespace = Namespace, name = _alexaProperties[0], value = (int)((volume * 100)).LimitToRange(0, 100), timeOfSample = PremiseServer.UtcTimeStamp() }; properties.Add(volumeProperty); bool mute = Endpoint.GetValueAsync <bool>("Mute").GetAwaiter().GetResult(); AlexaProperty muteProperty = new AlexaProperty { @namespace = Namespace, name = _alexaProperties[1], value = mute, timeOfSample = PremiseServer.UtcTimeStamp() }; properties.Add(muteProperty); return(properties); }
public void ProcessControllerDirective() { try { string valueToSend; if (Header.name == "Activate") { valueToSend = "True"; Response.Event.header.name = "ActivationStarted"; } else if (Header.name == "Deactivate") { valueToSend = "False"; Response.Event.header.name = "DeactivationStarted"; } else { ReportError(AlexaErrorTypes.INVALID_DIRECTIVE, "Operation not supported!"); return; } Endpoint.SetValueAsync(_premiseProperties[0], valueToSend).GetAwaiter().GetResult(); Response.context.properties = null; Response.Event.header.@namespace = "Alexa.SceneController"; Response.Event.payload.cause = new ChangeReportCause { type = "VOICE_INTERACTION" }; Response.Event.payload.timestamp = PremiseServer.UtcTimeStamp(); Response.Event.endpoint.cookie.path = Endpoint.GetPathAsync().GetAwaiter().GetResult(); } catch (Exception ex) { ReportError(AlexaErrorTypes.INTERNAL_ERROR, ex.Message); } }
public List <AlexaProperty> GetPropertyStates() { List <AlexaProperty> properties = new List <AlexaProperty>(); bool powerState = Endpoint.GetValueAsync <bool>(_premiseProperties[0]).GetAwaiter().GetResult(); AlexaProperty property = new AlexaProperty { @namespace = Namespace, value = (powerState ? "ActivationStarted" : "DeactivationStarted"), timeOfSample = PremiseServer.UtcTimeStamp() }; properties.Add(property); return(properties); }
public List <AlexaProperty> GetPropertyStates() { List <AlexaProperty> properties = new List <AlexaProperty>(); bool isReachable = Endpoint.GetValueAsync <bool>(premiseProperties[0]).GetAwaiter().GetResult(); AlexaProperty property = new AlexaProperty { @namespace = @namespace, name = alexaProperties[0], timeOfSample = PremiseServer.UtcTimeStamp(), value = new AlexaEndpointHealthValue((isReachable ? "OK" : "UNREACHABLE")) }; properties.Add(property); return(properties); }
public List <AlexaProperty> GetPropertyStates() { List <AlexaProperty> properties = new List <AlexaProperty>(); double colorTemperature = Endpoint.GetValueAsync <double>(_premiseProperties[0]).GetAwaiter().GetResult(); AlexaProperty property = new AlexaProperty { @namespace = Namespace, name = _alexaProperties[0], value = ((int)colorTemperature).LimitToRange(1000, 10000), timeOfSample = PremiseServer.UtcTimeStamp() }; properties.Add(property); return(properties); }
public List <AlexaProperty> GetPropertyStates() { List <AlexaProperty> properties = new List <AlexaProperty>(); double temperature = Endpoint.GetValueAsync <double>(_premiseProperties[0]).GetAwaiter().GetResult(); Temperature temp = new Temperature(temperature); AlexaProperty property = new AlexaProperty { @namespace = Namespace, name = _alexaProperties[0], value = new AlexaTemperature(Math.Round(temp.Fahrenheit, 1), "FAHRENHEIT"), timeOfSample = PremiseServer.UtcTimeStamp() }; properties.Add(property); return(properties); }
public List <AlexaProperty> GetPropertyStates() { List <AlexaProperty> properties = new List <AlexaProperty>(); AlexaProperty volumeProperty = new AlexaProperty { @namespace = Namespace, name = _alexaProperties[0], value = GetCurrentInput(), timeOfSample = PremiseServer.UtcTimeStamp() }; if ((string)volumeProperty.value == "") { volumeProperty.value = "NONE"; } properties.Add(volumeProperty); return(properties); }
public List <AlexaProperty> GetPropertyStates() { List <AlexaProperty> properties = new List <AlexaProperty>(); AlexaColorValue colorValue = new AlexaColorValue(); foreach (string premiseProperty in _premiseProperties) { switch (premiseProperty) { case "Hue": colorValue.hue = Math.Round(Endpoint.GetValueAsync <double>(premiseProperty).GetAwaiter().GetResult().LimitToRange(0.0, 360.0), 4); break; case "Saturation": colorValue.saturation = Math.Round(Endpoint.GetValueAsync <double>(premiseProperty).GetAwaiter().GetResult().LimitToRange(0.0, 1.0), 4); break; case "Brightness": colorValue.brightness = Math.Round(Endpoint.GetValueAsync <double>(premiseProperty).GetAwaiter().GetResult().LimitToRange(0.0, 1.0), 4); break; } } AlexaProperty property = new AlexaProperty { @namespace = Namespace, name = _alexaProperties[0], value = colorValue, timeOfSample = PremiseServer.UtcTimeStamp() }; properties.Add(property); return(properties); }