Zigbee2MqttAssistant icon indicating copy to clipboard operation
Zigbee2MqttAssistant copied to clipboard

Support secrets.yaml

Open emouawad opened this issue 4 years ago • 17 comments

HA 0.99 brings support of secrets.yaml to addons. It appears this addons still doesn't support !secret to username and password of MQTT

emouawad avatar Sep 19 '19 12:09 emouawad

This is a new feature and there's very little documentation about this. The configuration is in json but the secret is in yaml. I was under the impression it's automatic and there's nothing to do in the add-on to support it.

Did you try it?

carldebilly avatar Sep 23 '19 14:09 carldebilly

HI, well I thought that the replacement should be automatic and addons don't need to change anything but i might be wrong - I tried exactly same configuration but manual credentials work and secrets don't; FYI other addons i have use same keys.

Tried on the latest release too.

image

image

Let me know if i can help in any way, maybe testing?

emouawad avatar Sep 23 '19 15:09 emouawad

The !secret is a yaml tag (https://yaml.org/spec/1.1/current.html#id858600). I don't know how it should be supported on JSON...

carldebilly avatar Sep 24 '19 13:09 carldebilly

I am interested in this feature as well. 😇

Isn't it possible to do it like https://github.com/danielwelch/hassio-zigbee2mqtt/ is doing it since it is using JSON (for zigbee2mqtt) under the hood as well and needs to deal with a YAML config provided from HassIO? 🙈

Not sure if this helps... 🤔

CodeFinder2 avatar Sep 28 '19 12:09 CodeFinder2

To be honest, I really don't know how this feature is working.

From my point of view, there's nothing to do in Z2MA (or any other add-on) to use it, but I don't know how.

carldebilly avatar Sep 29 '19 03:09 carldebilly

@carldebilly I have never developed a Hassio addon yet but did some research on this and found out that all repos / addons supporting secrets provide a config.json, for example: https://github.com/danielwelch/hassio-zigbee2mqtt/blob/master/zigbee2mqtt/config.json

This file seems to describe the possible entries in the config or is at least responsible for allowing a validation (schema). Maybe this enables secrets?

Here is the official doc/tutorial from HA: https://developers.home-assistant.io/docs/en/hassio_addon_config.html#options--schema

This also seems to be a hint: https://github.com/hassio-addons/addon-ftp/pull/5

Hopefully, I am not completely wrong... 🙈😁?!

CodeFinder2 avatar Jan 09 '20 00:01 CodeFinder2

@CodeFinder2 It would be nice to try it :-). The config.json (https://github.com/yllibed/hassio/blob/master/zigbee2mqttassistant-dev/config.json) is not providing any schema right now.

carldebilly avatar Jan 09 '20 16:01 carldebilly

I'll give this a try and make a PR, if possible 😎

Edit: hopefully, I will have the time today in the eventing to take a look at this. 🙈

CodeFinder2 avatar Jan 09 '20 16:01 CodeFinder2

Heya! Just tried the same, any update on this? :)

EpicLPer avatar Mar 05 '20 13:03 EpicLPer

I am still planning to take a look at this but the problem is that I am not used to. NET, Docker and the architecture / environment of this addon. (And yes, time is another thing...)

@carldebilly would you mind giving me a short overview of how I should start? 🙈 I mean a working dev environment would be sufficient for now, and an overview of how things work together, what are the relevant repos etc would even be more helpful. I am kind of experienced in C++ and Python but not in .NET although this shouldn't be much of a problem (just another programming language 😊). I have a dev machine running Ubuntu 18.04 and Windows 10 with VS 2019. What would be the simpliest/most efficient way to start? I was not able to find any 'meta info' on how to contribute (rgd. how things interact and what's important for you wrt. coding style, architecture design, etc.).

Z2MA is currently running on an Odroid XU4 but it's my daily driver for my (smart) home so I don't want to work with that for development. 😅

We can also talk about this via mail/Telegram, whatever fits your needs. 🙂

CodeFinder2 avatar Mar 05 '20 13:03 CodeFinder2

Hi, in this commit it was added to the Grafana add-on: https://github.com/hassio-addons/addon-grafana/commit/2848651a84acc1a21fc8dbab0ba6797198d3f36a

I thought that might be helpful

cmitz avatar Mar 16 '20 10:03 cmitz

@cmitz thanks for that link. Unfortunately, it seems that this is not the correct way to do it anymore since those lines are not present in the current revision.

CodeFinder2 avatar Mar 16 '20 12:03 CodeFinder2

Hi, Any movement on this Topic?

rbron01 avatar May 10 '20 02:05 rbron01

Hi, Any movement on this Topic?

interested as well

marcgarciamarti avatar May 16 '20 21:05 marcgarciamarti

still interested

pznamenskii avatar Oct 07 '20 09:10 pznamenskii

Such a secret.yaml might also help in my issue: the documented docker Z2MA startup command line fails on my mqtt password since this contains special bash shell characters. I could not figure out how to escape these properly to make the command line work regardless of the actual password characters in use.

MileBuurmeijer avatar Dec 31 '20 09:12 MileBuurmeijer

I'd be interested in a solution as well.

panache67 avatar Jan 11 '21 19:01 panache67