public static StateChange Map(this HassStateChangedEventData source, IHaContext haContext) { return(new StateChange( new Entity(haContext, source.EntityId), Map(source.OldState), Map(source.NewState))); }
internal void AddStateChangeEvent(HassState oldState, HassState newState) { var data = new HassStateChangedEventData { EntityId = newState.EntityId, NewState = newState, OldState = oldState }; try { HomeAssistantEventMock.OnNext( new HassEvent { EventType = "state_changed", DataElement = data.ToJsonElement() } ); } catch (Exception e) { System.Console.WriteLine(e.Message); } }