mak-gitdev / HA_enoceanmqtt

Home Assistant wrapper for enocean-mqtt (https://github.com/embyt/enocean-mqtt)
GNU General Public License v3.0
57 stars 16 forks source link

Can't use % character in MQTT password (edited from Start the Addon) #37

Closed daschmidt1994 closed 1 year ago

daschmidt1994 commented 1 year ago

When I try to start this Addon, I get this error:

Preparing to start... Retrieved devices file: /config/enoceanmqtt.devices.sample Starting EnOceanMQTT... /usr/lib/python3.10/site-packages/beautifulsoup4-4.11.2-py3.10.egg/bs4/builder/__init__.py:545: XMLParsedAsHTMLWarning: It looks like you're parsing an XML document using an HTML parser. If this really is an HTML document (maybe it's XHTML?), you can ignore or filter this warning. If it's XML, you should know that using an XML parser will be more reliable. To parse this document as XML, make sure you have the lxml package installed, and pass the keyword argumentfeatures="xml"into the BeautifulSoup constructor. warnings.warn( 2023-02-03 22:25:24,539 INFO: Logging to file: /config/enoceanmqtt.log 2023-02-03 22:25:24,540 INFO: Loading config file /data/enoceanmqtt.conf Traceback (most recent call last): File "/usr/bin/enoceanmqtt", line 33, in <module> sys.exit(load_entry_point('enocean-mqtt', 'console_scripts', 'enoceanmqtt')()) File "/app/enocean-mqtt/enoceanmqtt/enoceanmqtt.py", line 111, in main sensors, global_config = load_config_file(conf['config']) File "/app/enocean-mqtt/enoceanmqtt/enoceanmqtt.py", line 56, in load_config_file global_config[key] = config_parser[section][key] File "/usr/lib/python3.10/configparser.py", line 1259, in __getitem__ return self._parser.get(self._name, key) File "/usr/lib/python3.10/configparser.py", line 800, in get return self._interpolation.before_get(self, section, option, value, File "/usr/lib/python3.10/configparser.py", line 395, in before_get self._interpolate_some(parser, option, L, value, section, defaults, 1) File "/usr/lib/python3.10/configparser.py", line 442, in _interpolate_some raise InterpolationSyntaxError( configparser.InterpolationSyntaxError: '%' must be followed by '%' or '(', found: '%h&^3F9oM*RoM' s6-rc: info: service legacy-services: stopping s6-rc: info: service legacy-services successfully stopped s6-rc: info: service legacy-cont-init: stopping s6-rc: info: service legacy-cont-init successfully stopped s6-rc: info: service fix-attrs: stopping s6-rc: info: service fix-attrs successfully stopped s6-rc: info: service s6rc-oneshot-runner: stopping s6-rc: info: service s6rc-oneshot-runner successfully stopped

mak-gitdev commented 1 year ago

It looks like you have error(s) either in the configuration or in the device file. Could you share both please ? Mask any sensitive data before posting. Which version of the addon are you using ?

daschmidt1994 commented 1 year ago

device_file: /config/enoceanmqtt.devices.sample mapping_file: "" log_file: /config/enoceanmqtt.log enocean_port: /dev/serial/by-id/usb-EnOcean_GmbH_EnOcean_USB_300_DD_FT656W80-if00-port0 debug: false log_packets: false mqtt_broker: host: a0d7b954-emqx port: "1883" user: broker pwd: xxxx mqtt_discovery_prefix: homeassistant/ mqtt_prefix: enoceanmqtt/ mqtt_client_id: enocean_gateway mqtt_keepalive: 60

[temperatursensor] address = 0x05194725 rorg = 0xA5 func = 0x04 type = 0x03

mak-gitdev commented 1 year ago

Could you paste it as it is formatted in your files ? Here it looks like there is no formatting. That could be the error

daschmidt1994 commented 1 year ago

https://pastebin.com/0dJWC1bt

https://pastebin.com/NsHSBuTv

mak-gitdev commented 1 year ago

Could you put your mqtt password into single quote and retry ? If you have % character in your password, escape it with another %.

daschmidt1994 commented 1 year ago

yes I have a % in the password. The quote doesen't save. If I set another % it start but get errors. This is the password with the 2. % 4Sc%%h&^3F9oM*RoM

mak-gitdev commented 1 year ago

This is related to the config parser used to parse the configuration file. But I just test it and it should work. I set your password with %% as mine. image It helped me pass the error and then I printed the password as it after the config parser and I got: image

Which errors did you get ? Try without quoting.

daschmidt1994 commented 1 year ago

changed my password to the password without % now it work's

mak-gitdev commented 1 year ago

Fixed by commit f106729