Intigrating ESP Easy to Cayenne

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Bronden
New user
Posts: 1
Joined: 31 Oct 2017, 20:18

Intigrating ESP Easy to Cayenne

#1 Post by Bronden » 31 Oct 2017, 20:26

Hi. I was wondering if anyone hire would have the skillset to add the IOT portal Cayenne / https://mydevices.com/ to the supported portals.

The Cayenne project has a very nice interface, a very good app and is just a delight to work with. Combined with Esp Easy it would be Very powerfull!

Hope for some feedback. Or maybe som inputs on howto do it.

Cayenne also runs MQTT.

panchovilla
New user
Posts: 1
Joined: 01 Nov 2017, 16:41

Re: Intigrating ESP Easy to Cayenne

#2 Post by panchovilla » 01 Nov 2017, 16:44

I think that is a great idea. I am trying to find a way to implement it into Cayenne, but unfortunately I don't have the skills to do it....

mstjerna
Normal user
Posts: 10
Joined: 17 Jan 2018, 16:43

Re: Intigrating ESP Easy to Cayenne

#3 Post by mstjerna » 17 Jan 2018, 20:53

Hi

I would also love a integration to Cayenne!
The issue today if I chose generic MQTT integration in the ESPEasy is that the key-length for Cayenne is longer than the webinterface allows.
I think this would be a easy task for the right person to add, maybe as a new entry in the "Controllers page"

The cayenne have a generic ESP8266 library created so it should be possible to just borrow/implement parts of this directly to the ESPEasy...
https://github.com/myDevicesIoT/Cayenne-MQTT-ESP

One issue with the current ESPEasy is the lengt of "Mqtt Username", "Mqtt Password" and "Client ID", Cayenne uses 36, 40, 36 char
There is a topic on the ESPEasy GIT that thiscuss some changes to the MQTT but the length isn't part of this as I can see?
https://github.com/letscontrolit/ESPEasy/issues/378

There are also changes planned for 2.1.0 but I don't know if this would be resolved?
2.1.0 (planned)
Security
Revamp MQTT handling (send cmd to "all" and "group", not only single unit)
Generic MQTT handling (+QoS)

Image

I would love to see this implemented as a generic feature in the ESPEasy or as a seperate plugin. Cayenne seems to be a great service for the people that don't have the time or skill to setup a RaspberyPI with Openhab or any other HomeAutomation software...

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

Re: Intigrating ESP Easy to Cayenne

#4 Post by TD-er » 18 Jan 2018, 11:16

I was working on MQTT issues last night and I guess -judging on the issues added today- I will be tonight.
So please add these requests to the corresponding github issues and use thumbs-up tags to make it easier to sort for me ;)

Problem with longer strings in the settings is that it renders stored configurations unusable.
So that's kind of a thing.
Maybe we should also think about how to solve that.

User avatar
EDsteve
Normal user
Posts: 61
Joined: 11 May 2018, 21:13

Re: Intigrating ESP Easy to Cayenne

#5 Post by EDsteve » 17 Jun 2020, 06:12

I don't think it has because i know how busy you guys are. But i would also love to have a Cayenne integration. Did anything happen in that direction?
mstjerna wrote: 17 Jan 2018, 20:53 The issue today if I chose generic MQTT integration in the ESPEasy is that the key-length for Cayenne is longer than the webinterface allows.
Is that still same situation? I can't even find the option "generic MQTT integration" :D

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

Re: Intigrating ESP Easy to Cayenne

#6 Post by TD-er » 17 Jun 2020, 09:07

The controllers now have the option for "extended credentials"
This allows for longer username/pass

User avatar
EDsteve
Normal user
Posts: 61
Joined: 11 May 2018, 21:13

Re: Intigrating ESP Easy to Cayenne

#7 Post by EDsteve » 17 Jun 2020, 10:41

Do you know by any chance which controller i should choose to send data to Cayenne? Someone talked about "Generic MQTT"... But i don't see that in the last built.

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

Re: Intigrating ESP Easy to Cayenne

#8 Post by grovkillen » 17 Jun 2020, 12:07

Try the open hab one.
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
EDsteve
Normal user
Posts: 61
Joined: 11 May 2018, 21:13

Re: Intigrating ESP Easy to Cayenne

#9 Post by EDsteve » 18 Jun 2020, 05:45

TD-er wrote: 17 Jun 2020, 09:07 The controllers now have the option for "extended credentials"
This allows for longer username/pass
Hmm. Doesn't seem to work on my side. I am running the mega-20200608 and when i input the Controller User. It cuts off 30% or so. Is that only a GUI problem or still not fixed?
Attachments
extended.png
extended.png (9.59 KiB) Viewed 17012 times

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

Re: Intigrating ESP Easy to Cayenne

#10 Post by grovkillen » 18 Jun 2020, 05:49

It's only visual, it should work.
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: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Intigrating ESP Easy to Cayenne

#11 Post by TD-er » 18 Jun 2020, 11:52

Have you reloaded the page after turning on the extended credentials? (and saving)
It could be the input field uses a max. length which is set based on the state of that checkbox at loading the page.

User avatar
EDsteve
Normal user
Posts: 61
Joined: 11 May 2018, 21:13

Re: Intigrating ESP Easy to Cayenne

#12 Post by EDsteve » 19 Jun 2020, 06:24

Yes. The extended credentials works fine. *Thumbs up*

The same clientID for two devices will not work (I did that for testing and it took me a while to figure out what actually was the problem)

At the end i managed to receive data on Cayenne. Here my settings in case somebody else needs it:
Attachments
Opera Snapshot_2020-06-19_124632_192.168.8.217.png
Opera Snapshot_2020-06-19_124632_192.168.8.217.png (37.41 KiB) Viewed 16951 times
Opera Snapshot_2020-06-19_124805_192.168.8.217.png
Opera Snapshot_2020-06-19_124805_192.168.8.217.png (53.61 KiB) Viewed 16951 times

mr_aleks
New user
Posts: 4
Joined: 11 Jul 2021, 12:58

Re: Intigrating ESP Easy to Cayenne

#13 Post by mr_aleks » 11 Jul 2021, 13:02

How to get different readings to be sent to different channels?
"Controller Publish:" wrote like this "v1/username/things/clientID/data/channel"
Image
Image
Image

I also tried to do this through the rules, but nothing is sent at all, Tried so

Code: Select all

on Clock#Time=All,**:01 do
    Publish,v1/41277350-e1a5-11eb-883c-638d8ce4c***/things/53b3fc50-e1a5-11eb-8779-7d56e82df***/data/json,{"channel":"1","value":"[HTU21D#Temperature]","type":"temp","unit":"c"}
endon
and so

Code: Select all

on Clock#Time=All,**:01 do
 Publish,v1/41277350-e1a5-11eb-883c-638d8ce4c***/things/53b3fc50-e1a5-11eb-8779-7d56e82df***/data/1,HTU21D#Temperature
endon

User avatar
Ath
Normal user
Posts: 3417
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Intigrating ESP Easy to Cayenne

#14 Post by Ath » 11 Jul 2021, 13:12

You have set Controller Publish to a fixed string, so that is the only topic you can reach using MQTT. The default there is this: %sysname%/%tskname%/%valname% where %sysname% is the name of the ESP and %tskname% %valname% the Task and Value name of the task data that is being sent. You can use any variable or function there, instead of a part of your fixed string, to include something context specific. Only %tskname% and %valname% aren't mentioned on the Tools/System Variables page (where most variables are listed), as these 2 variables need the context of a Task and that's only available when sending the data via a controller.
/Ton (PayPal.me)

mr_aleks
New user
Posts: 4
Joined: 11 Jul 2021, 12:58

Re: Intigrating ESP Easy to Cayenne

#15 Post by mr_aleks » 11 Jul 2021, 14:12

Ath wrote: 11 Jul 2021, 13:12 You have set Controller Publish to a fixed string, so that is the only topic you can reach using MQTT. The default there is this: %sysname%/%tskname%/%valname% where %sysname% is the name of the ESP and %tskname% %valname% the Task and Value name of the task data that is being sent. You can use any variable or function there, instead of a part of your fixed string, to include something context specific. Only %tskname% and %valname% aren't mentioned on the Tools/System Variables page (where most variables are listed), as these 2 variables need the context of a Task and that's only available when sending the data via a controller.
I still don't understand how it should look.
My sensor
Image
My controller
Image
I have tried like this

Code: Select all

%sysname%/%HTU21D%/%Temperature%
but it didn't work for me
cayenne mqtt api:
https://developers.mydevices.com/cayenn ... ensor-data
Can you make an example for me? At the moment I do not quite understand how it works correctly.

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

Re: Intigrating ESP Easy to Cayenne

#16 Post by TD-er » 11 Jul 2021, 14:15

Not sure if the taskname or variable name can be long enough, but you may have the same prefix for each, so you could do something like this:

Code: Select all

v1/41277350-e1a5-11eb-883c-%tskname%/things/53b3fc50-e1a5-11eb-8779-%varname%/data/1
Just as an example, the default publish string for OpenHAB MQTT controller:

Code: Select all

%sysname%/%tskname%/%valname%
These publish topics should be stored in the controller settings.
And you can perhaps name a task (or your node, via %sysname%) to get the desired topic string.

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

Re: Intigrating ESP Easy to Cayenne

#17 Post by TD-er » 11 Jul 2021, 14:18

Another idea is to store the parts in a variable and use the toHex function to convert it to hex.
See: https://espeasy.readthedocs.io/en/lates ... obin-tohex
Not sure if the MQTT topics are case sensitive though.

mr_aleks
New user
Posts: 4
Joined: 11 Jul 2021, 12:58

Re: Intigrating ESP Easy to Cayenne

#18 Post by mr_aleks » 11 Jul 2021, 14:27

TD-er wrote: 11 Jul 2021, 14:15 Not sure if the taskname or variable name can be long enough, but you may have the same prefix for each, so you could do something like this:

Code: Select all

v1/41277350-e1a5-11eb-883c-%tskname%/things/53b3fc50-e1a5-11eb-8779-%varname%/data/1
Just as an example, the default publish string for OpenHAB MQTT controller:

Code: Select all

%sysname%/%tskname%/%valname%
These publish topics should be stored in the controller settings.
And you can perhaps name a task (or your node, via %sysname%) to get the desired topic string.
I think this is not a completely correct example, because their manual says so
Image
or I need to look for another way to send data to Cayenne ?

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

Re: Intigrating ESP Easy to Cayenne

#19 Post by TD-er » 11 Jul 2021, 14:46

Well if it is only the last ID, the channel, which needs to differ among sensor values, then you can try to use the task value name.
How long are the strings of this "channel" ID?
If they do fit in the field for a taskvalue name, you're almost done by simply publishing to a topic like this:

Code: Select all

v1/xxxx-xxxxx-xxxx.../things/yyyy-yyyy-yyyyy..../%valname%
N.B. I noticed I used %varname% in my previous example, but it should be %valname%

N.B.2: This should be used in a controller, not when sending from the rules using publish.
When publishing from the rules, you cannot use %valname% as there is none in that context.

mr_aleks
New user
Posts: 4
Joined: 11 Jul 2021, 12:58

Re: Intigrating ESP Easy to Cayenne

#20 Post by mr_aleks » 11 Jul 2021, 14:58

TD-er wrote: 11 Jul 2021, 14:46 Well if it is only the last ID, the channel, which needs to differ among sensor values, then you can try to use the task value name.
How long are the strings of this "channel" ID?
If they do fit in the field for a taskvalue name, you're almost done by simply publishing to a topic like this:

Code: Select all

v1/xxxx-xxxxx-xxxx.../things/yyyy-yyyy-yyyyy..../%valname%
N.B. I noticed I used %varname% in my previous example, but it should be %valname%

N.B.2: This should be used in a controller, not when sending from the rules using publish.
When publishing from the rules, you cannot use %valname% as there is none in that context.
As in the screenshot in the first post of this topic
I only have MQTT Username, Client ID and Password. Client ID - 36 characters

Code: Select all

v1/myusername/things/myclientID/%valname%
I write this in the controller settings in the Controller Publish:
Right?

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

Re: Intigrating ESP Easy to Cayenne

#21 Post by TD-er » 11 Jul 2021, 18:03

The max length of the taskvalue name is 40 characters, so you could store the channel ID.
And of course you should replace the user ID and clientID.
The max. topic length you can store in the settings to publish to is 128 bytes.

Then you could try to send data from a task to the controller.

Post Reply

Who is online

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