Page 1 of 1

Intigrating ESP Easy to Cayenne

Posted: 31 Oct 2017, 20:26
by Bronden
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.

Re: Intigrating ESP Easy to Cayenne

Posted: 01 Nov 2017, 16:44
by panchovilla
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....

Re: Intigrating ESP Easy to Cayenne

Posted: 17 Jan 2018, 20:53
by mstjerna
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...

Re: Intigrating ESP Easy to Cayenne

Posted: 18 Jan 2018, 11:16
by TD-er
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.

Re: Intigrating ESP Easy to Cayenne

Posted: 17 Jun 2020, 06:12
by EDsteve
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

Re: Intigrating ESP Easy to Cayenne

Posted: 17 Jun 2020, 09:07
by TD-er
The controllers now have the option for "extended credentials"
This allows for longer username/pass

Re: Intigrating ESP Easy to Cayenne

Posted: 17 Jun 2020, 10:41
by EDsteve
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.

Re: Intigrating ESP Easy to Cayenne

Posted: 17 Jun 2020, 12:07
by grovkillen
Try the open hab one.

Re: Intigrating ESP Easy to Cayenne

Posted: 18 Jun 2020, 05:45
by EDsteve
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?

Re: Intigrating ESP Easy to Cayenne

Posted: 18 Jun 2020, 05:49
by grovkillen
It's only visual, it should work.

Re: Intigrating ESP Easy to Cayenne

Posted: 18 Jun 2020, 11:52
by TD-er
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.

Re: Intigrating ESP Easy to Cayenne

Posted: 19 Jun 2020, 06:24
by EDsteve
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:

Re: Intigrating ESP Easy to Cayenne

Posted: 11 Jul 2021, 13:02
by mr_aleks
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

Re: Intigrating ESP Easy to Cayenne

Posted: 11 Jul 2021, 13:12
by Ath
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.

Re: Intigrating ESP Easy to Cayenne

Posted: 11 Jul 2021, 14:12
by mr_aleks
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.

Re: Intigrating ESP Easy to Cayenne

Posted: 11 Jul 2021, 14:15
by TD-er
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.

Re: Intigrating ESP Easy to Cayenne

Posted: 11 Jul 2021, 14:18
by TD-er
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.

Re: Intigrating ESP Easy to Cayenne

Posted: 11 Jul 2021, 14:27
by mr_aleks
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 ?

Re: Intigrating ESP Easy to Cayenne

Posted: 11 Jul 2021, 14:46
by TD-er
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.

Re: Intigrating ESP Easy to Cayenne

Posted: 11 Jul 2021, 14:58
by mr_aleks
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?

Re: Intigrating ESP Easy to Cayenne

Posted: 11 Jul 2021, 18:03
by TD-er
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.