[Modul] Tasmota

@Kai: Das mit dem Eingang ist auch kein Problem - da finde ich einen Workaround, aber das mit den Shutter-Funktionen wäre schon wichtig - kannst du mich dabei unterstützen ?

Was genau brauchst du denn da?

Grüße,
Kai

Zum einen muss ich ja zumindest hinter die Target-Variable ein Aktions-Script legen, welches über Request-Action einen MQTT-Befehl an den Shelly schickt und zum anderen ist mir nicht klar, warum die Variablen Direction und Position erst mit dem nächsten Logging-Zyklus verändert werden und nicht sofort beim Auslösen am Taster bzw. im Webfront des Shellies.

Hallo Kai,
Danke für deine tollen Module. :smiley:
Wie ein anderer User hier, werde ich mit Fehlermeldungen zugemüllt :frowning:
Teilweise kommt diese Fehlermeldung auch, wenn ich den Tasmota Konfigurator aufrufe.
Falls es hilft, ich habe ein Passwort aus Zahlen beim MQTT Server eingetragen.


Konnte Konfigurationsform nicht laden
<br />
<b>Fatal error</b>:  Uncaught TypeError: json_decode() expects parameter 1 to be string, bool given in /var/lib/symcon/modules/.store/info.schnittcher.ips.tasmota/TasmotaConfigurator/module.php:177
Stack trace:
#0 /var/lib/symcon/modules/.store/info.schnittcher.ips.tasmota/TasmotaConfigurator/module.php(177): json_decode(false, true)
#1 /var/lib/symcon/modules/.store/info.schnittcher.ips.tasmota/TasmotaConfigurator/module.php(124): TasmotaConfigurator->getFriendlyName('192.168.1.109')
#2 /var/lib/symcon/modules/.store/info.schnittcher.ips.tasmota/TasmotaConfigurator/module.php(28): TasmotaConfigurator->getTasmotaDevices()
#3 /-(3): TasmotaConfigurator->GetConfigurationForm()
#4 {main}
  thrown in <b>/var/lib/symcon/modules/.store/info.schnittcher.ips.tasmota/TasmotaConfigurator/module.php</b> on line <b>177</b><br />
Abort Processing during Fatal-Error: Uncaught TypeError: json_decode() expects parameter 1 to be string, bool given in /var/lib/symcon/modules/.store/info.schnittcher.ips.tasmota/TasmotaConfigurator/module.php:177
Stack trace:
#0 /var/lib/symcon/modules/.store/info.schnittcher.ips.tasmota/TasmotaConfigurator/module.php(177): json_decode(false, true)
#1 /var/lib/symcon/modules/.store/info.schnittcher.ips.tasmota/TasmotaConfigurator/module.php(124): TasmotaConfigurator->getFriendlyName('192.168.1.109')
#2 /var/lib/symcon/modules/.store/info.schnittcher.ips.tasmota/TasmotaConfigurator/module.php(28): TasmotaConfigurator->getTasmotaDevices()
#3 /-(3): TasmotaConfigurator->GetConfigurationForm()
#4 {main}
  thrown
   Error in Script /var/lib/symcon/modules/.store/info.schnittcher.ips.tasmota/TasmotaConfigurator/module.php on Line 177 (Code: -32603)


Hallo,

der Tasmota Konfigurator kann euer IP-Symcon sehr langsam machen.
Ich habe gestern Ewigkeiten damit verbracht, die Ursache zu finden, wieso bei mir alles so extrem langsam ist.

@paresy nochmal vielen Dank für die Unterstützung bis spät Abends! :slight_smile:
Nun konnte ich herausfinden, dass es der Tasmota Konfigurator ist, immer wenn die Konsole offen war, dann gab es Verzögerungen von bis zu 1 - 3 Minuten. Nun habe ich den Konfigurator entfernt und die Verzögerungen sind verschwunden.

Also wer Probleme haben sollte, löscht den Konfigurator erstmal.

