Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Support Snoff MQTT #1228

Open
Subnum12 opened this issue May 20, 2024 · 2 comments
Open

[Feature Request] Support Snoff MQTT #1228

Subnum12 opened this issue May 20, 2024 · 2 comments
Assignees
Labels
ioBroker releated to ioBroker Script

Comments

@Subnum12
Copy link

FEATURE DESCRIPTION

The current NsPanelTs.ts script is relays on standard MQTT Client/Server.

Using Tasmota the snoff mqtt adapter is more comfortable as it does smart processing of mqtt messages. Therefore you find already serialized json objects as single state in the device channel.

grafik

For that reason with Tasmota you do use snoff mqtt client. However for NsPanelTs.ts that's not working.
The script NsPanelTs.ts requires 2 topics:

const NSPanelReceiveTopic: string = 'mqtt.0.SmartHome.NSPanel_1.tele.RESULT';
const NSPanelSendTopic: string = 'mqtt.0.SmartHome.NSPanel_1.cmnd.CustomSend';

With snoff Adapter CustomSend topic can be used and created in same way as already published in documentation as it does not have json content
(btw. option 2 from documentation does not work with standard MQTT Client/Server)

NSPanelReceiveTopic would be available as well, but as it is already de-serialized it does not work with the NsPanelTs.ts. The script try's to parse josn and extract the relevant part of the json message, but snoff adapter does already provide the relevant json part in this object.

ADDITIONAL CONTEXT

It would be nice if you can also support optional snoff mqtt adapter. In fact the script does have everything, in case of snoff it just should not

example: current:

    if (obj.state.val.startsWith('\{"CustomRecv":')) {
        try {
            const json = JSON.parse(obj.state.val);
            const split = json.CustomRecv.split(',');
            if (isSetOptionActive) {
                
                if (split[0] == 'event' && split[1] == 'startup') {

intended:

            const split = obj.state.val(',');
            if (isSetOptionActive) {
                
                if (split[0] == 'event' && split[1] == 'startup') {

PANEL / FIRMWARE VERSION

  • not relevant
@joBr99 joBr99 added the ioBroker releated to ioBroker Script label May 20, 2024
@Armilar
Copy link
Collaborator

Armilar commented May 21, 2024

I think the Sonoff adapter solution has more pitfalls than just the one change.

I'll take a look at it and evaluate it.

It currently works great with the methods of creating the CustomSend as a data point (Example 1) or alternatively with the MQTT Explorer (Example 3) and I don't see any real advantages with the Sonoff adapter.

The future "Sonoff NSPanel Lovelace UI" adapter is in development and solves the MQTT problem with CustomSend independently. An MQTT adapter and also a Sonoff adapter are then no longer needed. In addition, the adapter has a lot of features and is also a lot faster than the current scripts.

https://github.com/ticaki/ioBroker.nspanel-lovelace-ui/tree/main

But I'm still looking at the options for the Sonoff adapter. But it can take a while.

@Subnum12
Copy link
Author

Thanks for quick replay. Actually I do not use snoff adapter because of CustomSend (I do not see an issue with current implementation either, even it must be manually created).

That is just more a general decision to use snoff running many Tasmota devices. As mentioned, it does create automatically any singe topic you find in Tasmota regardless the use case /sensor / multiple sensors /scrips e.g . There is no need to touch anything in iobroker adding additional devices, topics are just there.

Even for NSPanel only, that has no real advantage, as for the script you will only need 2 topics.

The impact is more that now

  1. you have to add an additional MQTT adapter
  2. for that reason you must have a different MQTT configuration on NSPanel compared to any other Tasmota device
  3. most important: you do not get relevant information in the same structure as you do with any other Tasmota device. If you run whatever beside NsPanelTs.ts (e.g. firmware / configuration management / device monitoring) to have same structure of device tree will be essential.

I was not aware of the new adapter. However, if that comes with build in MQTT most probably it will have same behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ioBroker releated to ioBroker Script
Projects
None yet
Development

No branches or pull requests

3 participants