giejay / domoticz-gbridge-plugin

Domoticz plugin for the Kappelt gBridge
16 stars 4 forks source link

Spaces in MQTT topics. #4

Closed peterkappelt closed 5 years ago

peterkappelt commented 5 years ago

Hi Gert-Jan,

is it possible that the domoticz plugin creates MQTT topics containing spaces, if the device name has a space in it?

While checking the logs for a user who had problems with this plugin, i saw (for instance) the topic being "gBridge/uAAA/Living Room Lamp/onoff" for a device called "Living Room Lamp".

Spaces in MQTT topics are usually a really bad idea. They actually should be blocked when editing devices via the web interface, possibly there is something missing in the API.

Could you add a refactoring mechanism, that e.g. replaces the spaces in MQTT topics with underscores (so this would be "gBridge/uAAA/Living_Room_Lamp/onoff")?

giejay commented 5 years ago

Yes it will sync the device topic 'as is' right now, I will update the code to make it sync by domoticz id or replace the spaces by underscores.

giejay commented 5 years ago

The devices are now created by using the index of the device in domoticz as the topic name, so: gBridge/u1/193/onoff instead of gBridge/u1/Dinner Light/onoff. Devices which where created the old way still work.