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

new Datatype map? (Or use different formats for enum)? #72

Closed
euphi opened this issue Apr 1, 2018 · 4 comments
Closed

new Datatype map? (Or use different formats for enum)? #72

euphi opened this issue Apr 1, 2018 · 4 comments

Comments

@euphi
Copy link
Member

euphi commented Apr 1, 2018

In case you have a node property of type enumeration, but this enumeration has many elements, it can be useful to still use integer values for MQTT communication. However, also in these cases you want to announce the possible values with their meaning.

The current 3.0 convention allows to announce enumerations with their possible allowed values, but no mapping of integer values to a meaning.

As an example, in my ESP_Homie_WS2812FX Node there is a "mode" property that allows all modes from the WS2812FX lib. However, when setting a new mode, I still want to receive the new mode as integer, because it is much easier to parse.

So, for the announcement there should be a way to announce the mapping of the integer to it's corresponding mode name, e.g 46: Fire Flicker, 47: Fire Flicker (soft) etc.

What is your opinion about this?

  • Don't use integer, when you want something else, so send a string with the mode's name.
  • Lets extend the enum "format", so you can give each allowed enumeration value a description string.
  • Add a new dataype map that maps allowed integer values to a string.
@davidgraeff
Copy link
Member

@timpur @ThomDietrich @Thalhammer Can we close this? A map structure is not easily possible via MQTT means and because we decided not to allow external data type standards, this issue is not solvable.

@Thalhammer
Copy link
Member

@euphi The convention is open for extension by the user, so if you feel like you need more topics in your application you're free to add them (as long as they don't conflict with any homie topics).
But as @davidgraeff already said, a map is not possible without quite complex parsing and tbh the approach you outlined above doesn't feel right anyway.
@davidgraeff I think this can be closed.

@ThomDietrich
Copy link
Collaborator

I agree that this can't easily and with clear benefits be part of the convention.

@davidgraeff
Copy link
Member

Alright. Closing this.

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

4 participants