Own idx, rules and domoticz

Moderators: grovkillen, Stuntteam, TD-er

Message
Author
bogas
Normal user
Posts: 20
Joined: 20 Jan 2018, 11:22

Own idx, rules and domoticz

#1 Post by bogas » 20 Jan 2018, 11:27

Hi.
I'm trying add PMS5003 to domoticz.
It has one idx so i should add idx's to rules, but it doesn't work.
Domoticz ip: 192.168.0.4, port 8080
idx for pm1.0 : 20
idx for pm2.5 : 21
idx for pm10 : 22
Rules:
on PMS5003#pm1.0 do
SendToHTTP 192.168.0.4,8080,/json.htm?type=command&param=udevice&idx=20&nvalue=0&svalue=[PMS5003#pm1.0]
endon

on PMS5003#pm2.5 do
SendToHTTP 192.168.0.4,8080,/json.htm?type=command&param=udevice&idx=21&nvalue=0&svalue=[PMS5003#pm2.5]
endon

on PMS5003#pm10 do
SendToHTTP 192.168.0.4,8080,/json.htm?type=command&param=udevice&idx=22&nvalue=0&svalue=[PMS5003#pm10]
endon

Please help!
Regards

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

Re: Own idx, rules and domoticz

#2 Post by grovkillen » 20 Jan 2018, 11:30

What does the log say?
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:

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

Re: Own idx, rules and domoticz

#3 Post by TD-er » 20 Jan 2018, 14:18

For the SDS011, I use these rules:

Code: Select all

On System#Boot do //This will happen at boot ESP8266
   timerSet,1,30  //Set and start timer 1 at 30 seconds
endon
 
On Rules#Timer=1 do   //When the timer 1 is up:
  SendToHTTP 192.168.1.28,8080,/json.htm?type=command&param=udevice&idx=105&nvalue=0&svalue=[SDS011#PM25] //Send the PM2,5 data to Domoticz
  SendToHTTP 192.168.1.28,8080,/json.htm?type=command&param=udevice&idx=108&nvalue=0&svalue=[SDS011#PM10] //Send the PM10 data to Domoticz
  timerSet,1,120                //Set the next cycle at 120 seconds 
endon
 
This sensor also has the problem it can only send the 1st value to Domoticz
These rules work fine for the entire year already ;)

bogas
Normal user
Posts: 20
Joined: 20 Jan 2018, 11:22

Re: Own idx, rules and domoticz

#4 Post by bogas » 20 Jan 2018, 15:53

grovkillen wrote: 20 Jan 2018, 11:30 What does the log say?
Log
404611 : ACT : SendToHTTP 192.168.0.4,8080,/json.htm?type=command¶m=udevice&idx=20&nvalue=0&svalue=36
405634 : Timeout while reading input data!
405731 : EVENT: PMS5003#pm2.5=64.00
405745 : ACT : SendToHTTP 192.168.0.4,8080,/json.htm?type=command¶m=udevice&idx=21&nvalue=0&svalue=64
406768 : Timeout while reading input data!
406858 : EVENT: PMS5003#pm10=86.00
406880 : ACT : SendToHTTP 192.168.0.4,8080,/json.htm?type=command¶m=udevice&idx=22&nvalue=0&svalue=86
407903 : Timeout while reading input data!
427242 : WD : Uptime 7 ConnectFailures 0 FreeMem 19680
427476 : EVENT: Clock#Time=Sat,14:52

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

Re: Own idx, rules and domoticz

#5 Post by grovkillen » 20 Jan 2018, 16:13

https://www.letscontrolit.com/wiki/inde ... th_own_IDX


Many users have reported problems with commands being truncated, particularly when trying to send commands to domoticz. It seems to be a parsing error. There is the following workaround

SendToHTTP 192.168.0.243,8080,/json.htm?type=param=switchlight&command&idx=174&switchcmd=On
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:

User avatar
vader
Normal user
Posts: 241
Joined: 21 Mar 2017, 17:35

Re: Own idx, rules and domoticz

#6 Post by vader » 20 Jan 2018, 16:19

What is this after command?
commandm=udev

Hope it is like this and is just a cut'n'paste problem:
command&param

bogas
Normal user
Posts: 20
Joined: 20 Jan 2018, 11:22

Re: Own idx, rules and domoticz

#7 Post by bogas » 20 Jan 2018, 16:23

grovkillen wrote: 20 Jan 2018, 16:13 https://www.letscontrolit.com/wiki/inde ... th_own_IDX


Many users have reported problems with commands being truncated, particularly when trying to send commands to domoticz. It seems to be a parsing error. There is the following workaround

SendToHTTP 192.168.0.243,8080,/json.htm?type=param=switchlight&command&idx=174&switchcmd=On
I saw this.
There is switch, i have sensor. :/

bogas
Normal user
Posts: 20
Joined: 20 Jan 2018, 11:22

Re: Own idx, rules and domoticz

#8 Post by bogas » 20 Jan 2018, 16:23

vader wrote: 20 Jan 2018, 16:19 What is this after command?
commandm=udev

Hope it is like this and is just a cut'n'paste problem:
command&param
Yes, it should be &.

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

Re: Own idx, rules and domoticz

#9 Post by grovkillen » 20 Jan 2018, 16:46

bogas wrote: 20 Jan 2018, 16:23
grovkillen wrote: 20 Jan 2018, 16:13 https://www.letscontrolit.com/wiki/inde ... th_own_IDX


Many users have reported problems with commands being truncated, particularly when trying to send commands to domoticz. It seems to be a parsing error. There is the following workaround

SendToHTTP 192.168.0.243,8080,/json.htm?type=param=switchlight&command&idx=174&switchcmd=On
I saw this.
There is switch, i have sensor. :/
That was only an example. In your code, try change this :

SendToHTTP 192.168.0.4,8080,/json.htm?type=command&param=udevice&idx=20&nvalue=0&svalue=[PMS5003#pm1.0]

To this :

SendToHTTP 192.168.0.4,8080,/json.htm?type=param=udevice&command&idx=20&nvalue=0&svalue=[PMS5003#pm1.0]
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:

bogas
Normal user
Posts: 20
Joined: 20 Jan 2018, 11:22

Re: Own idx, rules and domoticz

#10 Post by bogas » 20 Jan 2018, 17:13


That was only an example. In your code, try change this :

SendToHTTP 192.168.0.4,8080,/json.htm?type=command&param=udevice&idx=20&nvalue=0&svalue=[PMS5003#pm1.0]

To this :

SendToHTTP 192.168.0.4,8080,/json.htm?type=param=udevice&command&idx=20&nvalue=0&svalue=[PMS5003#pm1.0]
on PMS5003#pm1.0 do
SendToHTTP 192.168.0.4,8080,/json.htm?type=param=udevice&command&idx=20&nvalue=0&svalue=[PMS5003#pm1.0]
endon

on PMS5003#pm2.5 do
SendToHTTP 192.168.0.4,8080,/json.htm?type=param=udevice&command&idx=21&nvalue=0&svalue=[PMS5003#pm2.5]
endon

on PMS5003#pm10 do
SendToHTTP 192.168.0.4,8080,/json.htm?type=param=udevice&command&idx=22&nvalue=0&svalue=[PMS5003#pm10]
endon

And nothing...

User avatar
vader
Normal user
Posts: 241
Joined: 21 Mar 2017, 17:35

Re: Own idx, rules and domoticz

#11 Post by vader » 20 Jan 2018, 17:14

@grovkillen: It must be: ... type=command&param= ...
Your version with two "=" will never work....

From Domoticz's Wiki (https://www.domoticz.com/wiki/Domoticz_API/JSON_URL's):
/json.htm?type=command&param=udevice&idx=IDX&nvalue=0&svalue=TEMP

Tested here and works. :D
Last edited by vader on 20 Jan 2018, 18:43, edited 1 time in total.

bogas
Normal user
Posts: 20
Joined: 20 Jan 2018, 11:22

Re: Own idx, rules and domoticz

#12 Post by bogas » 20 Jan 2018, 17:29

On PMSx003#pm1.0 do
SendToHTTP 192.168.0.4,8080,/json.htm?type=command&param=udevice&idx=20&nvalue=0&svalue=[PMSx003#pm1.0]
endon

On PMSx003#pm2.5 do
SendToHTTP 192.168.0.4,8080,/json.htm?type=command&param=udevice&idx=21&nvalue=0&svalue=[PMSx003#pm2.5]
endon

On PMSx003#pm10 do
SendToHTTP 192.168.0.4,8080,/json.htm?type=command&param=udevice&idx=22&nvalue=0&svalue=[PMSx003#pm10]
endon

Nothing :(

User avatar
vader
Normal user
Posts: 241
Joined: 21 Mar 2017, 17:35

Re: Own idx, rules and domoticz

#13 Post by vader » 20 Jan 2018, 18:25

What makes Domoticz if you send it direct with the browser?
_http://192.168.0.4:8080/json.htm?type=command&param=udevice&idx=22&nvalue=0&svalue=12.3

Does the value change to 12.3?

bogas
Normal user
Posts: 20
Joined: 20 Jan 2018, 11:22

Re: Own idx, rules and domoticz

#14 Post by bogas » 20 Jan 2018, 18:35

vader wrote: 20 Jan 2018, 18:25 What makes Domoticz if you send it direct with the browser?
_http://192.168.0.4:8080/json.htm?type=command&param=udevice&idx=22&nvalue=0&svalue=12.3

Does the value change to 12.3?

Code: Select all

{
   "status" : "OK",
   "title" : "Update Device"
}
Yes:

Code: Select all

22	PMS5003	00082022	1	PM10	General	Custom Sensor	12.3 ppm

User avatar
vader
Normal user
Posts: 241
Joined: 21 Mar 2017, 17:35

Re: Own idx, rules and domoticz

#15 Post by vader » 20 Jan 2018, 18:41

Ok, so we know that the syntax of the command is right. Let's have a look at your device config. Can you post a screenshot (ESP easy)?

bogas
Normal user
Posts: 20
Joined: 20 Jan 2018, 11:22

Re: Own idx, rules and domoticz

#16 Post by bogas » 20 Jan 2018, 19:45

vader wrote: 20 Jan 2018, 18:41 Ok, so we know that the syntax of the command is right. Let's have a look at your device config. Can you post a screenshot (ESP easy)?
Of course.
https://ibb.co/gutRZG

https://ibb.co/cH4B1w

I have 18 sensors from which send data, including gp2y10 and they work.
Something is wrong with pms5003.

User avatar
vader
Normal user
Posts: 241
Joined: 21 Mar 2017, 17:35

Re: Own idx, rules and domoticz

#17 Post by vader » 20 Jan 2018, 20:21

I don't think that the sensor is broken. You see values in ESPeasy, so the communication is also ok. Have you setup a controller in ESPeasy (Domoticz HTTP)? Because I don't see a checkmark in "Send to controller".

bogas
Normal user
Posts: 20
Joined: 20 Jan 2018, 11:22

Re: Own idx, rules and domoticz

#18 Post by bogas » 20 Jan 2018, 20:27

PMS seems to be working, that's not what I meant.
The problem is probably in esp and domoticz communication.
Yes, I have set up sending data to domoticz.
If I select idx in esp, it sends data from the first indication, i.e. from pm1.0.

https://ibb.co/fp0ZMw

User avatar
vader
Normal user
Posts: 241
Joined: 21 Mar 2017, 17:35

Re: Own idx, rules and domoticz

#19 Post by vader » 20 Jan 2018, 21:21

The problem could be the IDX from Domoticz. In ESPeasy you have only IDX 20, but in Domoticz 20, 21 and 22....

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

Re: Own idx, rules and domoticz

#20 Post by grovkillen » 20 Jan 2018, 21:22

vader wrote: 20 Jan 2018, 17:14 @grovkillen: It must be: ... type=command&param= ...
Your version with two "=" will never work....

From Domoticz's Wiki (https://www.domoticz.com/wiki/Domoticz_API/JSON_URL's):
/json.htm?type=command&param=udevice&idx=IDX&nvalue=0&svalue=TEMP

Tested here and works. :D
Ah, sorry. Messed that one up. Must revise the wiki.
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:

bogas
Normal user
Posts: 20
Joined: 20 Jan 2018, 11:22

Re: Own idx, rules and domoticz

#21 Post by bogas » 20 Jan 2018, 22:14

vader wrote: 20 Jan 2018, 21:21 The problem could be the IDX from Domoticz. In ESPeasy you have only IDX 20, but in Domoticz 20, 21 and 22....

for pms it is impossible to set more idx than one.
That's why I'm trying to make a rule for the wiki.
I tried to enable the second and third tasks with separate idx, but I can not.

Image

bogas
Normal user
Posts: 20
Joined: 20 Jan 2018, 11:22

Re: Own idx, rules and domoticz

#22 Post by bogas » 21 Jan 2018, 10:10

vader wrote: 20 Jan 2018, 21:21 The problem could be the IDX from Domoticz. In ESPeasy you have only IDX 20, but in Domoticz 20, 21 and 22....
Vader, how should i set domoticz to read pm1.0, pm2.5, pm10? Currently shows only pm1.0 on idx20.

User avatar
vader
Normal user
Posts: 241
Joined: 21 Mar 2017, 17:35

Re: Own idx, rules and domoticz

#23 Post by vader » 21 Jan 2018, 12:32

I don't know if that trick works, but what is if you enter 3x the same device in ESPeasy (ok, it needs 3 tasks...), but with different IDX (20,21,22)? And with a correct configured controller, you don't need a rule, because ESPeasy sends the values in the given delay time to Domoticz.

bogas
Normal user
Posts: 20
Joined: 20 Jan 2018, 11:22

Re: Own idx, rules and domoticz

#24 Post by bogas » 21 Jan 2018, 12:44

Guys, done!
I used this guide:
https://diyprojects.io/esp-easydht22bmp ... mR0TajibDc
I created virtual sensors to which I assigned idx.

Image
Image

Rules:

Code: Select all

on PMSx003#PM25 do   
   TaskValueSet 3,1,[PMSx003#PM1] 
   TaskValueSet 4,1,[PMSx003#PM25] 
   TaskValueSet 5,1,[PMSx003#PM10] 
endon

User avatar
vader
Normal user
Posts: 241
Joined: 21 Mar 2017, 17:35

Re: Own idx, rules and domoticz

#25 Post by vader » 21 Jan 2018, 13:09

This is no clean solution. Give every device a unique name! E.g. PMSx003_1, PMSx003_2, and so on. The rule is also not correct.

on PMSx003#PM25 do
TaskValueSet 3,1,[PMSx003#PM1]
TaskValueSet 4,1,[PMSx003#PM25]
TaskValueSet 5,1,[PMSx003#PM10]
endon

You write a value to "TaskValueSet 4,1,[PMSx003#PM25]" what already changed and is checked with "on PMSx003#PM25 do". Delete this line.

It makes no sense to me now, because you have the same value (PM25) at all 3 sensors. :?:

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

Re: Own idx, rules and domoticz

#26 Post by grovkillen » 21 Jan 2018, 13:49

Better to use timer?
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:

kimot
Normal user
Posts: 190
Joined: 12 Oct 2017, 20:46

Re: Own idx, rules and domoticz

#27 Post by kimot » 21 Jan 2018, 15:03

And what about to tray do not use "dot" in variable names?
Instead of PMS5003#pm1.0 use PMS5003#pm1_0

I do not see anything else, what can make problems.
But I am not with my ESPeasys to tray now.

bogas
Normal user
Posts: 20
Joined: 20 Jan 2018, 11:22

Re: Own idx, rules and domoticz

#28 Post by bogas » 21 Jan 2018, 19:05

vader wrote: 21 Jan 2018, 13:09 This is no clean solution. Give every device a unique name! E.g. PMSx003_1, PMSx003_2, and so on. The rule is also not correct.

on PMSx003#PM25 do
TaskValueSet 3,1,[PMSx003#PM1]
TaskValueSet 4,1,[PMSx003#PM25]
TaskValueSet 5,1,[PMSx003#PM10]
endon

You write a value to "TaskValueSet 4,1,[PMSx003#PM25]" what already changed and is checked with "on PMSx003#PM25 do". Delete this line.

It makes no sense to me now, because you have the same value (PM25) at all 3 sensors. :?:
I know that pm25 should not work and should give the same value, but it is not. This solution works.
You can not add a second device as pmsx003 - I wrote about it, displaying all values ​​as 0.
For example, it is possible for HTU21d, for pms not.

bogas
Normal user
Posts: 20
Joined: 20 Jan 2018, 11:22

Re: Own idx, rules and domoticz

#29 Post by bogas » 21 Jan 2018, 19:06

grovkillen wrote: 21 Jan 2018, 13:49 Better to use timer?
?

bogas
Normal user
Posts: 20
Joined: 20 Jan 2018, 11:22

Re: Own idx, rules and domoticz

#30 Post by bogas » 21 Jan 2018, 19:08

kimot wrote: 21 Jan 2018, 15:03 And what about to tray do not use "dot" in variable names?
Instead of PMS5003#pm1.0 use PMS5003#pm1_0

I do not see anything else, what can make problems.
But I am not with my ESPeasys to tray now.

I tried. See that at the moment - I have pm1, pm25, pm10, and I had dots before.

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

Re: Own idx, rules and domoticz

#31 Post by grovkillen » 21 Jan 2018, 21:08

bogas wrote: 21 Jan 2018, 19:06
grovkillen wrote: 21 Jan 2018, 13:49 Better to use timer?
?
If you use a timer in the rules you don't have to rely on a value being changed. I try to use timer when it comes to sensor values. Values from inputs (switches for example) I use "value change" triggers instead. But what you prefer is up to you. 8-)
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:

bogas
Normal user
Posts: 20
Joined: 20 Jan 2018, 11:22

Re: Own idx, rules and domoticz

#32 Post by bogas » 21 Jan 2018, 22:05

Can You explain it in my example?

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

Re: Own idx, rules and domoticz

#33 Post by grovkillen » 21 Jan 2018, 22:36

Code: Select all

On System#Boot do
TimerSet,1,10 //10 second loop time
EndOn

on Rules#Timer=1 do 
TaskValueSet 3,1,[PMSx003#PM1] 
TaskValueSet 4,1,[PMSx003#PM25] 
TaskValueSet 5,1,[PMSx003#PM10] 
TimerSet,1,10
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]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

PieterS
Normal user
Posts: 76
Joined: 27 Mar 2018, 17:18
Location: NL

Re: Own idx, rules and domoticz

#34 Post by PieterS » 28 Mar 2018, 22:22

TD-er wrote: 20 Jan 2018, 14:18 For the SDS011, I use these rules:

Code: Select all

On System#Boot do //This will happen at boot ESP8266
   timerSet,1,30  //Set and start timer 1 at 30 seconds
endon
 
On Rules#Timer=1 do   //When the timer 1 is up:
  SendToHTTP 192.168.1.28,8080,/json.htm?type=command&param=udevice&idx=105&nvalue=0&svalue=[SDS011#PM25] //Send the PM2,5 data to Domoticz
  SendToHTTP 192.168.1.28,8080,/json.htm?type=command&param=udevice&idx=108&nvalue=0&svalue=[SDS011#PM10] //Send the PM10 data to Domoticz
  timerSet,1,120                //Set the next cycle at 120 seconds 
endon
 
This sensor also has the problem it can only send the 1st value to Domoticz
These rules work fine for the entire year already ;)
I had the dustsensor build as described by site of https://Luftdaten.info. There is no api to Domoticz.
Thats why I used this one: https://blog.jokielowie.com/en/2018/01/ ... og-sensor/

So I build a Wemos D1 with GIT version: mega-20180126

Image

No apply for upload to controller. That should be done by rule

Image

This is the "modified" rule as above

The rule who uploads to Domoticz:

Code: Select all

On System#Boot do //This will happen at boot ESP8266
   timerSet,1,30  //Set and start timer 1 at 30 seconds
endon
 
On Rules#Timer=1 do   //When the timer 1 is up:
  SendToHTTP 192.168.1.10,8084,/json.htm?type=command&param=udevice&idx=736&nvalue=0&svalue=[SDS011#PM25] //Send the PM2,5 data to Domoticz
  SendToHTTP 192.168.1.10,8084,/json.htm?type=command&param=udevice&idx=738&nvalue=0&svalue=[SDS011#PM10] //Send the PM10 data to Domoticz
  timerSet,1,120                //Set the next cycle at 120 seconds 
endon
This is logfile of Wemos:

Image

No Authentication error because the temperature of Dallas-sensor and SDS011 is read and represented in Domoticz.

Image

In the logfile of Domoticz is no info about IDX-numbers.... :( The temperaturesensor is updated in the dashboard but the dustsensor not... Why??

Thanks for your help!

By the way: I use Domoticz version V3.8153 on a Synology

Pieter

User avatar
toffel969
Normal user
Posts: 469
Joined: 03 Jan 2017, 10:58
Location: Germany

Re: Own idx, rules and domoticz

#35 Post by toffel969 » 29 Mar 2018, 11:26

PieterS wrote: 28 Mar 2018, 22:22
TD-er wrote: 20 Jan 2018, 14:18 For the SDS011, I use these rules:

Code: Select all

On System#Boot do //This will happen at boot ESP8266
   timerSet,1,30  //Set and start timer 1 at 30 seconds
endon
 
On Rules#Timer=1 do   //When the timer 1 is up:
  SendToHTTP 192.168.1.28,8080,/json.htm?type=command&param=udevice&idx=105&nvalue=0&svalue=[SDS011#PM25] //Send the PM2,5 data to Domoticz
  SendToHTTP 192.168.1.28,8080,/json.htm?type=command&param=udevice&idx=108&nvalue=0&svalue=[SDS011#PM10] //Send the PM10 data to Domoticz
  timerSet,1,120                //Set the next cycle at 120 seconds 
endon
 
This sensor also has the problem it can only send the 1st value to Domoticz
These rules work fine for the entire year already ;)
I had the dustsensor build as described by site of https://Luftdaten.info. There is no api to Domoticz.
Thats why I used this one: https://blog.jokielowie.com/en/2018/01/ ... og-sensor/

So I build a Wemos D1 with GIT version: mega-20180126

Image

No apply for upload to controller. That should be done by rule

Image

This is the "modified" rule as above

The rule who uploads to Domoticz:

Code: Select all

On System#Boot do //This will happen at boot ESP8266
   timerSet,1,30  //Set and start timer 1 at 30 seconds
endon
 
On Rules#Timer=1 do   //When the timer 1 is up:
  SendToHTTP 192.168.1.10,8084,/json.htm?type=command&param=udevice&idx=736&nvalue=0&svalue=[SDS011#PM25] //Send the PM2,5 data to Domoticz
  SendToHTTP 192.168.1.10,8084,/json.htm?type=command&param=udevice&idx=738&nvalue=0&svalue=[SDS011#PM10] //Send the PM10 data to Domoticz
  timerSet,1,120                //Set the next cycle at 120 seconds 
endon
This is logfile of Wemos:

Image

No Authentication error because the temperature of Dallas-sensor and SDS011 is read and represented in Domoticz.

Image

In the logfile of Domoticz is no info about IDX-numbers.... :( The temperaturesensor is updated in the dashboard but the dustsensor not... Why??

Thanks for your help!

By the way: I use Domoticz version V3.8153 on a Synology

Pieter
Looks like you are having the problem with parsing error, see the distorted representation of the command in the log. Check out : https://www.letscontrolit.com/wiki/inde ... SendToHTTP

Try:

Code: Select all

On System#Boot do //This will happen at boot ESP8266
   timerSet,1,30  //Set and start timer 1 at 30 seconds
endon
 
On Rules#Timer=1 do   //When the timer 1 is up:
  SendToHTTP 192.168.1.10,8084,/json.htm?type=param=udevice&command&idx=736&nvalue=0&svalue=[SDS011#PM25] //Send the PM2,5 data to Domoticz
  SendToHTTP 192.168.1.10,8084,/json.htm?type=param=udevice&command&idx=738&nvalue=0&svalue=[SDS011#PM10] //Send the PM10 data to Domoticz
  timerSet,1,120                //Set the next cycle at 120 seconds 
endon
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8

PieterS
Normal user
Posts: 76
Joined: 27 Mar 2018, 17:18
Location: NL

Re: Own idx, rules and domoticz

#36 Post by PieterS » 29 Mar 2018, 13:24

Many thanks for input!
I gave it a try: changed the rule for both IDX's by copy paste at 12:27:32. But after the change there is no further input in Domoticz: (look at last seen in the screenshot below)

The syntax you suggested did not work out. I am sorry.

So I tried the old one and also your example in the Wemos by Tools, Command-prompt. In both ways in the Wemos the Command Output says OK.
But with the old syntax I see that Domoticz reads the "old" command! But not the value.
I only send one command for IDX 736. That makes the difference.

Image

Too bad that the sensor is not updated in the dashboard with the variable.

I even tried to send a value with the hope it is seen in the dashboard or in Settings, Devices through a paste in the command prompt of the Wemos:

Code: Select all

SendToHTTP 192.168.1.10,8084,/json.htm?type=command&param=udevice&idx=736&nvalue=0&svalue=8
No luck! :roll:
What goes wrong?

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

Re: Own idx, rules and domoticz

#37 Post by cyberclwn » 29 Mar 2018, 15:21

Hi,,
From your post:
PieterS wrote: 29 Mar 2018, 13:24 I even tried to send a value with the hope it is seen in the dashboard or in Settings, Devices through a paste in the command prompt of the Wemos:

Code: Select all

SendToHTTP 192.168.1.10,8084,/json.htm?type=command&param=udevice&idx=736&nvalue=0&svalue=8
From the domoticz JSON-wiki:
Air quality

Code: Select all

/json.htm?type=command&param=udevice&idx=IDX&nvalue=PPM
IDX = id of your device (This number can be found in the devices tab in the column "IDX")
PPM = CO2-concentration
so try to change the values:

Code: Select all

SendToHTTP 192.168.1.10,8084,/json.htm?type=command&param=udevice&idx=736&nvalue=8
Maybe that helps :)

PieterS
Normal user
Posts: 76
Joined: 27 Mar 2018, 17:18
Location: NL

Re: Own idx, rules and domoticz

#38 Post by PieterS » 29 Mar 2018, 16:22

Hi,

Yes! I made some progress! Your suggestion with last code makes some sense!

I pasted your last code with a value in the Wemos, Tools, Command with a value and it is read into Domoticz!

Code: Select all

SendToHTTP 192.168.1.10,8084,/json.htm?type=command&param=udevice&idx=736&nvalue=18

Image

But when I replace the value by the name of the variable then it goes wrong...

Image

No idea what name it that should be. I use the names declared in the sensor.
Image

As there were empty readings in Domoticz I change the rule:

Code: Select all

On System#Boot do //This will happen at boot ESP8266
   timerSet,1,30  //Set and start timer 1 at 30 seconds
endon
 
On Rules#Timer=1 do   //When the timer 1 is up:
  SendToHTTP 192.168.1.10,8084,/json.htm?type=command&param=udevice&idx=736&nvalue=0&svalue=25 //Send the PM25 data to Domoticz
  SendToHTTP 192.168.1.10,8084,/json.htm?type=command&param=udevice&idx=738&nvalue=0&svalue=[SDS011#PM10] //Send the PM10 data to Domoticz
  timerSet,1,120                //Set the next cycle at 120 seconds 
endon
And there was a litte surprise in the logfile:

Image

Is there somewhere a bug?

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

Re: Own idx, rules and domoticz

#39 Post by cyberclwn » 29 Mar 2018, 16:33

Hi,

PieterS wrote: 29 Mar 2018, 16:22

Code: Select all

On System#Boot do //This will happen at boot ESP8266
   timerSet,1,30  //Set and start timer 1 at 30 seconds
endon
 
On Rules#Timer=1 do   //When the timer 1 is up:
  SendToHTTP 192.168.1.10,8084,/json.htm?type=command&param=udevice&idx=736&nvalue=0&svalue=25 //Send the PM25 data to Domoticz
  SendToHTTP 192.168.1.10,8084,/json.htm?type=command&param=udevice&idx=738&nvalue=0&svalue=[SDS011#PM10] //Send the PM10 data to Domoticz
  timerSet,1,120                //Set the next cycle at 120 seconds 
endon
And there was a litte surprise in the logfile:

Image

Is there somewhere a bug?

I think it is because you still use the wrong values in the rules:)
&nvalue=0&svalue=[SDS011#PM10]
And use the "name" of the device, not the type.
In your screenshot the sds011-name field has the "name" "Fijnstofmeter". (it is even showed in the log, first and second line of last screenshot. :) )
So :

Code: Select all

 &nvalue=[Fijnstofmeter#PM10] 
Complete lines:

Code: Select all

SendToHTTP 192.168.1.10,8084,/json.htm?type=command&param=udevice&idx=736&nvalue=[Fijnstofmeter#PM25] //Send the PM25 data to Domoticz
SendToHTTP 192.168.1.10,8084,/json.htm?type=command&param=udevice&idx=738&nvalue=[Fijnstofmeter#PM10] //Send the PM10 data to Domoticz  

PieterS
Normal user
Posts: 76
Joined: 27 Mar 2018, 17:18
Location: NL

Re: Own idx, rules and domoticz

#40 Post by PieterS » 29 Mar 2018, 16:41

Yes! While you typ I got same idea. Sorry! This are my first steps with ESP Easy.. What's in the name.

Image

Thanks anybody for your input!
Last edited by PieterS on 29 Mar 2018, 16:48, edited 1 time in total.

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

Re: Own idx, rules and domoticz

#41 Post by cyberclwn » 29 Mar 2018, 16:47

Hi,

It's easy, but you need a little time to get to know it and get it to work.

Good to see you got it working!.

And what is the next project ? :lol:

PieterS
Normal user
Posts: 76
Joined: 27 Mar 2018, 17:18
Location: NL

Re: Own idx, rules and domoticz

#42 Post by PieterS » 29 Mar 2018, 16:59

Thanks a lot.

Still not finished with this. Values much too high. Guess I have to divide through 100..

Got it: Add %value%/100 in Formula. :D I have no reference in neighbourhood. Next measurepoint is 6 km ahead. :(

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

Re: Own idx, rules and domoticz

#43 Post by TD-er » 29 Mar 2018, 19:30

I guess those are correct values.
The SDS just reports the correct values (except for faulty devices ofcourse)
I just use the values directly from the sensor and they agree with the RIVM/KNMI values.
If you're close to a road, it is a believable value.

Sometimes fog may lead to higher readings and perhaps some other external factors, but in general the readings are quite believable.
I have a mounting case printed which adds some tunnel to avoid direct wind blowing into the sensor.

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

Re: Own idx, rules and domoticz

#44 Post by grovkillen » 29 Mar 2018, 19:43

Moisture is a big source of error on devices like that. As well as with many environmental sensors.
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:

PieterS
Normal user
Posts: 76
Joined: 27 Mar 2018, 17:18
Location: NL

Re: Own idx, rules and domoticz

#45 Post by PieterS » 02 Apr 2018, 17:41

cyberclwn wrote: 29 Mar 2018, 16:47 Hi,

It's easy, but you need a little time to get to know it and get it to work.

Good to see you got it working!.

And what is the next project ? :lol:
Write a rule to switch a port on the ESP: but have some trouble with that..

I want to change status of GPIO14 (D5) from low to high when GPIO-13 (D7) is changing.

Image

The sensor is a tracker-sensor which sends its output to D7. I see that correct value is represented in the list of Devices

I made this rule:
on Gas#Switch=1 do // Task Gas which reads GPIO-13 (D7)
if [Gas#Switch]=1 // If status Switch = 1
gpio, 14, 1 // Statusled GPIO-14 (D5) aan
else
gpio, 14, 0 // Statusled GPIO-14 (D5) uit
endif
endon
When I send the command in Tools, Command: gpio,14, 1 then i read that D5 is High (3.3 V). That's what i want.

When I send the command in Tools, Command: gpio,14, 0 then i read that D5 is Low (0 V). That's OK.

So I studied in the Wiki on the example of PIR and LDR and SR04 and LDR.. I build this rule:

Image

No luck! How do I write the code for trigger and condition? My script does not work.. :roll:

In the log is an event written when I give the command via Tools, Command and D5 is high.
Image

Any help is apreciated. Thanks in advance. :P

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

Re: Own idx, rules and domoticz

#46 Post by grovkillen » 02 Apr 2018, 18:27

Code: Select all

on Gas#Switch do // Task Gas which reads GPIO-13 (D7) 
if [Gas#Switch]=1 // If status Switch = 1
gpio, 14, 1 // Statusled GPIO-14 (D5) aan
else
gpio, 14, 0 // Statusled GPIO-14 (D5) uit
endif
endon
Remove the =1 on the event since you're doing a test anyway.
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:

PieterS
Normal user
Posts: 76
Joined: 27 Mar 2018, 17:18
Location: NL

Re: Own idx, rules and domoticz

#47 Post by PieterS » 02 Apr 2018, 22:10

Thanks for reply but it did not help, sorry. :(

Is there need for adding a device or task to switch that port?

Just gave the command again in Tools, Command gives the result. It's yellow marked in logfile.

Image

But that does not happen when done by sensor and modified script.

Image

Why?

User avatar
toffel969
Normal user
Posts: 469
Joined: 03 Jan 2017, 10:58
Location: Germany

Re: Own idx, rules and domoticz

#48 Post by toffel969 » 02 Apr 2018, 22:22

Try

Code: Select all

on Gas#Switch=1 do // Task Gas which reads GPIO-13 (D7) 
gpio,14,1 // Statusled GPIO-14 (D5) aan
Endon

On gas#Switch=0 do
gpio,14,0 // Statusled GPIO-14 (D5) uit
endon
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8

PieterS
Normal user
Posts: 76
Joined: 27 Mar 2018, 17:18
Location: NL

Re: Own idx, rules and domoticz

#49 Post by PieterS » 02 Apr 2018, 22:40

That makes sense! You are my hero! :D :D

Thank you very much

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

Re: Own idx, rules and domoticz

#50 Post by cyberclwn » 02 Apr 2018, 23:19

PieterS wrote: 02 Apr 2018, 22:10 But that does not happen when done by sensor and modified script.

Image

Why?
I think this rule works, if you remove the spaces:

Code: Select all

on Gas#Switch do // Task Gas which reads GPIO-13 (D7) 
if [Gas#Switch]=1 // If status Switch = 1
gpio,14,1 // Statusled GPIO-14 (D5) aan
else
gpio,14,0 // Statusled GPIO-14 (D5) uit
endif
endon
On my own rules i noticed that espeasy is very picky on "useless" space in lines.
I known you solved it with other rules, but thought i try explain why what you tried is not working.
For future rules :)

Post Reply

Who is online

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