Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional "device_id" field in config.json #45

Closed
hoalex opened this issue Mar 22, 2016 · 6 comments
Closed

Additional "device_id" field in config.json #45

hoalex opened this issue Mar 22, 2016 · 6 comments
Milestone

Comments

@hoalex
Copy link

hoalex commented Mar 22, 2016

Hi there,

I think it would be great if Homie could optionally publish its MQTT messages under devices/name instead of devices/device id. That way, multiple ESP8266s would be easier to distinguish, as one could simply name them -- for example -- "kitchen", "living room" and so on in configuration mode and then access them by that name via MQTT.
I guess that the current approach was chosen mainly to avoid naming conflicts, therefore I suggest using an optional statement in the setup() block à la:

Homie.useNameForPublish(true);

What do you think? :-)

@jpmens
Copy link

jpmens commented Mar 23, 2016

name can contain a descriptive text such as Light relay in living room, which is great because it allows, say, a Web interface to display this clearly. As an avid hater of white space in topic names (and file system path names) I think this would lead to some confusion. (Of course people could suppress white space in name if they don't want it (light-relay-in-living-room).

I tend to think this calls for an additional setting (sub_topic ?) which ought to be in the configuration, as we did for base_topic in #44.

My 0.01c 😄

@marvinroger
Copy link
Member

@jpmens This is what I wanted to do, an additional device_id field in the JSON configuration file. It would adhere to the following rules, as stated in the convention:

Each device must have a unique device ID. This ID MAY be composed of lowercase letters from a to z, numbers from 0 to 9, and it MAY contain -, but MUST NOT start or end with a -.

@hoalex an Homie.useNameForPublish(true); method would not fit as Homie sketches are meant to be portable.

Does it sound good to both of you?

@marvinroger marvinroger added this to the 1.3.0 milestone Mar 23, 2016
@marvinroger marvinroger changed the title Option to change publish path from "devices/device id" to "devices/name" Additional "device_id" field in config.json Mar 23, 2016
@jpmens
Copy link

jpmens commented Mar 23, 2016

👍

@hoalex
Copy link
Author

hoalex commented Mar 23, 2016

Sounds perfect 👍 Thanks for looking into it!

@marvinroger
Copy link
Member

This will land in 1.3.0! The new device_id field is at the root of the JSON config.

@marvinroger
Copy link
Member

Released!

gorec2005 pushed a commit to gorec2005/homie-esp8266 that referenced this issue Jun 28, 2020
* HTTP 302 and 304 Support

Add support for http redirection (302) and http not modified (304) to
reduce the load the server.
server.redirect(“url”, “location”, exclude-ip) will respond with 302 to
redirect the browser to a different url, this is useful for backward
compatibility and to redirect call to CDN when not no AP mode.
server.serveStatic has a new optional parameter to get the
Last-Modified date for all files serve for this location, when the
browser request have the same If-Modified-Since header value, the
server respond with 304 code instead of serving the file.

* First round of performance improvements.

* Merge remote-tracking branch 'me-no-dev/master' into performance

# Conflicts:
#	src/WebHandlerImpl.h
#	src/WebHandlers.cpp

* use of sprintf

* Remove sections not related.

* Fix a bug to serve a file in directory (e.g. serverStatic("/", SPIFFS, "/index.html");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants