Publish changed value instantly to FHEM?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
TheTrumpeter
Normal user
Posts: 29
Joined: 02 Dec 2020, 15:30

Publish changed value instantly to FHEM?

#1 Post by TheTrumpeter » 21 Apr 2021, 12:20

I want to send a changed value from a pulse-counter instantly to FHEM.
In the pulse-counter (or any generic dummy-device that gets updated via rules) I have to set the "interval" to a value >0. Only in this interval the actual value will be sent to FHEM independet of it's changed or not. If I set it to a small value it would probably stress the FHEM-server, so I'd like to send the value only if it's changed. (Similar to the input-switches: if I set the interval to 0 there, a change is instantly sent to FHEM, but no further traffic is caused.)

As far as I understand there are only the commands "SendTo" and "Publish" available for rules, but "SendTo" ist for P2P-networks and "Publish" is only for MQTT.
Is there another option/workaround for that purpose?

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Publish changed value instantly to FHEM?

#2 Post by TD-er » 21 Apr 2021, 12:26

If the value doesn't change too frequently, you can also use the "monitor" command to watch a specific pin and send an event when it changes.
On this event you can then act in the rules.

Processing events does have a practical limit of roughly 10x per sec and place the most frequently occuring event at the top of the first rules file (even if you don't want to act on it)

TheTrumpeter
Normal user
Posts: 29
Joined: 02 Dec 2020, 15:30

Re: Publish changed value instantly to FHEM?

#3 Post by TheTrumpeter » 21 Apr 2021, 12:58

Thanks for your quick reply.

Still I could not send the information to FHEM instantly when "monitor" detects a changed pin.
Again I would have to define a dummy-device which then would send the information to FHEM based on the interval set for this dummy.

So I do not understand how "monitor" would help there.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Publish changed value instantly to FHEM?

#4 Post by TD-er » 21 Apr 2021, 13:50

You can send it to a dummy device and then call "taskrun" of that dummy to force sending it to the connected controller(s)
Or you "publish" directly to the MQTT controller from the rules.
Then you have the most freedom to create a topic and a message to publis.

TheTrumpeter
Normal user
Posts: 29
Joined: 02 Dec 2020, 15:30

Re: Publish changed value instantly to FHEM?

#5 Post by TheTrumpeter » 21 Apr 2021, 14:18

Thanks a lot, "Taskrun" is exactly what I'm looking for. Now it works perfectly.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Publish changed value instantly to FHEM?

#6 Post by TD-er » 21 Apr 2021, 14:36

Great! :)

Post Reply

Who is online

Users browsing this forum: No registered users and 37 guests