mirror of
https://github.com/fmtr/haco.git
synced 2026-10-26 10:51:46 -04:00
15 lines
427 B
Python
15 lines
427 B
Python
from typing import Any
|
|
|
|
from haco import trigger
|
|
from haco.sensor import Sensor
|
|
from haco.tasmota import Tasmota
|
|
|
|
|
|
def get_memory_sensor():
|
|
memory_sensor = Sensor('Memory Free', uom='kB', device_class='DATA_SIZE', data_type=int)
|
|
|
|
@memory_sensor.callback(trigger.Cron('*/30 * * * * *'))
|
|
def tasmota(value: Tasmota[Any, 'tasmota.memory()']):
|
|
return value.get('heap_free', 'unknown')
|
|
|
|
return memory_sensor
|