Grüße,
Kai

Hallo Kai,

ich habe immer wieder Probleme mit den MQTT Schnittstellen, sowohl Client als auch Server.
Schnittstellen bleiben nicht offen.
Da der Server den Online Status nicht aktualisiert, habe ich die meisten Tasmota wieder auf den Mosquitto (auf gleichem Raspi ) geändert.
Nun ist aber so, dass da auch immer wieder die Verbindung abbricht. Es wechselt ständig zwischen „Schnittstelle ist geöffnet“ und „Schnittstelle ist als fehlerhaft markiert…“.
Im Debug des Client Socket kommt aber kein Fehler sondern nur die Anfragen der Geräte

MQTT Client.txt (15.3 KB)

Den Mosquitto auf dem Raspi neu zu starten, hat nichts geändert.

Gruß

Oliver

Welchen Client nutzt du denn?
Ich würden mittlerweile auf den internen Broker umstellen mit den neuen Versionen von IPS sollte das alles funktionieren.

Grüße,
Kai

Gesendet von iPhone mit Tapatalk

welchen internen Broker?

ich kenne nur MQTT Server (Port 1024) und MQTT Client (Port 1883)

Gruß

Oliver

Nimm mal nur den MQTT Server.

Grüße,
Kai

der machte auch immer wieder Probleme,

Bild vom 09.11.2020

ging eine ganze Zeit so zu und irgendwann ist er wieder eine Weile Stabil gelaufen.

Außerdem klappt das mit die Status der Tasmota Rückmeldung immer noch nicht.

Gruß

Oliver

Hast du die aktuelle IPS Version?

Grüße,
Kai

ja, bin auf 5.5 seit letzter Woche

Da habe ich keine Probleme mehr mit zur Zeit.
Stell vielleicht mal nur ein paar Geräte auf den MQTT Server um.

Grüße,
Kai

Was musst du für einen Befehl abschicken?
Das kannst du mit dieser Funktion machen:

Tasmota_sendMQTTCommand($InstanceID, "TOPIC", "Payload");

Direction und Position werden nicht beim Auslösen des Tasters aktualisiert, weil ich das Result nicht auswerte.

Grüße,
Kai

werde ich ausprobieren.

Problem ist, dass es ja nicht immer und sofort auftritt, sondern sproadisch.

es ist echt aufwändig immer alle Tasmota umzustellen und dauert mit der neuen geliebten Webkonsole auch noch doppelt so lange wie mit der Legacy. habe ca 30 Tasmota Geräte.

Oliver

Hier ein Script für Tasmota und Shelly:


<?php


//IP des MQTT Servers hier hinterlegen
$BrokerIP = '10.10.0.128';
//Port des MQTT Servers hier hinterlegen
$BrokerPort = '1883';
//MQTT Server Instanz ID
$MQTTInstanzID = 57899;


//MQTT Client (Broker NAS)
//$MQTTInstanzID = 53964;


//Geräte mit Passwort für das Webinterface
$Offline = '10.10.20.153 / 10.10.20.170 / 10.10.20.174';



$TasmotaDevicesString = '10.10.20.190 / 10.10.20.191 / 10.10.20.192 / 10.10.20.193 / 10.10.20.180 / 10.10.20.181 / 10.10.20.184 / 10.10.20.185 / 10.10.20.171 / 10.10.20.172 / 10.10.20.173 / 10.10.20.169 / 10.10.20.168 / 10.10.20.150 / 10.10.20.151 / 10.10.20.140';


//Shelly H&T vorher wecken!!!!!
$ShellyDevicesString = '10.10.20.182 / 10.10.20.183 / 10.10.20.175 / 10.10.20.176 / 10.10.20.177 / 10.10.20.152 / 10.10.20.141';


###################################
## Ab hier nichts mehr verändern ##
###################################


$TasmotaDevices = explode(' / ',$TasmotaDevicesString);
$ShellyDevices = explode(' / ',$ShellyDevicesString);


