Closed pavelw closed 5 months ago
update_interval:
and the esphome docs mention it could be possible:
I can make some PR with support of these functions, but I would need some example code.. started to search for that
Hi,
The filters throttle_average
and heartbeat
are for sensor
components and not for text_sensor
. This is a function of ESP Home. See filters for sensors vs text_sensor:
If you want a throttle_average
and heartbeat
filter for text_sensor please submit a PR to the ESP Home project.
The component does not use update_interval
as I don't control the communication. Whenever the Victron device submits a Bluetooth package and the ESPHome receives it an update is triggered. No reason for an update interval.
Update interval is useful because it allows limiting the number of updates, reducing the amount of network traffic.
I do not expect anything, just explaining my point of view. thanks for the component, it works quite well as it is! :)
Workaround to limit text_filters without update_interval implemented:
- lambda: |-
static std::string last;
if (x == last)
return {};
last = x;
return x;
found this at https://community.home-assistant.io/t/send-template-text-sensor-state-to-ha-only-at-change/568655/18 in current form, will not publish update if it is the same value as previous one.
seems it can be easily improved, probably "hearbeat" and "throttle_average" code can be ported from esphome filter.cpp
seems that some sensors cannot be filtered.
text_sensor:
platform: victron_ble victron_ble_id: MySmartShunt name: "Battery Alarm reason" state_topic: ${device}/shunt/alarm_reason type: ALARM_REASON filters:
platform: victron_ble victron_ble_id: MySmartSolar name: "MPPT state" state_topic: ${device}/mppt/state type: DEVICE_STATE filters:
platform: victron_ble victron_ble_id: MySmartSolar name: "MPPT Error reason" state_topic: ${device}/mppt/error_reason type: CHARGER_ERROR filters:
for other sensors it works correctly:
platform: victron_ble victron_ble_id: MyCharger name: "charger input voltage" state_topic: ${device}/charger/input_voltage type: INPUT_VOLTAGE filters:
platform: victron_ble victron_ble_id: MyCharger name: "charger output voltage" state_topic: ${device}/charger/output_voltage type: OUTPUT_VOLTAGE filters:
platform: victron_ble victron_ble_id: MySmartShunt name: "shunt ETA" state_topic: ${device}/shunt/eta type: TIME_TO_GO
filters:
platform: victron_ble victron_ble_id: MySmartShunt name: "shunt Battery voltage" state_topic: ${device}/shunt/voltage type: BATTERY_VOLTAGE filters:
filtering is useful to reduce amount of reported data - load on wifi and mqtt systems. if not this, then support for "update_interval" would be nice :)
==== operation info ESPHome 2023.12.9
component works for me on:
all devices work flawlessly but seems that esphome needs more than basic ESP32 for BLE in my config. works ok on ESP32-S3-WROOM-1-N16R8 module