joba-1 / Tasmoticz

Domoticz MQTT autodiscovery plugin for Tasmota devices
MIT License
24 stars 18 forks source link

More than 255 devices error -> filtering ? #39

Closed jcbraem closed 1 year ago

jcbraem commented 1 year ago

Hello, I have this error : "Error: CPlugin:CDevice_init, illegal Unit number (-1), valid values range from 1 to 255." and my Domoticz is dead. Probably is due to a to many number of device into my Domoticz.

I use your plugin for only one device Shelly EM with 2 sensors because this is not supported by Tasmota/Domoticz standart interface. Your plugin give an very good result !!

I see into API Domoticz an native limitation to 255 devices.

To avoid this bug (and dead of Domoticz!), it's is possible to make an filter with topic name to chose the device included or excluded ? (like default sonoff filtering !)

Thanks.

joba-1 commented 1 year ago

A whitelist regular expression as hardware parameter should be possible. I‘ll think about it.

joba-1 commented 1 year ago

Have you checked with the domoticz author/forum if there is way around this limit ? Maybe there is a better way than this workaround

jcbraem commented 1 year ago

According to my research, the limit at 255 is a limit that will not be changed because of compatibility with all existing plugins.

The whitelist would be a very interesting solution (with several values and wildcard to have an perfect solution !)

Thanks in advance

jcbraem commented 1 year ago

With this filtering, finally, your plugin bypass the 255 devices limit. Only need an logic for names and/of topics and with several instances, the sky is your limit :)

jcbraem commented 1 year ago

Hello, I have found this link for one other plugin with the same issue but solved : https://github.com/stas-demydiuk/domoticz-zigbee2mqtt-plugin/issues/325

When I see the Wiki for plugin I see now two framework type : (https://www.domoticz.com/wiki/Developing_a_Python_plugin)

Plugin Framework types There are current two variations of the Plugin Framework available, plugin authors can use either but not both at the same time:

Legacy Framework: This has been stable for several years, invoked by importing 'Domoticz' into the plugin Extended Framework: Built on Legacy Framework but has a new object model and event localisation Invoked by importing 'DomoticzEx' into the plugin. Creates a two layer mapping over the DeviceStatus table of Devices and Units Plugins are not restricted to 256 Units (each Device can have 256 Units)

I don't understand this ... but the "Extended Framework" is one possibility for your plugin ?

Thank you

joba-1 commented 1 year ago

Moving to a new framework is too much effort for me. Would take ages. But there is hope:

Just to be sure I understand correctly: you have tasmota devices that create more than 255 tasmoticz switches or sensors in domoticz, but you just want to use one of them?

Couldn't you just use my already available subscriptions filter hardware setting? Just use the fixed topic of your device that you are interested in (or a pattern, if you need more flexibility) as subscriptions filter.

I haven't used this feature for a long time (and then just for some backward compatibility within tasmota). But it's worth a try. Maybe the sky is no limit already... :)

jcbraem commented 1 year ago

Hello,

I understand about the new framework and the effort about this !

About your view of my issue it is exactly this ! Many electrical plug and Sonoff Pow/Mini/... with always several sensors : 10 for somes devices and finally more than 255. With Tasmota and Domoticz parameters I have all informations correctly (but manually) except pour one Shelly EM with 2 channels, it is not possible in Tasmota firmware. I have try the standart Domoticz MQTT explorer without good result. Your plugin is perfect, directly the good result !

You spoke about a filtering already set in your plugin. Sorry I don't see. It is an parameter ? (like "sonoff" default filter ? In file or GUI?)

I'am able to focus the MQTT topic for this device only and go to the sky with this filtering :)

Thanks

joba-1 commented 1 year ago

You find it in domoticz hardware menu, where you initially added the Tasmoticz plugin. Select the plugin on the hardware page and you see the options below. One are the mqtt topic subscriptions this plugin instance will care about. Make that pattern more specific… Interesting usecase - I’d like to know if it works as intended :)

jcbraem commented 1 year ago

Hello,

Many thanks, you proposal is effectively an filter for take only (in my case) one device. I have try with several devices with separator '|' and it is also OK.

PS : I have found the topic name with MQTT explorer and I have the prefix 'tele/' before the MQTT name put in Tasmota, I don't understand why but with this it's OK.

This issue is solved. Have you need some others tests or informations before closing ?

joba-1 commented 1 year ago

no need from my side. Glad to hear I did something not only useful for me :)