Fix entity state non updated on entity page
This commit is contained in:
parent
5dcb27ada7
commit
8fc7d0b61e
@ -21,7 +21,8 @@ class _EntityViewPageState extends State<EntityViewPage> {
|
|||||||
super.initState();
|
super.initState();
|
||||||
_stateSubscription = eventBus.on<StateChangedEvent>().listen((event) {
|
_stateSubscription = eventBus.on<StateChangedEvent>().listen((event) {
|
||||||
if (event.entityId == widget.entityId) {
|
if (event.entityId == widget.entityId) {
|
||||||
Logger.d("State change event handled by entity page: ${event.entityId}");
|
entity = HomeAssistant().entities.get(widget.entityId);
|
||||||
|
Logger.d("[Entity page] State change event handled: ${event.entityId}");
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -661,7 +661,7 @@ class _MainPageState extends ReceiveShareState<MainPage> with WidgetsBindingObse
|
|||||||
Widget mediaMenuIcon;
|
Widget mediaMenuIcon;
|
||||||
int playersCount = 0;
|
int playersCount = 0;
|
||||||
if (!empty && !HomeAssistant().entities.isEmpty) {
|
if (!empty && !HomeAssistant().entities.isEmpty) {
|
||||||
List<Entity> activePlayers = HomeAssistant().entities.getByDomains(domains: ["media_player"], stateFiler: [EntityState.paused, EntityState.playing]);
|
List<Entity> activePlayers = HomeAssistant().entities.getByDomains(domains: ["media_player"], stateFiler: [EntityState.paused, EntityState.playing, EntityState.idle]);
|
||||||
playersCount = activePlayers.length;
|
playersCount = activePlayers.length;
|
||||||
mediaMenuItems.addAll(
|
mediaMenuItems.addAll(
|
||||||
activePlayers.map((entity) => PopupMenuItem<String>(
|
activePlayers.map((entity) => PopupMenuItem<String>(
|
||||||
|
Reference in New Issue
Block a user