!serial rules filter

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Galan
Normal user
Posts: 19
Joined: 28 Dec 2022, 23:13

!serial rules filter

#1 Post by Galan » 22 Sep 2023, 23:32

Hello guys,

With some perseverance=https://www.letscontrolit. ... php?t=9520, and help from Ath and td-er (again my thanks!!), I succeeded to make rflink and esp easy over mqtt works :)
now I'm goofing around with rules but bumping my head agents an action what I'd like

I want to give buttons in ESP easy their own name, so over MQTT only the name and status is sent. I thought it's easier to do the translation in ESP Easy than Home Assistant.

So !Serial#20;E2;TriState;ID=0a82a2;SWITCH=0;CMD=ON; must become dom/button/a, "on"

I've tried the lines below as test and only the first and second works. Does someone have a suggestion? I do not want to do the translation in node-red

Code: Select all

on !Serial do
 Publish, %sysname%/switch,  %eventvalue% // The data is added after the # as the event-parameter name
 Publish, %sysname%/switch,  {substring:26:32:%eventvalue%}
Let, temp, {substring:26:32:%eventvalue%}
Publish, %sysname%/switch, [var#temp]

If {equals_ci:'{0a82a2}':{substring:26:32:[%eventvalue%]} }= 1
    Publish, %sysname%/switch, niet_waar
 Endif   

If %eventvalue% ='{TriState;ID=0a82a2;SWITCH=0;CMD=ON;}'
 Publish, %sysname%/switch, niet_waar2
 endif

endon


//!Serial#20;E2;TriState;ID=0a82a2;SWITCH=0;CMD=ON;
Many thanks for suggestions.
Greetings

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

Re: !serial rules filter

#2 Post by TD-er » 22 Sep 2023, 23:53

You can only compare against numerical values.
Not strings.

So
if %eventvalue1%=
like statements can only compare against numerical values.

Galan
Normal user
Posts: 19
Joined: 28 Dec 2022, 23:13

Re: !serial rules filter

#3 Post by Galan » 16 Oct 2023, 14:50

tnx for your reaction. I'll solve it then in HA. btw sorry for the late reaction.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest