@@ -479,6 +479,46 @@ def _build_local_stats_sensors(
479479 )
480480 for node_id , node_info in nodes_with_local_stats .items ()
481481 ]
482+
483+ entities += [
484+ MeshtasticSensor (
485+ coordinator = coordinator ,
486+ entity_description = MeshtasticSensorEntityDescription (
487+ key = "stats_heap_total_bytes" ,
488+ name = "Heap Total" ,
489+ icon = "mdi:memory" ,
490+ native_unit_of_measurement = UnitOfInformation .BYTES ,
491+ device_class = SensorDeviceClass .DATA_SIZE ,
492+ state_class = SensorStateClass .MEASUREMENT ,
493+ value_fn = lambda device : device .coordinator .data [device .node_id ]
494+ .get ("localStats" , {})
495+ .get ("heapTotalBytes" , None ),
496+ ),
497+ gateway = gateway ,
498+ node_id = node_id ,
499+ )
500+ for node_id , node_info in nodes_with_local_stats .items ()
501+ ]
502+
503+ entities += [
504+ MeshtasticSensor (
505+ coordinator = coordinator ,
506+ entity_description = MeshtasticSensorEntityDescription (
507+ key = "stats_heap_free_bytes" ,
508+ name = "Heap Free" ,
509+ icon = "mdi:memory" ,
510+ native_unit_of_measurement = UnitOfInformation .BYTES ,
511+ device_class = SensorDeviceClass .DATA_SIZE ,
512+ state_class = SensorStateClass .MEASUREMENT ,
513+ value_fn = lambda device : device .coordinator .data [device .node_id ]
514+ .get ("localStats" , {})
515+ .get ("heapFreeBytes" , None ),
516+ ),
517+ gateway = gateway ,
518+ node_id = node_id ,
519+ )
520+ for node_id , node_info in nodes_with_local_stats .items ()
521+ ]
482522 except : # noqa: E722
483523 LOGGER .warning ("Failed to create local stats entities" , exc_info = True )
484524
0 commit comments