rules - I need help

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
woocashewski
Normal user
Posts: 13
Joined: 22 Sep 2018, 19:09
Location: Poland

rules - I need help

#1 Post by woocashewski » 08 Oct 2018, 17:56

hi,

I need help with rules - I want to send neopixel commands triggered by state of a sensor (integer value).

the problem is (at least for me..), that I need it to work like that:

if [value] <n
than this (this part is easy - command tgiggered by condition)
if [value] is greater than n+1 and smaller than n2
than this
if [value] is greater than n2+1 and smaller than n3
than this

the problem is, that this "n" values are from 0 - 150, so it's /nearly, due to rules size limitation and common sense ;) / impossible to get this working by equality function

eg.

Code: Select all

    if [p1#p] < 30
        neopixel,1,0,255,0
    endif
    if [p1#p] = 30
        neopixel,1,10,100,0
and so on, from 30 to 150 ;)

maybe I have some brain fog or something, but I can't find how to get this work.

any help?

thanks in an advance.

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: rules - I need help

#2 Post by grovkillen » 08 Oct 2018, 19:18

Code: Select all

On p1#p Do
 If [p1#p]<30
  neopixel,1,0,255,1
 Else
 neopixel,1,([p1#p]*255/150),100,1
 EndIf
Endon
Just something I made out of my head. Can't you do something like that?
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

woocashewski
Normal user
Posts: 13
Joined: 22 Sep 2018, 19:09
Location: Poland

Re: rules - I need help

#3 Post by woocashewski » 08 Oct 2018, 21:21

thank you for a quick response

unfortunately it's not working - values calculated from formula are omitted in command for neopixel - if formula is for red - there's no red at all.

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: rules - I need help

#4 Post by grovkillen » 08 Oct 2018, 22:05

Must be that the neopixel plugin doesn't accept float values. Maybe if you first put them to a dummy value with 0 decimals?
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

woocashewski
Normal user
Posts: 13
Joined: 22 Sep 2018, 19:09
Location: Poland

Re: rules - I need help

#5 Post by woocashewski » 08 Oct 2018, 22:12

I was thinking about dummy device, but i don't know how to enter data into dummy device, [ and # are not accepted, so... another long night of searching before me ;)

PS. help links related to plugins are veeeery short, and sometimes misleading. Maybe it's time to join community and use my experience.

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: rules - I need help

#6 Post by grovkillen » 08 Oct 2018, 22:43

woocashewski wrote: 08 Oct 2018, 22:12 I was thinking about dummy device, but i don't know how to enter data into dummy device, [ and # are not accepted, so... another long night of searching before me ;)

PS. help links related to plugins are veeeery short, and sometimes misleading. Maybe it's time to join community and use my experience.
TaskValueSet,<tasknumber>,<value umber>,<value or formula>

The formula is fairly straightforward, but values are in the syntax [p1#p].

The wiki is being redone (we're moving it to GitHub/ReadTheDocs). It'll get better.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

woocashewski
Normal user
Posts: 13
Joined: 22 Sep 2018, 19:09
Location: Poland

Re: rules - I need help

#7 Post by woocashewski » 08 Oct 2018, 23:59

all set :)

thank You for assistance.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests