Rule help

Moderators: Voyager, BertB, rtenklooster, Stuntteam, grovkillen, TD-er

Post Reply
Message
Author
trumee
Normal user
Posts: 17
Joined: 01 Sep 2017, 02:22

Rule help

#1 Post by trumee » 31 Jul 2018, 00:23

Hello,

I am using MQTT import plugin to read a topic and display its value on OLED. The import works fine but displaying the value of the variable doesnt work,

Code: Select all

on motor#ONOFFSTATE do

  if [motor#ONOFFSTATE]>0
     OLEDCMD,on
     OLED,3,1,Motor ON
     OLED,4,1,Motor [motor#ONOFFSTATE]  //DOESNT WORK
  else
     OLED,3,1,Motor OFF
     OLED,4,1,Motor [motor#ONOFFSTATE]  //DOESNT WORK
  endif
     OLED,1,1, %systm_hm_am%
endon
What is the right way of display MQTT topic in a rule?

Thanks

TD-er
Normal user
Posts: 1125
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Rule help

#2 Post by TD-er » 01 Aug 2018, 22:04

You could try setting it in quotes, like this:
OLED,4,1,"Motor [motor#ONOFFSTATE]"

Problem with rules parsing is that the space is also a parameter separator.

N.B. this quotes feature is added very recently. Not sure if it will work like this, but you could try.

trumee
Normal user
Posts: 17
Joined: 01 Sep 2017, 02:22

Re: Rule help

#3 Post by trumee » 05 Aug 2018, 00:39

Unfortunately, that did not work. The error was , Command unknown ". The quotes was not accepted. I am running ESP_Easy_mega-20180804_normal_ESP8266_4096.bin

User avatar
grovkillen
Normal user
Posts: 2073
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Rule help

#4 Post by grovkillen » 05 Aug 2018, 09:16

Show us the exact command you tried.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Sponsor ESP Easy, we need you :idea: :idea: :idea:

trumee
Normal user
Posts: 17
Joined: 01 Sep 2017, 02:22

Re: Rule help

#5 Post by trumee » 12 Aug 2018, 16:28

I am using the following rule,

Code: Select all

On System#Boot do    //When the ESP boots, do
OLEDCMD,clear
endon

on motor#ONOFFSTATE do

  if [motor#ONOFFSTATE]>0
     OLEDCMD,on
     OLED,2,1,"Motor ON"
     OLED,3,1,"Motor [motor#ONOFFSTATE]"
     
  else
     OLED,2,1,"Motor OFF"
     OLED,3,1,"Motor [motor#ONOFFSTATE]"

  endif

endon
On switching on the nodemcu I get a single message "MOTOR OFF", I dont get the second line which should say, "MOTOR 0".

User avatar
grovkillen
Normal user
Posts: 2073
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Rule help

#6 Post by grovkillen » 12 Aug 2018, 17:10

Code: Select all

On System#Boot do    //When the ESP boots, do
OLEDCMD,clear
endon

on motor#ONOFFSTATE do
  if [motor#ONOFFSTATE]>0
     OLEDCMD,on
     OLEDCMD,2,1,"Motor ON"
     OLEDCMD,3,1,"Motor [motor#ONOFFSTATE]"
  else
     OLEDCMD,2,1,"Motor OFF"
     OLEDCMD,3,1,"Motor [motor#ONOFFSTATE]"
  endif
endon
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Sponsor ESP Easy, we need you :idea: :idea: :idea:

trumee
Normal user
Posts: 17
Joined: 01 Sep 2017, 02:22

Re: Rule help

#7 Post by trumee » 14 Aug 2018, 00:35

With your rule i get an error in the log,

Code: Select all

6799: EVENT: MQTT#Connected
7154: IMPT : [motor#ONOFFSTATE] : 1.00
7156: EVENT: motor#ONOFFSTATE=1.00
7172: ACT : OLEDCMD,on
7181: ACT : OLEDCMD,2,1,'Motor ON'
7190: ACT : OLEDCMD,3,1,'Motor 1.00'
7208: Command: oledcmd
7208: Command unknown: 'oledcmd'
7355: IMPT : [motor#PRESSURE] : 0.00
7356: EVENT: motor#PRESSURE=0.00
7654: IMPT : [motor#OLEDSTATE] : 1.00
7655: EVENT: motor#OLEDSTATE=1.00
Looking at this page, OLEDCMD only accepts 1 arguement.

User avatar
grovkillen
Normal user
Posts: 2073
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Rule help

#8 Post by grovkillen » 14 Aug 2018, 07:13

Ah, sorry.

I will do some testing once I get my own OLED test unit set up.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Sponsor ESP Easy, we need you :idea: :idea: :idea:

trumee
Normal user
Posts: 17
Joined: 01 Sep 2017, 02:22

Re: Rule help

#9 Post by trumee » 18 Aug 2018, 04:20

@grovkillen, any luck?

User avatar
grovkillen
Normal user
Posts: 2073
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Rule help

#10 Post by grovkillen » 18 Aug 2018, 11:59

trumee wrote:
18 Aug 2018, 04:20
@grovkillen, any luck?
Haven't gotten around to test it just yet... sorry! Will try to find time next week.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Sponsor ESP Easy, we need you :idea: :idea: :idea:

trumee
Normal user
Posts: 17
Joined: 01 Sep 2017, 02:22

Re: Rule help

#11 Post by trumee » 25 Aug 2018, 15:28

@grovkillen ok, looking forward to it.

trumee
Normal user
Posts: 17
Joined: 01 Sep 2017, 02:22

Re: Rule help

#12 Post by trumee » 01 Sep 2018, 17:20

Anybody willing to help?

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest