Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Domoticz Plugin
#1
Hello,

Can you please update your Plug-in for domoticz to add support for KC868-A16?

I've been added with MQTT but i have many loop problems! If anybody have added Kincony products with mqtt . pls help me to make it working without toggle loops?
Reply
#2
KC868-A16 download KCS v2 firmware, it already support MQTT.
Reply
#3
(10-13-2023, 11:19 PM)admin Wrote: KC868-A16 download KCS v2 firmware, it already support MQTT.

yes is correct! But have you any way to supress loops On/Off!?!?

1- When i send a command to enable output by click on button in domoticz (i have one script in events pane to trigger the actions)
2- Domoticz send command directly to the correct mqtt topic regarding my panel (not Node-red command)
3- the panel receive the MQTT command and enable the output
4- The panel send all status by mqtt to broker
5- the Node-red receive info from broker
6- The Node-Red send update to domoticz device for all inputs and outputs

This work fine to enable and disable device from domoticz. After that, when one input trigger one output (with fttt rule):
1- the panel enable the output
2- The panel send all status by mqtt to broker
3- the Node-red receive info from broker
4- The Node-Red send update to domoticz device for all inputs and outputs
5- the domoticz seems to be send again again one command
6- after that, the panel off the output and the cycle is repeated in loop state and repeat on-off-on.... each 3 seconds

When i use Node-Red to enable output, the comportement is poor because domoticz send new state each time in domoticz/out topic and the comportement is the same

! i thy to making some adjustments to my scripts but this is verry hard to resolve and prevent loop!
It is possible for you to:
1- add possibility in KCS (toggle button on web UI) for remove sending all mqtt status for all I/O each time one have changed?
2- any way to prevent loop toggle locking 
3- add any way to send custom message in a custom topic in mqtt protocol (with this i canot need to use node-red and act directly with domoticz)


In other way, i maked by myself with esp8266 smart devices communicating with domoticz using mqtt where i have created all code and i do not have this comportement!

Here my script in domoticz Events to send commandes for pane: (similar to my custom ESP8266 nodes)
Code:
-- Variables Locales                                                                                                                              //
ScriptName      = "Kincony - Garage - Commandes"
NodeTopicName   = "KC868_A16/90380CA438B0/SET";
NodeName        = "Kincony - Garage";
IdxTxtInfo      = "203";
Heure_Actuelle  = os.date("%X");
TempoNonReact   = 7;                                -- Tempo durant lequel on ne fait rien avec ce script

--Do1
VarNameToScrut1  =   "Gar-o1 - Lumiere Intérieur Min";
Do1OnStr  = '\'{\"output01\":{\"value\":true}}\'';
Do1OffStr = '\'{\"output01\":{\"value\":false}}\'';
--Do15
VarNameToScrut15  =   "Gar-o15";
Do15OnStr  = '\'{\"output15\":{\"value\":true}}\'';
Do15OffStr = '\'{\"output15\":{\"value\":false}}\'';
--Do16
VarNameToScrut16 =   "Gar-o16";
Do16OnStr  = '{"output16":{"value":true}}';
Do16OffStr = '{"output16":{"value":false}}';

--//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
--//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
--                                                                                                                                                //
-- Fonctions                                                                                                                                      //
--//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
--                                                                                                                                                //
--  Cette fonction retourne le temps en secondes depuis le dernier changement de la variable passée en argument                                   //
--                                                                                                                                                //


function timeSecondDifference(d)
   s = otherdevices_lastupdate[d]
   print(ScriptName.. " L162: otherdevices_lastupdate était à ".. otherdevices_lastupdate[d] .." pour la variable " .. d);
   year = string.sub(s, 1, 4)
   month = string.sub(s, 6, 7)
   day = string.sub(s, 9, 10)
   hour = string.sub(s, 12, 13)
   minutes = string.sub(s, 15, 16)
   seconds = string.sub(s, 18, 19)
   t1 = os.time()
   t2 = os.time{year=year, month=month, day=day, hour=hour, min=minutes, sec=seconds, mil=000}
   difference = os.difftime (t1, t2)
   return difference
end

--//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
--                                                                                                                                                //
--  Cette fonction Active ou Désactive la variable scrutée que si elle n'a pas été activée dans le temps spécifié                                 //
--
--

function OnOffDevice(VarNameToScruting, NodeMqttTopicName, DoOnStr, DoOffStr, ModuleNodeName)
    --Do12
    if (devicechanged[VarNameToScruting] == 'On') then  -- Détection sur la variable
        if (timeSecondDifference(VarNameToScruting) > TempoNonReact) then -- Ignore la commande si la dernière activation est inférieure a 3 secondes
            print (ScriptName.. " L185: temps depuis la dernière action sur ce device: "..timeSecondDifference(VarNameToScruting))
            print(ScriptName.. " L186: "..ModuleNodeName.." - Commandes : "..VarNameToScruting.." commande "..DoOnStr);
            PrintTextToIdx(VarNameToScruting.." activée",IdxTxtInfo)  -- Envoi du log dans le device Arrosage actuel
           
        print('================= -> Le dispositif est éteint. Execution de: mosquitto_pub -t '..NodeMqttTopicName..' -m "'..DoOnStr..'"')
            os.execute ('mosquitto_pub -t '..NodeMqttTopicName..' -m '..DoOnStr)     -- Commande Mqtt
        end
    end
    if (devicechanged[VarNameToScruting] == 'Off') then  -- Détection sur la variable
        if (timeSecondDifference(VarNameToScruting) > TempoNonReact) then
            print (ScriptName.. " L193: time of off")
            print(timeSecondDifference(VarNameToScruting))
            print(ScriptName.. " L195: ".. ModuleNodeName.." - Commandes : "..VarNameToScruting.." commande "..DoOffStr);
            PrintTextToIdx(VarNameToScruting.." désactivée",IdxTxtInfo)  -- Envoi du log dans le device Arrosage actuel
           
        print('================= -> Le dispositif est éteint. Execution de: mosquitto_pub -t '..NodeMqttTopicName..' -m "'..DoOffStr..'"')
            os.execute ('mosquitto_pub -t '..NodeMqttTopicName..' -m '..DoOffStr)    -- Commande Mqtt
        end
    end
end
commandArray = {}
--Do1
OnOffDevice(VarNameToScrut1, NodeTopicName, Do1OnStr, Do1OffStr, NodeName)
--Do15
OnOffDevice(VarNameToScrut15, NodeTopicName, Do15OnStr, Do15OffStr, NodeName)
--Do16
OnOffDevice(VarNameToScrut16, NodeTopicName, Do16OnStr, Do16OffStr, NodeName)

return commandArray


HEre is my  Node-red commande to update domoticz:
Code:
msg216.payload = { "command": "udevice", "idx": 387, "nvalue": Number(msg.payload.output16.value), "svalue": "", "parse": false };
Reply
#4
Hallo,
I saw that there is a H16 plugin for Domoticz but do you also have the plugin for the KC868-A16?
Thanks.
Reply
#5
H16 plugin also can use for KC868-A16, because they use same tcp protocol. just download KCS firmware to KC868-A16 board, enable "TCP server" protocol in KCS webpage setting.
Reply
#6
Have you any exemple for domoticz and MQTT connection to use it on the right ways??
Reply
#7
here is video tour: https://youtu.be/EX9azTwPQK8
Reply
#8
(07-22-2024, 10:25 PM)admin Wrote: here is video tour: https://youtu.be/EX9azTwPQK8

Thanks but this is not implemented with mqtt directly in domoticz! have you other docs ?
Reply
#9
sorry, no others docs for domoticz. we mainly use for home assistant.
Reply
#10
       
(07-17-2024, 09:36 AM)admin Wrote: H16 plugin also can use for KC868-A16, because they use same tcp protocol. just download KCS firmware to KC868-A16 board, enable "TCP server" protocol in KCS webpage setting.

Well I did install the domoticz plugin. After that I tryed to set the TCP Server at my KC686-A16. But here is no settingspage to do so with the  KC686-A16 like it shows in the instructions. Please advice me.
   
   
Reply


Forum Jump:


Users browsing this thread:
1 Guest(s)