Moderators: grovkillen, Stuntteam, TD-er
-
playzino
- New user
- Posts: 6
- Joined: 18 Sep 2017, 10:34
#1
Post
by playzino » 18 Sep 2017, 11:39
I have IRreciver connect to NodeMCU with ESPEASY 2.0, i try do triger some event usign MCE Remote (RC6). I Try this code:
Code: Select all
On IR#IR=2148467803 do
pulse,4,1,100
endon
But pulse is trigered by similare ir codes like 2148467804, 2148467805. IRceciver recive correct IR.
Any idea what's wrong?
-
grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
#2
Post
by grovkillen » 18 Sep 2017, 13:46
I think it has something to do with the float value precision.
https://en.wikipedia.org/wiki/Single-pr ... int_format
If possible you should try to log the output from serial and see if the values are really the same as you think, they might be truncated?
-
playzino
- New user
- Posts: 6
- Joined: 18 Sep 2017, 10:34
#3
Post
by playzino » 18 Sep 2017, 14:14
This is 32bit, RC6 Code. In log and on serial monitor i see correct (different) code
Code: Select all
IR#IR=2148467803
IR#IR=2148467804
IR#IR=2148467805
I try to use,
Code: Select all
On IR#IR do
if IR#IR=2148467803 do
...
endif
endon
,but this dosn't work
-
grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
#4
Post
by grovkillen » 18 Sep 2017, 14:36
It's not the correct syntax. The "test" need to have the Device#Value in square brackets (see rules syntax
here).
Code: Select all
On IR#IR do
if [IR#IR]=2148467803 do
//...
endif
endon
-
playzino
- New user
- Posts: 6
- Joined: 18 Sep 2017, 10:34
#5
Post
by playzino » 18 Sep 2017, 14:39
ok thx, can I try some think like this?
Code: Select all
On IR#IR do
if [IR#IR]-214846700=803 do
//...
endif
endon
-
grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
#6
Post
by grovkillen » 18 Sep 2017, 14:43
You might, I haven't tested that one exactly (with the arithmetic on the left side). But it could work. Please report back

-
playzino
- New user
- Posts: 6
- Joined: 18 Sep 2017, 10:34
#7
Post
by playzino » 18 Sep 2017, 19:07
Arithmetic on the left side don't work.
LOG:
Code: Select all
66189409 : IR : Code 800f045c - Type: 2 - Bits: 36
66189423 : EVENT: IR#IR=2148467804
66189470 : ACT : pulse,5,1,100
66189571 : SW : GPIO 5 Pulsed for 100 mS
Rules
Code: Select all
On IR#IR do
if [IR#IR]=2148467803 do
pulse,5,1,100
endif
endon
Any idea???
-
toffel969
- Normal user
- Posts: 469
- Joined: 03 Jan 2017, 10:58
- Location: Germany
#8
Post
by toffel969 » 18 Sep 2017, 21:27
playzino wrote: ↑18 Sep 2017, 19:07
Arithmetic on the left side don't work.
LOG:
Code: Select all
66189409 : IR : Code 800f045c - Type: 2 - Bits: 36
66189423 : EVENT: IR#IR=2148467804
66189470 : ACT : pulse,5,1,100
66189571 : SW : GPIO 5 Pulsed for 100 mS
Rules
Code: Select all
On IR#IR do
if [IR#IR]=2148467803 do
pulse,5,1,100
endif
endon
Any idea???
Code: Select all
On IR#IR do
if [IR#IR]=2148467803 do
pulse,5,1,100
endif
endon
should be
Code: Select all
On IR#IR do
if [IR#IR]=2148467803
pulse,5,1,100
endif
endon
there is not supposed to be a "do" in the if statement
not sure if this solves your problem though
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8
-
playzino
- New user
- Posts: 6
- Joined: 18 Sep 2017, 10:34
#9
Post
by playzino » 18 Sep 2017, 21:36
Oh yeah, now is missing do, but the problem is that this rules works TO GOOD. Rules is executed by similar codes not only THIS code.
BTW. It is possible to use var in Rules?
-
toffel969
- Normal user
- Posts: 469
- Joined: 03 Jan 2017, 10:58
- Location: Germany
#10
Post
by toffel969 » 19 Sep 2017, 08:29
playzino wrote: ↑18 Sep 2017, 21:36
Oh yeah, now is missing do, but the problem is that this rules works TO GOOD. Rules is executed by similar codes not only THIS code.
BTW. It is possible to use var in Rules?
Ya but when dealing with unexpected behaviour, it is best t respect the syntax. "Do" for events, "[]" for the value compared in if.
Variables should be possible as dummy devices. You can save 4 var per device
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8
-
Domosapiens
- Normal user
- Posts: 307
- Joined: 06 Nov 2016, 13:45
#11
Post
by Domosapiens » 19 Sep 2017, 18:12
On IR#IR do
I'm not sure that using the same name for "Task Name" and "Value Name" is allowed.
I vaguely remember that I had problems with that.
Hope this helps
Domosapiens
30+ ESP units for production and test. Ranging from control of heating equipment, flow sensing, floor temp sensing, energy calculation, floor thermostat, water usage, to an interactive "fun box" for my grandson. Mainly Wemos D1.
-
playzino
- New user
- Posts: 6
- Joined: 18 Sep 2017, 10:34
#12
Post
by playzino » 29 Sep 2017, 13:35
Tested on 26bit codes from other remote and works fine. Definitely have problem with 36bits codes.
-
Drum
- Normal user
- Posts: 300
- Joined: 07 Feb 2016, 11:56
#13
Post
by Drum » 08 Oct 2017, 09:16
Might this explain it???
From the Wiki:
"Remember that you can only store floating point numbers as output from your device. Also note that the floating point precision is limited. For most application this will not lead to issues but storing a large 32 bit number like RFID tags will get rounded. As a workaround, you can store this into two floating point variables as 16 bit parts. Selecting SENSOR_TYPE_LONG will handle this within the framework. But it supports only one long value!"
-
papperone
- Normal user
- Posts: 497
- Joined: 04 Oct 2016, 23:16
#14
Post
by papperone » 08 Oct 2017, 10:13
Drum wrote: ↑08 Oct 2017, 09:16
Might this explain it???
From the Wiki:
"Remember that you can only store floating point numbers as output from your device. Also note that the floating point precision is limited. For most application this will not lead to issues but storing a large 32 bit number like RFID tags will get rounded. As a workaround, you can store this into two floating point variables as 16 bit parts. Selecting SENSOR_TYPE_LONG will handle this within the framework. But it supports only one long value!"
I can confirm this as I faced similar problem when developping my HLW8012 plugin; calibration value were needed to be DOUBLE and not to be rounded so I ended up with saving them as "Custom Settings".
This is definitely doable and it works a charm so if needed as well for RFID readings of large tags then someone needs to implement it in the relevant pluing code.
Who is online
Users browsing this forum: Anthropic Claude Bot [bot] and 24 guests