Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose: send periodically, throttle #765

Open
1 of 3 tasks
farmio opened this issue Sep 27, 2021 · 13 comments
Open
1 of 3 tasks

Expose: send periodically, throttle #765

farmio opened this issue Sep 27, 2021 · 13 comments

Comments

@farmio
Copy link
Member

farmio commented Sep 27, 2021

  • add an option to send expose values periodically.
  • add an option to suppress too fast updates of exposed values
  • add an option to send at xknx/HA start

Maybe from HA integration

@github-actions
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please make sure to update to the latest version of xknx (or Home Assistant) and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label Jan 11, 2022
@marvin-w marvin-w removed the stale label Jan 11, 2022
@fkzle
Copy link

fkzle commented Jan 31, 2022

I'd suggest the following:

exposure to KNX should be configurable by 2 parameters:
min_send_time
max_send_time

min_send_time throttles the sending to KNX: e.g. if a value is updated every 1s, but min_send_time is set to 1min,
only every 60th value should be forwardet to KNX for not flooding the bus.

max_send_time is the periodic to send the value, even though it has not changed: e.g. if a value is updated but not changed, it should be send every "max_send_time" to the KNX bus.

maybe, a 3rd parameter is necessary:
force_max_send_time: true would force sending the value every "max_send_time" to KNX, even if it was not updated in homeassistent. This could be handy for example for switch positions.

@github-actions
Copy link
Contributor

github-actions bot commented May 1, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please make sure to update to the latest version of xknx (or Home Assistant) and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label May 1, 2022
@farmio farmio added the no-stale label May 1, 2022
@github-actions github-actions bot removed the stale label May 1, 2022
@apoc4lyps
Copy link

Maybe you could consider to send the saved states on startup of Home Assistant to the KNX bus.

@farmio
Copy link
Member Author

farmio commented Sep 24, 2022

Hi 👋!
What would be the usecase for this?
On a HA restart the previous value should already have been sent on its last update before the shutdown.

@apoc4lyps
Copy link

Hi,
I use a binary sensor to lock a motion sensor. After a powerloss the motion sensor does not pick up the right state of the lock GA.
HA should announce the current state of the GA during it startup.

@ottonet
Copy link

ottonet commented Dec 14, 2022

Another use case is exposing time and date to the KNX-bus. There are plenty of KNX sensors with displays that require cyclic sending of time and date to ensure the display always shows the right time. (internal clocks of these devices are not very reliable)

@farmio
Copy link
Member Author

farmio commented Dec 14, 2022

@ottonet Hi 👋!
We do support that specific case already.

In HA: If you use expose with a type of time, date or datetime (no entity_id) it sends the current local time once every hour.

In xknx: Configure a xknx.devices.DateTime instance.

@ottonet
Copy link

ottonet commented Dec 14, 2022

@farmio Hi ;)

Good to know. Sadly the HA Expose documentation does not mention this.

At the same time, there are a few other use cases, where it would make sense. For instance Valve Drives for heating systems, can be set up to monitor the actuating value. If a value is not received in a certain time, it would open to a predefined position. This is to avoid total shutdown of a heating system, in case a thermostat is not functioning properly.

KNX Valve Drive monitoring actuating value

I'm actually planning to use a virtual thermostat in HA in the near future, where this thermostat would control a few KNX valves. In case HA crashes or something else is off, and the valve does not receive a new instruction within "X" amount of time, it would move itself to some kind of emergency postion, off or for instance 25%..

@farmio
Copy link
Member Author

farmio commented Dec 27, 2022

So #1094 solved the main issue here.

I think for periodical sending and other, more specialized usecases in HA an automation with knx.send is better suited than expose.
I'm still considering to add "send on startup".

Documentation of expose time is also fixed.

@ottonet
Copy link

ottonet commented Dec 28, 2022

"send on startup" is actually quite useful after situations like a power failure. Assuming the KNX system is up before HA, it would ensure that KNX devices always receive the correct value of an object after such a situation, as a read-request after power-on from the device to HA (which is still starting up) would fail in such a case.

I'm currently in a process of moving my logic and automations in my Gira HomeServer (in use since 2004) to Home Assistant, and I notice I have about 5 different implementations of cyclic sending. In the Gira HomeServer this is setup as an automation (logic building block) as well.

Obviously it's not too difficult to built such an automation in HA, yet from an end-user / integrator perspective, adding a few lines of YAML in knx_expose.yaml is much easier / more intuitive, and would cover 99% of the use-cases.

Example:
send_on_start: true
cyclic_sending: true
cycle_time: 3600

@farmio
Copy link
Member Author

farmio commented Dec 28, 2022

It should probably be send_on_connection or something then. As we should also send when HA is running but knx was reconnected - as it would be after a bus reset or something.
I guess this wouldn't work on routing though 🤔

@fkzle
Copy link

fkzle commented Dec 28, 2022

I also think that 1 or 2 lines of YAML are a lot easier to configure than generating an automation for every value that should be sent cyclically.

My usecase is also heating actuators, but different than that of ottonet.
I am using the controller inside the KNX heating actuator while the temperature sensors are sending their values via MQTT. I need to forward these temperature values through homeassistant to KNX. When the door to a room is closed, the temperature changes so little that no update is sent to the heating acutator. After 1h (this is configurable), the actuator assumes the temperature sensor is gone and goes to some fail-safe mode where the valves are 50% open.
I really don't like to disable this fail-safe feature, but without periodic sending of the temperatures, i see no other way.

The other possible way of implementing this could be:
if a (exposed) sensor has the "force_update == true" flag set, it is sent to KNX whenever a new value is received.

@farmio farmio added 💡 feature request Feature request and removed 🚀 enhancement enhancements labels Mar 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants