Introducing the Dummy Device on ESP Easy (Github R118!)

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Martinus

Introducing the Dummy Device on ESP Easy (Github R118!)

#1 Post by Martinus » 03 Aug 2016, 15:17

In my testlab i have used the Dummy Device quite often during development and testing. I use it to test communications when the actual device is not available or i need to set specific values. Or when i need a counter that does not link to a GPIO pin but more like counting events in rules. Advantage in using a device is that you can benefit from already existing functionality like periodically sending this data to a controller without using rules or display them on local LCD using the already known template feature that also works on this dummy device.

I think this device can also be used in real life to benefit other users, so i decided to add it to the production repository. And it makes my life easier because now it is always available on any sensor that i run.

It uses a special rule command to set the values:

Code: Select all

TaskValueSet <task nr>, <variable nr>, <value>
Instead of a fixed value, you can a value template like it is used on LCD/OLED displays and you can even use some simple calculations. But the formula field within the dummy device should not be used as this will give unexpected results. Maybe i should remove these fields from the device page. Or try to fix this, but this will not be so 'easy' because of how the current program logic is setup.

Just some rule samples where the first two values are set during boot and all four values are incremented each minute, using the system clock event. The dummy device is set for task nr 1, named "Dummy" and the valuenames are Dummy1, Dummy2, etc:

Code: Select all

on System#Boot do
  TaskValueSet 1,1,123.45 // default value at boot
  TaskValueSet 1,2,234.56 // default value at boot
endon

On Clock#Time do // this event comes in every minute
  TaskValueSet 1,1,[Dummy#Dummy1]+1  // you can use a template and use things like +1 or -1 or /1000 or *100
  TaskValueSet 1,2,[Dummy#Dummy2]+1
  TaskValueSet 1,3,[Dummy#Dummy3]+1
  TaskValueSet 1,4,[Dummy#Dummy4]+1
endon
You can also retrieve values from other active devices, just by using the right template.

And you can also use it to simulate something like a DHT22 when you do not have one. The required sensor data type can be set within the task.

Some people have requested variables within rules. And maybe some day we will have stuff like that. In the mean time, you may be able to use a Dummy Device for the requested purpose as it brings 4 floating number values that can be manipulated using rules. Using a dummy device also means that you can see the actual values from within the ESP web gui and you can have them send automatically like any other sensor.

rtenklooster
Normal user
Posts: 320
Joined: 15 Apr 2015, 14:17

Re: Introducing the Dummy Device on ESP Easy

#2 Post by rtenklooster » 03 Aug 2016, 21:02

Nice feature,
Thanx :-) will come in handy!
Richard - Groningen (NL) - Image

Yves911
Normal user
Posts: 18
Joined: 21 May 2016, 17:38

Re: Introducing the Dummy Device on ESP Easy

#3 Post by Yves911 » 05 Aug 2016, 15:03

Thanks @Martinus

I am using that now in a rule to reset value of the pulse counter that i have to monitor gas consumption:

Code: Select all

on System#Boot do
 TaskValueSet 4,1,0
 Publish /esp02/Gaz/conso,0
endon

On Gaz#Count do
 if [Gaz#Count] > 0
  TaskValueSet 4,1,3600000/[Gaz#Time]
  Publish /esp02/Gaz/conso,[Dummy#Gaz]
  timerSet,1,100
 endif
endon

On Rules#Timer=1 do
 TaskValueSet 4,1,0
 Publish /esp02/Gaz/conso,0
endon
Works fine

gibbon_
New user
Posts: 9
Joined: 08 Aug 2016, 11:38
Location: Germany

Re: Introducing the Dummy Device on ESP Easy

#4 Post by gibbon_ » 08 Aug 2016, 12:02

Using this to keep track of the values of a state machine. Can I set the values using the names in any way? I keep forgetting which numbers to type into TaskValueSet :)

paulv888
New user
Posts: 4
Joined: 12 Jul 2016, 05:44

Re: Introducing the Dummy Device on ESP Easy

#5 Post by paulv888 » 09 Aug 2016, 20:54

A quick note for people like me, who get all excited and spend hours on trying to make this work.

There is actually a device type you need to setup as a task of type "Dummy Device" and it is not available int R108, today you need to get he github version to play with this.

Martinus

Re: Introducing the Dummy Device on ESP Easy

#6 Post by Martinus » 09 Aug 2016, 21:19

paulv888 wrote:A quick note for people like me, who get all excited and spend hours on trying to make this work.

There is actually a device type you need to setup as a task of type "Dummy Device" and it is not available int R108, today you need to get he github version to play with this.
Sorry about that, should have mentioned that it's only available on github as of R118.

poe
New user
Posts: 9
Joined: 29 Jul 2016, 23:14

Re: Introducing the Dummy Device on ESP Easy (Github R118!)

#7 Post by poe » 13 Aug 2016, 13:01

In rules "taskvalueset 4,1,1" works just fine, but "http://#.#.#.#/control?cmd=taskvalueset 4,1,1" gives me a "Unknown or restricted command!".

I thought that every command from rules can be used with "control?cmd="

Am i doing it wrong, is it not possible or is there another way to set a value on a dummy device from a browser?

/Preben

daxkamala
Normal user
Posts: 15
Joined: 17 Aug 2016, 09:12

Re: Introducing the Dummy Device on ESP Easy (Github R118!)

#8 Post by daxkamala » 04 Sep 2016, 14:31

Is there any way to set a value (floating point) into a Dummy variable from 'outside', preferably for me by MQTT?
This would allow controlled timers, RGB values, pwm rates and the like.

Henkje1234567890
New user
Posts: 7
Joined: 18 Sep 2016, 14:12

Re: Introducing the Dummy Device on ESP Easy (Github R118!)

#9 Post by Henkje1234567890 » 03 Oct 2016, 11:49

Martinus wrote:In my testlab i have used the Dummy Device quite often during development and testing. I use it to test communications when the actual device is not available or i need to set specific values. Or when i need a counter that does not link to a GPIO pin but more like counting events in rules. Advantage in using a device is that you can benefit from already existing functionality like periodically sending this data to a controller without using rules or display them on local LCD using the already known template feature that also works on this dummy device.

I think this device can also be used in real life to benefit other users, so i decided to add it to the production repository. And it makes my life easier because now it is always available on any sensor that i run.

It uses a special rule command to set the values:

Code: Select all

TaskValueSet <task nr>, <variable nr>, <value>
Instead of a fixed value, you can a value template like it is used on LCD/OLED displays and you can even use some simple calculations. But the formula field within the dummy device should not be used as this will give unexpected results. Maybe i should remove these fields from the device page. Or try to fix this, but this will not be so 'easy' because of how the current program logic is setup.

Just some rule samples where the first two values are set during boot and all four values are incremented each minute, using the system clock event. The dummy device is set for task nr 1, named "Dummy" and the valuenames are Dummy1, Dummy2, etc:

Code: Select all

on System#Boot do
  TaskValueSet 1,1,123.45 // default value at boot
  TaskValueSet 1,2,234.56 // default value at boot
endon

On Clock#Time do // this event comes in every minute
  TaskValueSet 1,1,[Dummy#Dummy1]+1  // you can use a template and use things like +1 or -1 or /1000 or *100
  TaskValueSet 1,2,[Dummy#Dummy2]+1
  TaskValueSet 1,3,[Dummy#Dummy3]+1
  TaskValueSet 1,4,[Dummy#Dummy4]+1
endon
You can also retrieve values from other active devices, just by using the right template.

And you can also use it to simulate something like a DHT22 when you do not have one. The required sensor data type can be set within the task.

Some people have requested variables within rules. And maybe some day we will have stuff like that. In the mean time, you may be able to use a Dummy Device for the requested purpose as it brings 4 floating number values that can be manipulated using rules. Using a dummy device also means that you can see the actual values from within the ESP web gui and you can have them send automatically like any other sensor.
What i want to do is, get data from two sensors, and bring it into one dummy sensor, and this sensor brings the data outside
for now i have make rules, and see the data from the sensors.
but how can i put this dat into the dummy sensor??
which command do i need

Martinus

Re: Introducing the Dummy Device on ESP Easy (Github R118!)

#10 Post by Martinus » 03 Oct 2016, 16:00

Use TaskValueSet <task nr>,<value number>,<value>

Henkje1234567890
New user
Posts: 7
Joined: 18 Sep 2016, 14:12

Re: Introducing the Dummy Device on ESP Easy (Github R118!)

#11 Post by Henkje1234567890 » 04 Oct 2016, 10:46

Martinus wrote:Use TaskValueSet <task nr>,<value number>,<value>
i have now this:

Code: Select all

On Clock#Time do // this event comes in every minute
  TaskValueSet 1,1,[Luchtdruk#Tempratuur]
  TaskValueSet 1,2,[Temp/hum#Luchtvochtigheid]
  TaskValueSet 1,3,[Luchtdruk#Luchtdruk]

 
endon
and in the log, i see the values.
but how can i push this values to a dummy sensor, i have tried it with TaskValueSet 4,1,value, (4 is my dummy sensor)but its not working

Henkje1234567890
New user
Posts: 7
Joined: 18 Sep 2016, 14:12

Re: Introducing the Dummy Device on ESP Easy (Github R118!)

#12 Post by Henkje1234567890 » 11 Oct 2016, 17:10

anybody have suggestions about this??

Martinus

Re: Introducing the Dummy Device on ESP Easy (Github R118!)

#13 Post by Martinus » 11 Oct 2016, 18:30

Could you post a device screen print here? Maybe that makes things more clear about your setup.

Henkje1234567890
New user
Posts: 7
Joined: 18 Sep 2016, 14:12

Re: Introducing the Dummy Device on ESP Easy (Github R118!)

#14 Post by Henkje1234567890 » 11 Oct 2016, 20:25

espdummy.png
espdummy.png (41.23 KiB) Viewed 33719 times
this is what i have now.
my goal is to combine the two sensors (number 1 and 2) to one sensor (4)
this one send the data to domoticz, like a Temp/Hum/Baro sensor.

Now i have in domoticz a temp/hum/Baro sensor, and a temp/hum sensor, but in the temp/hum/Baro sensor, there is no value for the Humidity (its always 0%)

Martinus

Re: Introducing the Dummy Device on ESP Easy (Github R118!)

#15 Post by Martinus » 12 Oct 2016, 16:37

With that config, it should work these rules:

Code: Select all

On Clock#Time do // this event comes in every minute
  TaskValueSet 4,1,[Luchtdruk#Temperature]
  TaskValueSet 4,2,[Temp/hum#RH]
  TaskValueSet 4,3,[Luchtdruk#Pressure]
endon

Henkje1234567890
New user
Posts: 7
Joined: 18 Sep 2016, 14:12

Re: Introducing the Dummy Device on ESP Easy (Github R118!)

#16 Post by Henkje1234567890 » 13 Oct 2016, 17:10

the log gives this, and i see no values in the sensor

Code: Select all

EVENT: Dummy#Temperature=0.00
711300421 : EVENT: Dummy#%RH=0.00
711300431 : EVENT: Dummy#Pressure=0.00
711300442 : EVENT: Dummy#=0.00
my log gives also this

Code: Select all

Content-Type: application/json;charset=UTF-8 
711350484 : Cache-Control: no-cache 
711350485 : Pragma: no-cache 
711350486 : Access-Control-Allow-Origin: * 
711350487 : 
711350488 : {
711350490 : "status" : "OK",
711350491 : "title" : "Update Device"
711350492 : }
711350493 : HTTP : closing connection
don't know what this mean

Martinus

Re: Introducing the Dummy Device on ESP Easy (Github R118!)

#17 Post by Martinus » 13 Oct 2016, 17:54

I've tried to setup a system similar to yours and this works:
Dummy.png
Dummy.png (30.58 KiB) Viewed 33690 times
My log shows this when the rule triggers:
122756022 : EVENT: Clock#Time=Thu,17:51
122756027 : ACT : TaskValueSet 4,1,19.48
122756033 : ACT : TaskValueSet 4,2,52.00
122756038 : ACT : TaskValueSet 4,3,1012.93

Can you check if this kind of event is logged on your system:
EVENT: Clock#Time=Thu,17:51

Martinus

Re: Introducing the Dummy Device on ESP Easy (Github R118!)

#18 Post by Martinus » 13 Oct 2016, 18:05

Did you turn on NTP?
Without NTP, there will not be any clock events created. Then the rules based on clock events will never be triggered.

Henkje1234567890
New user
Posts: 7
Joined: 18 Sep 2016, 14:12

Re: Introducing the Dummy Device on ESP Easy (Github R118!)

#19 Post by Henkje1234567890 » 14 Oct 2016, 08:48

many thanks, switching on the ntp function was the trick

Thotti
New user
Posts: 7
Joined: 08 Oct 2016, 13:43

Re: Introducing the Dummy Device on ESP Easy (Github R118!)

#20 Post by Thotti » 22 Oct 2016, 09:41

poe wrote:In rules "taskvalueset 4,1,1" works just fine, but "http://#.#.#.#/control?cmd=taskvalueset 4,1,1" gives me a "Unknown or restricted command!".

I thought that every command from rules can be used with "control?cmd="

Am i doing it wrong, is it not possible or is there another way to set a value on a dummy device from a browser?

/Preben
Is it possible to set the values of the dummy device via url command?

Martinus

Re: Introducing the Dummy Device on ESP Easy (Github R118!)

#21 Post by Martinus » 22 Oct 2016, 11:16

Thotti wrote:Is it possible to set the values of the dummy device via url command?
Currently not in a direct way. But if you upgrade to the current Release Candidate image, you can accomplish this:

Setup a dummy device on task one, add this to the rules section:

Code: Select all

on Setpoint do
  TaskValueSet 1,1,%eventvalue%
endon
And send ../control?cmd=event,setpoint=123

"Setpoint" is just an example. You could use other names for this event...

wendl
New user
Posts: 1
Joined: 24 Jan 2017, 16:57

Re: Introducing the Dummy Device on ESP Easy (Github R118!)

#22 Post by wendl » 24 Jan 2017, 17:00

Martinus wrote:
Thotti wrote:Is it possible to set the values of the dummy device via url command?
Currently not in a direct way. But if you upgrade to the current Release Candidate image, you can accomplish this:

Setup a dummy device on task one, add this to the rules section:

Code: Select all

on Setpoint do
  TaskValueSet 1,1,%eventvalue%
endon
And send ../control?cmd=event,setpoint=123

"Setpoint" is just an example. You could use other names for this event...
Hi,
TaskValueSet 5,1,%eventvalue%
with %eventvalue%=-3 sets dummy device value to -1

All values under 0 is set +2

MonkeyTown
Normal user
Posts: 25
Joined: 08 May 2016, 02:29

Re: Introducing the Dummy Device on ESP Easy (Github R118!)

#23 Post by MonkeyTown » 07 Mar 2017, 05:24

This may be a really stupid question, but I seem to be stumped and want to thank you in advance for your patience.

I am using a Switch input - button connected to gpio 14, active low, pulled up. Every push toggles the value from 0 to 1 and vice versa, exactly as it's supposed to.
I wanted to make sure, that every push of the button registers as 1, making sure it activates a dummy switch in Domoticz to ON on every press.
The dummy switch in Domoticz has a 5 sec off delay, so it is basically always off and after a button push is supposed to turn it On, that triggers an event and 5 sec later Dummy switch turns off.

The problem is, that ESP only sends button value 1 on every second push, as it works as a toggle.


I used

Code: Select all

on BUTTON1#Switch do
 if [BUTTON1#Switch] = 1
 TaskValueSet 1,1,0
 endif
 endon
This works, log shows it, on Devices page I can see the Value 0 and yet, if I press the button after this, log shows Event BUTTON1#Switch = 0 and yet another push sends 1.
Am I going about this completely wrong? Any way to use a momentary switch (button) to always trigger ON and not a toggle?

Thanks

paxi
Normal user
Posts: 121
Joined: 02 Feb 2017, 00:48
Location: Germany

Re: Introducing the Dummy Device on ESP Easy (Github R118!)

#24 Post by paxi » 08 Mar 2017, 12:29

Simple: set the switch type to "normal switch", then the value is 1 as long as you hold the button and returns to 0 when you release it.

tim_k
New user
Posts: 1
Joined: 13 Oct 2017, 17:52

Re: Introducing the Dummy Device on ESP Easy (Github R118!)

#25 Post by tim_k » 15 Oct 2017, 19:07

poe wrote: 13 Aug 2016, 13:01 In rules "taskvalueset 4,1,1" works just fine, but "http://#.#.#.#/control?cmd=taskvalueset 4,1,1" gives me a "Unknown or restricted command!".

I thought that every command from rules can be used with "control?cmd="

Am i doing it wrong, is it not possible or is there another way to set a value on a dummy device from a browser?

/Preben
I found it to be possible to send values to a unit by making a rule and get the value with %eventvalue% like documented in https://www.letscontrolit.com/wiki/inde ... _Variables

Example:

Code: Select all

on TempOutside do
  TaskValueSet 2,1,%eventvalue%
endon
This way it is possible to change the value of a dummy device on one unit by another unit (for example the value "Temperature" from the device "DHT"):

Code: Select all

http://<your esp ip>/control?cmd=event,TempOutside=[DHT#Temperature]
It took me a while to figure this out as well. Hope it helps anyone in the future.

Tim

HAbuild
Normal user
Posts: 15
Joined: 10 Feb 2018, 08:16

Re: Introducing the Dummy Device on ESP Easy (Github R118!)

#26 Post by HAbuild » 13 Feb 2018, 07:33

GIT version: v2.0-20180209

I can't seem to pick up DHT readings in dummy device. DHT seems hard to call at all really.
It doesn't seem to be my lack of naming or coding. I have been fiddling around for awhile with it.
I can get it to pick up VCC. is it possibly a symptom of the recent DHT changes? I think I read that there were changed in the last couple of months.
rules.PNG
rules.PNG (16.21 KiB) Viewed 32134 times
log.PNG
log.PNG (30.27 KiB) Viewed 32134 times
Dummy Device.PNG
Dummy Device.PNG (18 KiB) Viewed 32134 times
Devices.PNG
Devices.PNG (21.57 KiB) Viewed 32134 times
Alt rules.PNG
Alt rules.PNG (18.17 KiB) Viewed 32134 times
Alt Rules log.PNG
Alt Rules log.PNG (23.86 KiB) Viewed 32134 times
Picks up VCC.PNG
Picks up VCC.PNG (16.5 KiB) Viewed 32134 times

HAbuild
Normal user
Posts: 15
Joined: 10 Feb 2018, 08:16

Re: Introducing the Dummy Device on ESP Easy (Github R118!)

#27 Post by HAbuild » 13 Feb 2018, 07:36

moar vcc.PNG
moar vcc.PNG (15.7 KiB) Viewed 32133 times

cyberclwn
Normal user
Posts: 21
Joined: 25 Aug 2017, 21:19

Re: Introducing the Dummy Device on ESP Easy (Github R118!)

#28 Post by cyberclwn » 20 Feb 2018, 23:14

HAbuild wrote: 13 Feb 2018, 07:33 GIT version: v2.0-20180209

I can't seem to pick up DHT readings in dummy device. DHT seems hard to call at all really.
It doesn't seem to be my lack of naming or coding. I have been fiddling around for awhile with it.
I can get it to pick up VCC. is it possibly a symptom of the recent DHT changes? I think I read that there were changed in the last couple of months.
Hey,

Not sure if you got this sorted yet, but i think you are doing some bits wrong.
I think it should be like this:

Code: Select all

TaskValueSet 7,1,[Garage#Temperature]
TaskValueSet 7,2,[Garage#Humidity]
TaskValueSet 7,3,([Garage#Temperature]-(100-[Garage#Humidity])/5)
This is how i combine a DHT + BMP into 1 device

HAbuild
Normal user
Posts: 15
Joined: 10 Feb 2018, 08:16

Re: Introducing the Dummy Device on ESP Easy (Github R118!)

#29 Post by HAbuild » 22 Feb 2018, 00:32

Thanks I got it with some mucking around. I think I had the wrong trigger.

MonkeyTown
Normal user
Posts: 25
Joined: 08 May 2016, 02:29

Re: Introducing the Dummy Device on ESP Easy (Github R118!)

#30 Post by MonkeyTown » 08 Feb 2019, 06:01

Thanks to all the info in this thread I was able to use the Nextion display, showing values from sensors around the house!

Using Dummy sensor on the Nextion nodemcu and having 3 other units with different sensors send data and update it. All using dummy sensor, rules and sendtohttp. Then using the Nextion plugin to display values on the screen. So far, works like a charm!!!

Thank you!!

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 36 guests