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

Add all friendly names to the status payload #2208

Closed
mizrachiran opened this issue Mar 20, 2018 · 9 comments
Closed

Add all friendly names to the status payload #2208

mizrachiran opened this issue Mar 20, 2018 · 9 comments
Labels
enhancement Type - Enhancement that will be worked on

Comments

@mizrachiran
Copy link

Hi,

This is a feature request.
I would love to see all friendly names in the status payload, currently only the first is printed out.
This can be useful for third party integration.

Thanks!

  if ((0 == payload) || (99 == payload)) {
    snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_STATUS "\":{\"" D_CMND_MODULE "\":%d,\"" D_CMND_FRIENDLYNAME "\":\"%s\",\"" D_CMND_TOPIC "\":\"%s\",\"" D_CMND_BUTTONTOPIC "\":\"%s\",\"" D_CMND_POWER "\":%d,\"" D_CMND_POWERONSTATE "\":%d,\"" D_CMND_LEDSTATE "\":%d,\"" D_CMND_SAVEDATA "\":%d,\"" D_JSON_SAVESTATE "\":%d,\"" D_CMND_BUTTONRETAIN "\":%d,\"" D_CMND_POWERRETAIN "\":%d}}"),
      Settings.module +1, Settings.friendlyname[0], mqtt_topic, Settings.button_topic, power, Settings.poweronstate, Settings.ledstate, Settings.save_data, Settings.flag.save_state, Settings.flag.mqtt_button_retain, Settings.flag.mqtt_power_retain);
    MqttPublishPrefixTopic_P(option, PSTR(D_CMND_STATUS));
  }
@Jason2866
Copy link
Collaborator

No offend! What is easier, for integration if friendly name is in?
For my point of view it makes parsing the payload more complicated, when redundant data is in.

@mizrachiran
Copy link
Author

It will help knowing the name of each device when integrating with other systems.

I can’t understand how it makes parsing harder...

@Jason2866
Copy link
Collaborator

I didnt understand it correct. Read it again. Now it is clear. Has no affect in parsing. ..
But i still do not see the benefit. If the friendly name is needed command "status" and there it is.

@mizrachiran
Copy link
Author

This is true. But only for the first switch / relay.
Each device you connect to tasmota has it’s own friendly name.

See in the code snippet i attached how we take the first out of the array.

@Jason2866
Copy link
Collaborator

Lets see what @arendst think about it 🤔

@arendst
Copy link
Owner

arendst commented Mar 21, 2018

Have a look at HomeAssistant Mqtt discovery in Tasmota. It provide the friendlynames on startup in a retained message to be used by Hass or Domoticz.

You might want to jump on the same bandwagon for your third party integration.

@arendst arendst added the help needed Action - Asking for help from the community label Mar 21, 2018
@mizrachiran
Copy link
Author

thanks @arendst
The thing is that i'm trying to integrate sonoff tasmota devices into an iOS app that doesn't work with MQTT.
It uses mDNS to discover devices and making http calls to get all information and control the devices.
Is there an option to get all friendly names by http call?

Thanks!
Ran

@arendst
Copy link
Owner

arendst commented Mar 21, 2018

Currently the only way is to execute commands like friendlyname2.

I will implement your request as an array of friendlynames in the status command. Expect something like

... ,"FriendlyName":["DualR2 1","DualR2 2"], ...

@arendst arendst added enhancement Type - Enhancement that will be worked on and removed help needed Action - Asking for help from the community labels Mar 21, 2018
@mizrachiran
Copy link
Author

@arendst
This is great!
Thank you so much!

arendst added a commit that referenced this issue Mar 21, 2018
5.12.0h
 * Add all FriendlyNames to Status information (#2208)
 * Change
status display of Ssid and SetOption
@arendst arendst closed this as completed Mar 21, 2018
curzon01 pushed a commit to curzon01/Tasmota that referenced this issue Sep 6, 2018
5.12.0h
 * Add all FriendlyNames to Status information (arendst#2208)
 * Change
status display of Ssid and SetOption
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Type - Enhancement that will be worked on
Projects
None yet
Development

No branches or pull requests

3 participants