You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey, I'd love to help with this project, and I will give the caveat that I'm still fairly new to C# and .NET so I want to make sure I'm not reinventing the wheel or missing that this feature may already be present.
Any feedback on if this should not be done this way, or if this has already been done, or if there's a better way/reason to just plain not do it would be welcome. I'd obviously be doing things like passing brightness and color as optional parameters, this is a very very basic example to check if this is something you'd like to have added.
Code Example
publicclassLight{privatestaticstringdomain=>"light";/// <summary>/// The entity name in HA for the light/// </summary>publicstringEntityName{get;}/// <summary>/// Constructor that takes the entity name of the light to control as a string (Do not prepend light. to the entity name.)/// </summary>/// <param name="lightEntityName"></param>publicLight(stringlightEntityName){EntityName=lightEntityName;serviceClient= ClientFactory.GetClient<ServiceClient>();}/// <summary>/// Calls the turn_on service in HA for the light/// </summary>/// <returns></returns>publicList<StateObject>TurnOn(){varresultingState= serviceClient.CallService(domain,"turn_on",new{ entity_id =$"{domain}.{EntityName}"});return resultingState.Result;}/// <summary>/// Calls the turn_off service in HA for the light/// </summary>/// <returns></returns>publicList<StateObject>TurnOff(){varresultingState= serviceClient.CallService(domain,"turn_off",new{ entity_id =$"{domain}.{EntityName}"});return resultingState.Result;}privateServiceClientserviceClient;}
HA API Docs or Sample
The text was updated successfully, but these errors were encountered:
New Feature Description
Hey, I'd love to help with this project, and I will give the caveat that I'm still fairly new to C# and .NET so I want to make sure I'm not reinventing the wheel or missing that this feature may already be present.
Any feedback on if this should not be done this way, or if this has already been done, or if there's a better way/reason to just plain not do it would be welcome. I'd obviously be doing things like passing brightness and color as optional parameters, this is a very very basic example to check if this is something you'd like to have added.
Code Example
HA API Docs or Sample
The text was updated successfully, but these errors were encountered: