quazzie / tellstick-plugin-mqtt-hass

Plugin for tellstick, connect to homeassistant via mqtt with autodiscovery.
39 stars 7 forks source link

Scan interval for MQTT polling against Tellstick? #20

Closed acateon closed 3 years ago

acateon commented 4 years ago

Have tried the plugin for a few days and must say that it works really well.

What bothers me (and by me I mean my significant other) is the respons time. From switching of a single light theres a latency around 1-2 seconds. If toggling a group of multiple lights and switches there might be a delay up to 10 seconds before the interface changes state for the group icon.

This results in the user presses the switch/light/group toggle again before all lights/switches are off and unintentionally trigger the switch/light/group again.

Is there a way to make HA act as of the switch etc is of as soon as it is pressed or solve the problem above some other way?

uphillbattle commented 4 years ago

Not sure what your setup is, but I have not not noticed appreciable delay/latency in the MQTT communication between the Tellstick and HA. I am currently only using the Tellstick to receive commands from remote controls. They trigger automations in HA that control Zigbee and Z-Wave devices. When pushing a remote control button, the Zigbee/Z-Wave device reaction is practically instant - I don't have the time to push the remote button again before the devices have acted.

However, I previously used the Tellstick to control a number of 433 MHz controlled "smart plugs". Triggering one happened with only a small delay (1 second?). Triggering a group of such switches, I noticed that each plug was triggered in turn. Thus, triggering 4 switches would take about 4 (-ish) seconds from start until the last of the four plugs would switch. It would seem that the Tellstick transmits one message at a time and takes some time to do it.

Could this be the behavior you're observing? If so, it's probably not the MQTT communication, it's the Tellstick.

fredrike commented 4 years ago

However, I previously used the Tellstick to control a number of 433 MHz controlled "smart plugs". Triggering one happened with only a small delay (1 second?). Triggering a group of such switches, I noticed that each plug was triggered in turn. Thus, triggering 4 switches would take about 4 (-ish) seconds from start until the last of the four plugs would switch. It would seem that the Tellstick transmits one message at a time and takes some time to do it.

Could this be the behavior you're observing? If so, it's probably not the MQTT communication, it's the Tellstick

I think @quazzie is right it is an Telldus problem. But, you can fix this by creating a script that toggles the specific devices based on the state of an input_boolean and to indicate status (while the script is running). Also make sure that the script is in single running mode https://www.home-assistant.io/blog/2020/07/22/release-113/#automations--scripts-running-modes and add a cool down https://www.home-assistant.io/blog/2020/07/22/release-113/#automations--scripts-bonus-cool-down

Create a topic in the forum and tag me (@fredrike) and I'll try to write together a real example.

jannecklarsson commented 3 years ago

I have the same issue. (Mqtt plugin) a fibaro zwave switch -> tellstick -> ha -> automation -> tellstick -> Switch toggle (zwave).

The delay in this chain is 2-10 seconds. I too think its tellstick bit the guys at telldus cant help in another way then saying ”its nothing wrong with tellstick”.

I have single and delay to prevent multiple actions.

Have got any news acateon?

//j

acateon commented 3 years ago

I’ve did as @fredrike suggested.

A boolean for every light group in my case. Then a script or a automation to turn the light group on or off depending of the toggle value of the boolean.

Just make sure that if the state change of a single entity in your group or the group itself triggers a update of the boolean to keep everything in sync.

As in my case the sluggish response only really were a problem for groups and not single entities it solved the user experience.

jannecklarsson commented 3 years ago

Creating an input_boolean will speed ut the chain a bit since ha doesnt have to "scan" states of lights in a group.

BUT, if I tail -f home-assistant.log there is a 1-2 second delay before "[homeassistant.components.mqtt] Received message on homeassistant/switch/znetmqtt/42/state: b'OFF'" is received.

Is this a delay between tellstick mqtt and ha mqtt or is it a delay from fibaro swith and tellstick? That is the Q ;)

If I press "Basic ON/OFF" in telldus live on fibaro sub-node I can hear the click in the fibaro switch pretty instantly.

quazzie commented 3 years ago

I don't think this is a plugin problem. Reopen / create new issue with more info if you feel diffrently.