Discovery configuration retrieval

Hi,

Had all sorts of problems setting up a MQTT RGB to work in configuration.yaml.

But enabling the discovery option found the device and integrated perfectly with HA. Is there a way to retrieve the configuration learnt from the discovey of that device so it could be added into the configuration.yaml file?

Thanks,

You could interpret the files in .storage along with inspecting the retained config messages in your broker using something like mqttfx but if it’s working why mess with it?

WHY??? Discovery has configured it and it’s working. Why screw with it? Discovery is a legitimate way to use MQTT devices.

Maybe I’m tackling the issue the wrong way…
After a restart of HA, discovered devices enter into"entity not available" as shown below to resolve need to restart the remote devices all is then happy.
MQTT devices that are setup in configuration.yaml don’t have this issue. Hence my question but very open to a better solution!

I have the same problem
Use esphomeyaml with mqtt discovery for some nodemcu with the latest version from esphomeyaml.
And after upgrade of HASS to version 0.87 i got this in the log for all “lights”

@OttoWinter any idea ?

2019-02-07 14:34:14 WARNING (MainThread) [homeassistant.components.mqtt.discovery] "platform": "mqtt_json" is deprecated, replace with "schema":"json"
2019-02-07 14:34:14 ERROR (MainThread) [homeassistant.components.mqtt.light] Exception in async_discover when dispatching 'mqtt_discovery_new_light_mqtt': ({'flash': True, 'name': 'light_dckw2cjwud', 'platform': 'mqtt', 'state_topic': 'control_3dprinter/light/light_dckw2cjwud/state', 'command_topic': 'control_3dprinter/light/light_dckw2cjwud/command', 'availability_topic': 'control_3dprinter/status', 'unique_id': 'ESPlightlight_dckw2cjwud', 'device': {'identifiers': '5ccf7f033ea5', 'name': 'control_3dprinter', 'sw_version': 'esphomelib v1.10.1 Feb  7 2019, 14:32:35', 'model': 'PLATFORMIO_NODEMCUV2', 'manufacturer': 'espressif'}, 'schema': 'json'},)
Traceback (most recent call last):
  File "/usr/src/app/homeassistant/components/mqtt/light/__init__.py", line 60, in async_discover
    config = PLATFORM_SCHEMA(discovery_payload)
  File "/usr/local/lib/python3.6/site-packages/voluptuous/validators.py", line 207, in __call__
    return self._exec((Schema(val) for val in self.validators), v)
  File "/usr/local/lib/python3.6/site-packages/voluptuous/validators.py", line 286, in _exec
    raise e if self.msg is None else AllInvalid(self.msg, path=path)
  File "/usr/local/lib/python3.6/site-packages/voluptuous/validators.py", line 282, in _exec
    v = func(v)
  File "/usr/local/lib/python3.6/site-packages/voluptuous/schema_builder.py", line 267, in __call__
    return self._compiled([], data)
  File "/usr/local/lib/python3.6/site-packages/voluptuous/schema_builder.py", line 811, in validate_callable
    return schema(data)
  File "/usr/src/app/homeassistant/components/mqtt/light/__init__.py", line 36, in validate_mqtt_light
    return schemas[value[CONF_SCHEMA]](value)
  File "/usr/local/lib/python3.6/site-packages/voluptuous/schema_builder.py", line 267, in __call__
    return self._compiled([], data)
  File "/usr/local/lib/python3.6/site-packages/voluptuous/schema_builder.py", line 589, in validate_dict
    return base_validate(path, iteritems(data), out)
  File "/usr/local/lib/python3.6/site-packages/voluptuous/schema_builder.py", line 427, in validate_mapping
    raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: extra keys not allowed @ data['flash']

Or you can wait 5 minutes for the telemetry message. Or you can put the recommended start up routine in home assistant. GitHub - arendst/Tasmota: Alternative firmware for ESP8266 and ESP32 based devices with easy configuration using webUI, OTA updates, automation using timers or rules, expandability and entirely local control over MQTT, HTTP, Serial or KNX. Full documentation at

That is a different problem. Please start your own topic about this.

Thanks Tom,

Waiting 5 minutes + didn’t work. The link above sounds positive, I’ll give it a go tomorrow…keep you posted.

Rob.

Yep that link fixed… two problems.
Entity not found issue and also the state of the entity on HA startup not being correct. State query did need a delay, added a minute but I’m sure it can be trimmed.
thank you!

  1. The entity not found using:
  • alias: “Enable MQTT discovery for all devices”
    trigger:
    platform: homeassistant
    event: start
    action:
    • service: mqtt.publish
      data:
      topic: “sonoffs/cmnd/SetOption19”
      payload: “1”
  1. State
  • alias: “Power state on HA start-up”
    trigger:
    platform: homeassistant
    event: start
    action:
    • delay: 00:01:00
    • service: mqtt.publish
      data:
      topic: “sonoffs/cmnd/state”
      payload: “”