echo 'Tasmota & InLine: ';
foreach ($TasmotaDevices as $Device) {
    $TasmotaURL = file_get_contents('http://'.$Device.'/cm?cmnd=MqttHost%20'.$BrokerIP);
    $Topic = json_decode(file_get_contents('http://'.$Device.'/cm?cmnd=Status 9'),true)['Status']['Topic'];
    $id = searchTasmotaDevice($Topic);
    echo $id. ': Topic: '.$Topic.'<br />';
    if ($id <> 0) {
        setMQTTInstance($id,$MQTTInstanzID);
    }
}
echo '<br />Shelly: ';
foreach ($ShellyDevices as $Device) {
    $ShellyURL = file_get_contents('http://'.$Device.'/settings?mqtt_server='.$BrokerIP.':'.$BrokerPort);
    $Topic = json_decode(file_get_contents('http://'.$Device.'/settings'),true)['mqtt']['id'];
    $id = getShellyInstances($Topic);
    echo $id. ': Topic: '.$Topic.'<br />';
        if ($id <> 0) {
        setMQTTInstance($id,$MQTTInstanzID);
    }
}


function searchTasmotaDevice($topic)
    {
    $idsTasmota = IPS_GetInstanceListByModuleID('{1349F095-4820-4DB8-82EB-C1E93E680F08}');
    $idsTasmotaLed = IPS_GetInstanceListByModuleID('{5466CCED-1DA1-4FD9-9CBD-18E9399EFF42}');
    $idsInLineVentilator = IPS_GetInstanceListByModuleID('{FED26A20-63C1-C83E-776B-37F1851149D3}');
    $idsInLineSteckdosenleiste = IPS_GetInstanceListByModuleID('{7632D264-D55B-EB3B-E940-47FB0E8B00A9}');
    $idsInLineBulb = IPS_GetInstanceListByModuleID('{321A6ABE-394A-897C-E59A-BB4E2FAF5094}');
    $idsInLinePlug = IPS_GetInstanceListByModuleID('{B841B264-0471-ABE4-BC04-D119A18DF328}');
    $idsInLineDiffusor = IPS_GetInstanceListByModuleID('{46B97FD0-FE45-1F63-EB25-05FB93E37BC5}');
    $idsInLineAlarmsirene = IPS_GetInstanceListByModuleID('{AB0F31EB-0CDA-F685-BF85-FBC03F658133}');


    $ids = array_merge($idsTasmota, $idsTasmotaLed, $idsInLineVentilator, $idsInLineSteckdosenleiste, $idsInLineBulb, $idsInLinePlug, $idsInLineDiffusor, $idsInLineAlarmsirene);
        foreach ($ids as $id) {
            if (IPS_GetProperty($id, 'Topic') == $topic) {
                return $id;
            }
        }
        return 0;
    }


function getShellyInstances($Topic)
    {
        $InstanceIDs = [];
        //Shelly1 Instances
        $InstanceIDs[] = IPS_GetInstanceListByModuleID('{9E5FA0B2-AA98-48D5-AE07-78DEA4B0370A}');
        //Shelly 2
        $InstanceIDs[] = IPS_GetInstanceListByModuleID('{BE266877-6642-4A80-9BAA-8C5B3B4DAF80}');
        //Shelly 4Pro
        $InstanceIDs[] = IPS_GetInstanceListByModuleID('{F56CC544-581D-42EB-AAF0-F5E9E908916C}');
        //ShellyDimmer
        $InstanceIDs[] = IPS_GetInstanceListByModuleID('{69B501C7-DCE8-4A4A-910C-D3954473E654}');
        //ShellyEM
        $InstanceIDs[] = IPS_GetInstanceListByModuleID('{53A4EF84-0CF9-44D4-B70E-4B84E0DCE9B3}');
        //Shelly3EM
        $InstanceIDs[] = IPS_GetInstanceListByModuleID('{108ECEFF-642A-4B1F-9608-E592E31DBA11}');
        //ShellyFlood
        $InstanceIDs[] = IPS_GetInstanceListByModuleID('{C360BA67-99A3-4F37-932B-B851D4E10AD6}');
        //ShellyHT
        $InstanceIDs[] = IPS_GetInstanceListByModuleID('{F2EE9948-94F6-4BA6-BDC9-E59E440F3DB0}');
        //ShellyPlug
        $InstanceIDs[] = IPS_GetInstanceListByModuleID('{ED5E1057-C47A-4D73-A130-B4E2912A026C}');
        //ShellyRGBW2
        $InstanceIDs[] = IPS_GetInstanceListByModuleID('{3286C438-2174-E03B-85CE-B6B7C1A685D0}');
        //ShellySense
        $InstanceIDs[] = IPS_GetInstanceListByModuleID('{F86F268B-BC23-41AC-B107-16EEF661A4D7}');
        //ShellySmoke
        $InstanceIDs[] = IPS_GetInstanceListByModuleID('{88A5611C-CD57-4255-9F57-E420CE784C81}');
        //ShellyWindow
        $InstanceIDs[] = IPS_GetInstanceListByModuleID('{24BDCF16-A370-6F72-8CBD-9B9968899FED}');
        //ShellyVintage
        $InstanceIDs[] = IPS_GetInstanceListByModuleID('{9BFE4A38-47C9-775E-A6BE-DA338817A639}');
        foreach ($InstanceIDs as $IDs) {
            foreach ($IDs as $id) {
                if (IPS_GetProperty($id, 'MQTTTopic') == $Topic) {
                    return $id;
                }
            }
        }
        return 0;
    }
        
    function setMQTTInstance($ID, $MQTTInstanceID) {
        IPS_DisconnectInstance($ID);
        IPS_ConnectInstance ($ID,$MQTTInstanceID);
    }

Die IP-Adressen musst du natürlich anpassen.

Grüße,
Kai

[i]Hallo Kai,

ich hab mal mit einem Gerät versucht, da kommt aber nach fast 2 Minuten Laufzeit:

Tasmota & InLine: 28482: Topic: Futterautomat-68
Warning:  Datenfluss ist inkompatibel in /var/lib/symcon/scripts/34596.ips.php on line 127
28482: Topic: Futterautomat-68
Warning:  Instanz #28482 hat kein übergeordnetes Objekt in /var/lib/symcon/scripts/34596.ips.php on line 126

Warning:  Datenfluss ist inkompatibel in /var/lib/symcon/scripts/34596.ips.php on line 127
Shelly: 
Warning:  file_get_contents(http:///settings?mqtt_server=192.168.178.235:1024): failed to open stream: operation failed in /var/lib/symcon/scripts/34596.ips.php on line 52

Warning:  file_get_contents(http:///settings): failed to open stream: operation failed in /var/lib/symcon/scripts/34596.ips.php on line 53

Notice:  Trying to access array offset on value of type null in /var/lib/symcon/scripts/34596.ips.php on line 53

Notice:  Trying to access array offset on value of type null in /var/lib/symcon/scripts/34596.ips.php on line 53
27264: Topic: 
Warning:  Instanz #27264 hat kein übergeordnetes Objekt in /var/lib/symcon/scripts/34596.ips.php on line 126

Warning:  Datenfluss ist inkompatibel in /var/lib/symcon/scripts/34596.ips.php on line 127

bei dem Gerät selbst fehlt danach jeglicher Broker „None“

bei Offline und Shelly (hab ich z. Zt. keine) die IP einfach rausgenommen.
$Offline = ‚‘;
$ShellyDevicesString = ‚‘;
[/i]

Was hast du als Instanz angegeben?
Was steht bei dir in den angegebenen Zeilen?

Grüße,
Kai

Die ID des Server Socket ( MQTT Server)

52 $ShellyURL = file_get_contents(‚http://‘.$Device.’/settings?mqtt_server=’.$BrokerIP.’:’.$BrokerPort);
53 $Topic = json_decode(file_get_contents(‚http://‘.$Device.’/settings’),true)[‚mqtt‘][‚id‘];

126 IPS_DisconnectInstance($ID);
127 IPS_ConnectInstance ($ID,$MQTTInstanceID);

Du musst die ID des Splitters nehmen!


<?php

//IP des MQTT Servers hier hinterlegen
$BrokerIP = '10.10.0.128';
//Port des MQTT Servers hier hinterlegen
$BrokerPort = '1883';
//MQTT Server Instanz ID
$MQTTInstanzID = 57899;

//Geräte mit Passwort für das Webinterface
$Offline = '10.10.20.153 / 10.10.20.170 / 10.10.20.174';

$TasmotaDevicesString = '10.10.20.190 / 10.10.20.191 / 10.10.20.192 / 10.10.20.193 / 10.10.20.180 / 10.10.20.181 / 10.10.20.184 / 10.10.20.185 / 10.10.20.171 / 10.10.20.172 / 10.10.20.173 / 10.10.20.169 / 10.10.20.168 / 10.10.20.150 / 10.10.20.151 / 10.10.20.140';

###################################
## Ab hier nichts mehr verändern ##
###################################

$TasmotaDevices = explode(' / ',$TasmotaDevicesString);
$ShellyDevices = explode(' / ',$ShellyDevicesString);

echo 'Tasmota & InLine: ';
foreach ($TasmotaDevices as $Device) {
    $TasmotaURL = file_get_contents('http://'.$Device.'/cm?cmnd=MqttHost%20'.$BrokerIP);
    $Topic = json_decode(file_get_contents('http://'.$Device.'/cm?cmnd=Status 9'),true)['Status']['Topic'];
    $id = searchTasmotaDevice($Topic);
    echo $id. ': Topic: '.$Topic.'<br />';
    if ($id <> 0) {
        setMQTTInstance($id,$MQTTInstanzID);
    }
}

function searchTasmotaDevice($topic)
    {
    $idsTasmota = IPS_GetInstanceListByModuleID('{1349F095-4820-4DB8-82EB-C1E93E680F08}');
    $idsTasmotaLed = IPS_GetInstanceListByModuleID('{5466CCED-1DA1-4FD9-9CBD-18E9399EFF42}');
    $idsInLineVentilator = IPS_GetInstanceListByModuleID('{FED26A20-63C1-C83E-776B-37F1851149D3}');
    $idsInLineSteckdosenleiste = IPS_GetInstanceListByModuleID('{7632D264-D55B-EB3B-E940-47FB0E8B00A9}');
    $idsInLineBulb = IPS_GetInstanceListByModuleID('{321A6ABE-394A-897C-E59A-BB4E2FAF5094}');
    $idsInLinePlug = IPS_GetInstanceListByModuleID('{B841B264-0471-ABE4-BC04-D119A18DF328}');
    $idsInLineDiffusor = IPS_GetInstanceListByModuleID('{46B97FD0-FE45-1F63-EB25-05FB93E37BC5}');
    $idsInLineAlarmsirene = IPS_GetInstanceListByModuleID('{AB0F31EB-0CDA-F685-BF85-FBC03F658133}');


    $ids = array_merge($idsTasmota, $idsTasmotaLed, $idsInLineVentilator, $idsInLineSteckdosenleiste, $idsInLineBulb, $idsInLinePlug, $idsInLineDiffusor, $idsInLineAlarmsirene);
        foreach ($ids as $id) {
            if (IPS_GetProperty($id, 'Topic') == $topic) {
                return $id;
            }
        }
        return 0;
    }
     
    function setMQTTInstance($ID, $MQTTInstanceID) {
        IPS_DisconnectInstance($ID);
        IPS_ConnectInstance ($ID,$MQTTInstanceID);
    }


Teste es mal damit.
Habe Shelly mal komplett entfernt.

Grüße,
Kai