Fibaro HC2 (LUA)
Fibaro HC2 (LUA)
Hier ein paar Infos betreffen der Erstellung eines Virtuellen Modules am Beispiel eines WiFi Modules für den Roomba Staubsauger.
[url][/http://www.siio.de/connected-home/roowi ... mart-home/]
Sicherlich übertragbar auf das Robonect Modul.
[url][/http://www.siio.de/connected-home/roowi ... mart-home/]
Sicherlich übertragbar auf das Robonect Modul.
Re: Fibaro HC2 (LUA)
LUA SCRIPT für Feierabend:
-- Setze Verbindungsdaten
-- hole ip adresse aus virtuellem modul
selfId = fibaro:getSelfId()
mowerIP = fibaro:get(selfId, "IPAddress")
mowerPort = fibaro:get(selfId, "TCPPort")
-- setze variable MOVER aus IP und Logindaten
MOWER = Net.FHttp(mowerIP)
-- -------------------------------------------------
-- -------------------------------------------------
-- geting info about specific device
response = MOWER:GET("/json?cmd=mode&mode=eod")
-- decoding json string to table
result = response;
Fibaro.log(result);
LUA SCRIPT für Auto:
-- Setze Verbindungsdaten
-- hole ip adresse aus virtuellem modul
selfId = fibaro:getSelfId()
mowerIP = fibaro:get(selfId, "IPAddress")
mowerPort = fibaro:get(selfId, "TCPPort")
-- setze variable ROOMBA aus IP und Logindaten
MOWER = Net.FHttp(mowerIP)
-- -------------------------------------------------
-- -------------------------------------------------
-- geting info about specific device
response = MOWER:GET("/json?cmd=mode&mode=Auto")
-- decoding json string to table
result = response;
Fibaro.log(result);
LUA SCRIPT für Stop:
-- Setze Verbindungsdaten
-- hole ip adresse aus virtuellem modul
selfId = fibaro:getSelfId()
mowerIP = fibaro:get(selfId, "IPAddress")
mowerPort = fibaro:get(selfId, "TCPPort")
-- setze variable ROOMBA aus IP und Logindaten
MOWER = Net.FHttp(mowerIP)
-- -------------------------------------------------
-- -------------------------------------------------
-- geting info about specific device
response = MOWER:GET("/json?cmd=Stop")
-- decoding json string to table
result = response;
Fibaro.log(result);
LUA SCRIPT für home:
-- Setze Verbindungsdaten
-- hole ip adresse aus virtuellem modul
selfId = fibaro:getSelfId()
mowerIP = fibaro:get(selfId, "IPAddress")
mowerPort = fibaro:get(selfId, "TCPPort")
-- setze variable ROOMBA aus IP und Logindaten
MOWER = Net.FHttp(mowerIP)
-- -------------------------------------------------
-- -------------------------------------------------
-- geting info about specific device
response = MOWER:GET("/json?cmd=mode&mode=home")
-- decoding json string to table
result = response;
Fibaro.log(result);
LUA SCRIPT für manuell:
-- Setze Verbindungsdaten
-- hole ip adresse aus virtuellem modul
selfId = fibaro:getSelfId()
mowerIP = fibaro:get(selfId, "IPAddress")
mowerPort = fibaro:get(selfId, "TCPPort")
-- setze variable ROOMBA aus IP und Logindaten
MOWER = Net.FHttp(mowerIP)
-- -------------------------------------------------
-- -------------------------------------------------
-- geting info about specific device
response = MOWER:GET("/json?cmd=mode&mode=man")
-- decoding json string to table
result = response;
Fibaro.log(result);
-- Setze Verbindungsdaten
-- hole ip adresse aus virtuellem modul
selfId = fibaro:getSelfId()
mowerIP = fibaro:get(selfId, "IPAddress")
mowerPort = fibaro:get(selfId, "TCPPort")
-- setze variable MOVER aus IP und Logindaten
MOWER = Net.FHttp(mowerIP)
-- -------------------------------------------------
-- -------------------------------------------------
-- geting info about specific device
response = MOWER:GET("/json?cmd=mode&mode=eod")
-- decoding json string to table
result = response;
Fibaro.log(result);
LUA SCRIPT für Auto:
-- Setze Verbindungsdaten
-- hole ip adresse aus virtuellem modul
selfId = fibaro:getSelfId()
mowerIP = fibaro:get(selfId, "IPAddress")
mowerPort = fibaro:get(selfId, "TCPPort")
-- setze variable ROOMBA aus IP und Logindaten
MOWER = Net.FHttp(mowerIP)
-- -------------------------------------------------
-- -------------------------------------------------
-- geting info about specific device
response = MOWER:GET("/json?cmd=mode&mode=Auto")
-- decoding json string to table
result = response;
Fibaro.log(result);
LUA SCRIPT für Stop:
-- Setze Verbindungsdaten
-- hole ip adresse aus virtuellem modul
selfId = fibaro:getSelfId()
mowerIP = fibaro:get(selfId, "IPAddress")
mowerPort = fibaro:get(selfId, "TCPPort")
-- setze variable ROOMBA aus IP und Logindaten
MOWER = Net.FHttp(mowerIP)
-- -------------------------------------------------
-- -------------------------------------------------
-- geting info about specific device
response = MOWER:GET("/json?cmd=Stop")
-- decoding json string to table
result = response;
Fibaro.log(result);
LUA SCRIPT für home:
-- Setze Verbindungsdaten
-- hole ip adresse aus virtuellem modul
selfId = fibaro:getSelfId()
mowerIP = fibaro:get(selfId, "IPAddress")
mowerPort = fibaro:get(selfId, "TCPPort")
-- setze variable ROOMBA aus IP und Logindaten
MOWER = Net.FHttp(mowerIP)
-- -------------------------------------------------
-- -------------------------------------------------
-- geting info about specific device
response = MOWER:GET("/json?cmd=mode&mode=home")
-- decoding json string to table
result = response;
Fibaro.log(result);
LUA SCRIPT für manuell:
-- Setze Verbindungsdaten
-- hole ip adresse aus virtuellem modul
selfId = fibaro:getSelfId()
mowerIP = fibaro:get(selfId, "IPAddress")
mowerPort = fibaro:get(selfId, "TCPPort")
-- setze variable ROOMBA aus IP und Logindaten
MOWER = Net.FHttp(mowerIP)
-- -------------------------------------------------
-- -------------------------------------------------
-- geting info about specific device
response = MOWER:GET("/json?cmd=mode&mode=man")
-- decoding json string to table
result = response;
Fibaro.log(result);
Re: Fibaro HC2 (LUA)
Den Aktuelle Status eures treuen Helfers könnt ihr mit folgenden LUA Befehl abfragen:
Wichtig!!! Es müssen folgende Variablen bei der HC2 hinzugefügt werden:
AM_Status
AM_Mode
AM_Timer
LUA Befehl:
-- Setze Verbindungsdaten
-- hole ip adresse aus virtuellem modul
selfId = fibaro:getSelfId()
mowerIP = fibaro:get(selfId, "IPAddress")
mowerPort = fibaro:get(selfId, "TCPPort")
-- setze variable MOWER aus IP und Logindaten
MOWER = Net.FHttp(mowerIP)
-- -------------------------------------------------
-- -------------------------------------------------
-- geting info about specific device
response = MOWER:GET("/json?cmd=Status")
-- decoding json string to table
extractedjson = json.decode(response)
-- "Status/battery": "Battery Status"
-- "Status/duration": "Mode Duration"
-- "Status/hours": "Hours"
-- "Status/mode": "Mode"
-- "Status/Status": "Status"
-- "Timer/Status": "Timer Status"
battery = extractedjson.Status.battery
duration = extractedjson.Status.duration
hours = extractedjson.Status.hours
AM_Status = extractedjson.Status.Status
AM_Mode = extractedjson.Status.mode
AM_Timer = extractedjson.Timer.Status
fibaro:debug(battery.."%")
fibaro:debug(duration.."s")
fibaro:debug(hours.."h")
fibaro:debug(AM_Status)
fibaro:debug(AM_Mode)
fibaro:debug(AM_Timer)
fibaro:call(selfId, "setProperty", "ui.LabelBatterystatus.value",(battery).." %");
fibaro:call(selfId, "setProperty", "ui.LabelModeDuration.value",(duration).." s");
fibaro:call(selfId, "setProperty", "ui.LabelHours.value",(hours).."h");
fibaro:call(selfId, "setProperty", "ui.LabelMode.value",(AM_Mode));
fibaro:call(selfId, "setProperty", "ui.LabelStatus.value",(AM_Status));
fibaro:call(selfId, "setProperty", "ui.LabelTimer.value",(AM_Timer));
fibaro:debug("Status Auswertung gestartet")
if (AM_Status == 0) then
fibaro:call(selfId, "setProperty", "ui.LabelStatus.value"," Automower schläft");
fibaro:log("Status: Automower schläft")
fibaro:debug("Automower schläft")
elseif (AM_Status == 1) then
fibaro:call(selfId, "setProperty", "ui.LabelStatus.value"," Automower parkt");
fibaro:log("Status: Automower parkt")
fibaro:debug("Automower parkt")
elseif (AM_Status == 2) then
fibaro:call(selfId, "setProperty", "ui.LabelStatus.value"," Automower mäht");
fibaro:log("Status: Automower mäht")
fibaro:debug("Automower mäht")
elseif (AM_Status == 3) then
fibaro:call(selfId, "setProperty", "ui.LabelStatus.value"," Automower sucht die Ladestation");
fibaro:log("Status: Automower sucht die Ladestation")
fibaro:debug("Automower sucht die Ladestation")
elseif (AM_Status == 4) then
fibaro:call(selfId, "setProperty", "ui.LabelStatus.value"," Automower lädt");
fibaro:log("Status: Automower lädt")
fibaro:debug("Automower lädt")
elseif (AM_Status == 5) then
fibaro:call(selfId, "setProperty", "ui.LabelStatus.value"," Automower sucht (manuell umsetzen)");
fibaro:log("Status: Automower sucht (manuell umsetzen)")
fibaro:debug("Automower sucht (manuell umsetzen)")
elseif (AM_Status == 7) then
fibaro:call(selfId, "setProperty", "ui.LabelStatus.value"," Fehlerstatus");
fibaro:log("Status: Fehlerstatus")
fibaro:debug("Fehlerstatus")
elseif (AM_Status == 8) then
fibaro:call(selfId, "setProperty", "ui.LabelStatus.value"," Schleifensignal verloren");
fibaro:log("Status: Automower Schleifensignal verloren")
fibaro:debug("Automower Schleifensignal verloren")
else
fibaro:call(selfId, "setProperty", "ui.LabelState.value"," Error");
fibaro:log("Status: Ladefehler")
fibaro:debug("Ladefehler")
end
fibaro:setGlobal("AM_Status", AM_Status);
fibaro:sleep(2000);
fibaro:debug("Modus Auswertung gestartet")
if (AM_Mode == 0) then
fibaro:call(selfId, "setProperty", "ui.LabelMode.value"," Auto");
fibaro:log("Mode: Auto")
fibaro:debug("Auto")
elseif (AM_Mode == 1) then
fibaro:call(selfId, "setProperty", "ui.LabelMode.value"," manuell");
fibaro:log("Mode: manuell")
fibaro:debug("manuell")
elseif (AM_Mode == 2) then
fibaro:call(selfId, "setProperty", "ui.LabelMode.value"," home");
fibaro:log("Mode: home")
fibaro:debug("home")
else
fibaro:call(selfId, "setProperty", "ui.LabelMode.value"," Error");
fibaro:log("Mode: Fehler")
fibaro:debug("Fehler")
end
fibaro:setGlobal("AM_Mode", AM_Mode);
fibaro:sleep(2000);
fibaro:debug("Timer Auswertung gestartet")
if (AM_Timer == 0) then
fibaro:call(selfId, "setProperty", "ui.LabelTimer.value"," Deaktiviert");
fibaro:log("Timer: Deaktiviert")
fibaro:debug("Deaktiviert")
elseif (AM_Timer == 1) then
fibaro:call(selfId, "setProperty", "ui.LabelTimer.value"," Auto");
fibaro:log("Timer: Auto")
fibaro:debug("Auto")
elseif (AM_Timer == 2) then
fibaro:call(selfId, "setProperty", "ui.LabelTimer.value"," Standby");
fibaro:log("Timer: Standby")
fibaro:debug("Standby")
else
fibaro:call(selfId, "setProperty", "ui.LabelTimer.value"," Error");
fibaro:log("Timer: Fehler")
fibaro:debug("Fehler")
end
fibaro:setGlobal("AM_Timer", AM_Timer);
Wichtig!!! Es müssen folgende Variablen bei der HC2 hinzugefügt werden:
AM_Status
AM_Mode
AM_Timer
LUA Befehl:
-- Setze Verbindungsdaten
-- hole ip adresse aus virtuellem modul
selfId = fibaro:getSelfId()
mowerIP = fibaro:get(selfId, "IPAddress")
mowerPort = fibaro:get(selfId, "TCPPort")
-- setze variable MOWER aus IP und Logindaten
MOWER = Net.FHttp(mowerIP)
-- -------------------------------------------------
-- -------------------------------------------------
-- geting info about specific device
response = MOWER:GET("/json?cmd=Status")
-- decoding json string to table
extractedjson = json.decode(response)
-- "Status/battery": "Battery Status"
-- "Status/duration": "Mode Duration"
-- "Status/hours": "Hours"
-- "Status/mode": "Mode"
-- "Status/Status": "Status"
-- "Timer/Status": "Timer Status"
battery = extractedjson.Status.battery
duration = extractedjson.Status.duration
hours = extractedjson.Status.hours
AM_Status = extractedjson.Status.Status
AM_Mode = extractedjson.Status.mode
AM_Timer = extractedjson.Timer.Status
fibaro:debug(battery.."%")
fibaro:debug(duration.."s")
fibaro:debug(hours.."h")
fibaro:debug(AM_Status)
fibaro:debug(AM_Mode)
fibaro:debug(AM_Timer)
fibaro:call(selfId, "setProperty", "ui.LabelBatterystatus.value",(battery).." %");
fibaro:call(selfId, "setProperty", "ui.LabelModeDuration.value",(duration).." s");
fibaro:call(selfId, "setProperty", "ui.LabelHours.value",(hours).."h");
fibaro:call(selfId, "setProperty", "ui.LabelMode.value",(AM_Mode));
fibaro:call(selfId, "setProperty", "ui.LabelStatus.value",(AM_Status));
fibaro:call(selfId, "setProperty", "ui.LabelTimer.value",(AM_Timer));
fibaro:debug("Status Auswertung gestartet")
if (AM_Status == 0) then
fibaro:call(selfId, "setProperty", "ui.LabelStatus.value"," Automower schläft");
fibaro:log("Status: Automower schläft")
fibaro:debug("Automower schläft")
elseif (AM_Status == 1) then
fibaro:call(selfId, "setProperty", "ui.LabelStatus.value"," Automower parkt");
fibaro:log("Status: Automower parkt")
fibaro:debug("Automower parkt")
elseif (AM_Status == 2) then
fibaro:call(selfId, "setProperty", "ui.LabelStatus.value"," Automower mäht");
fibaro:log("Status: Automower mäht")
fibaro:debug("Automower mäht")
elseif (AM_Status == 3) then
fibaro:call(selfId, "setProperty", "ui.LabelStatus.value"," Automower sucht die Ladestation");
fibaro:log("Status: Automower sucht die Ladestation")
fibaro:debug("Automower sucht die Ladestation")
elseif (AM_Status == 4) then
fibaro:call(selfId, "setProperty", "ui.LabelStatus.value"," Automower lädt");
fibaro:log("Status: Automower lädt")
fibaro:debug("Automower lädt")
elseif (AM_Status == 5) then
fibaro:call(selfId, "setProperty", "ui.LabelStatus.value"," Automower sucht (manuell umsetzen)");
fibaro:log("Status: Automower sucht (manuell umsetzen)")
fibaro:debug("Automower sucht (manuell umsetzen)")
elseif (AM_Status == 7) then
fibaro:call(selfId, "setProperty", "ui.LabelStatus.value"," Fehlerstatus");
fibaro:log("Status: Fehlerstatus")
fibaro:debug("Fehlerstatus")
elseif (AM_Status == 8) then
fibaro:call(selfId, "setProperty", "ui.LabelStatus.value"," Schleifensignal verloren");
fibaro:log("Status: Automower Schleifensignal verloren")
fibaro:debug("Automower Schleifensignal verloren")
else
fibaro:call(selfId, "setProperty", "ui.LabelState.value"," Error");
fibaro:log("Status: Ladefehler")
fibaro:debug("Ladefehler")
end
fibaro:setGlobal("AM_Status", AM_Status);
fibaro:sleep(2000);
fibaro:debug("Modus Auswertung gestartet")
if (AM_Mode == 0) then
fibaro:call(selfId, "setProperty", "ui.LabelMode.value"," Auto");
fibaro:log("Mode: Auto")
fibaro:debug("Auto")
elseif (AM_Mode == 1) then
fibaro:call(selfId, "setProperty", "ui.LabelMode.value"," manuell");
fibaro:log("Mode: manuell")
fibaro:debug("manuell")
elseif (AM_Mode == 2) then
fibaro:call(selfId, "setProperty", "ui.LabelMode.value"," home");
fibaro:log("Mode: home")
fibaro:debug("home")
else
fibaro:call(selfId, "setProperty", "ui.LabelMode.value"," Error");
fibaro:log("Mode: Fehler")
fibaro:debug("Fehler")
end
fibaro:setGlobal("AM_Mode", AM_Mode);
fibaro:sleep(2000);
fibaro:debug("Timer Auswertung gestartet")
if (AM_Timer == 0) then
fibaro:call(selfId, "setProperty", "ui.LabelTimer.value"," Deaktiviert");
fibaro:log("Timer: Deaktiviert")
fibaro:debug("Deaktiviert")
elseif (AM_Timer == 1) then
fibaro:call(selfId, "setProperty", "ui.LabelTimer.value"," Auto");
fibaro:log("Timer: Auto")
fibaro:debug("Auto")
elseif (AM_Timer == 2) then
fibaro:call(selfId, "setProperty", "ui.LabelTimer.value"," Standby");
fibaro:log("Timer: Standby")
fibaro:debug("Standby")
else
fibaro:call(selfId, "setProperty", "ui.LabelTimer.value"," Error");
fibaro:log("Timer: Fehler")
fibaro:debug("Fehler")
end
fibaro:setGlobal("AM_Timer", AM_Timer);
Re: Fibaro HC2 (LUA)
Code: Alles auswählen
-- Setze Verbindungsdaten
-- hole ip adresse aus virtuellem modul
selfId = fibaro:getSelfId()
mowerIP = fibaro:get(selfId, "IPAddress")
mowerPort = fibaro:get(selfId, "TCPPort")
-- setze variable MOWER aus IP und Logindaten
MOWER = Net.FHttp(mowerIP)
-- -------------------------------------------------
-- -------------------------------------------------
-- geting info about specific device
response = MOWER:GET("/json?cmd=status")
-- decoding json string to table
extractedjson = json.decode(response)
-- "status/battery": "Battery Status"
-- "status/duration": "Mode Duration"
-- "status/hours": "Hours"
-- "status/mode": "Mode"
-- "status/status": "Status"
-- "timer/status": "Timer Status"
battery = extractedjson.status.battery
duration = extractedjson.status.duration
hours = extractedjson.status.hours
AM_Status = extractedjson.status.status
AM_Mode = extractedjson.status.mode
AM_Timer = extractedjson.timer.status
fibaro:debug(battery.."%")
fibaro:debug(duration.."s")
fibaro:debug(hours.."h")
fibaro:debug(AM_Status)
fibaro:debug(AM_Mode)
fibaro:debug(AM_Timer)
fibaro:call(selfId, "setProperty", "ui.LabelBatterystatus.value",(battery).." %");
fibaro:call(selfId, "setProperty", "ui.LabelModeDuration.value",(duration).." s");
fibaro:call(selfId, "setProperty", "ui.LabelHours.value",(hours).."h");
fibaro:call(selfId, "setProperty", "ui.LabelMode.value",(AM_Mode));
fibaro:call(selfId, "setProperty", "ui.LabelStatus.value",(AM_Status));
fibaro:call(selfId, "setProperty", "ui.LabelTimer.value",(AM_Timer));
fibaro:debug("Status Auswertung gestartet")
if (AM_Status == 0) then
fibaro:call(selfId, "setProperty", "ui.LabelStatus.value"," Automower schläft");
fibaro:log("Status: Automower schläft")
fibaro:debug("Automower schläft")
elseif (AM_Status == 1) then
fibaro:call(selfId, "setProperty", "ui.LabelStatus.value"," Automower parkt");
fibaro:log("Status: Automower parkt")
fibaro:debug("Automower parkt")
elseif (AM_Status == 2) then
fibaro:call(selfId, "setProperty", "ui.LabelStatus.value"," Automower mäht");
fibaro:log("Status: Automower mäht")
fibaro:debug("Automower mäht")
elseif (AM_Status == 3) then
fibaro:call(selfId, "setProperty", "ui.LabelStatus.value"," Automower sucht die Ladestation");
fibaro:log("Status: Automower sucht die Ladestation")
fibaro:debug("Automower sucht die Ladestation")
elseif (AM_Status == 4) then
fibaro:call(selfId, "setProperty", "ui.LabelStatus.value"," Automower lädt");
fibaro:log("Status: Automower lädt")
fibaro:debug("Automower lädt")
elseif (AM_Status == 5) then
fibaro:call(selfId, "setProperty", "ui.LabelStatus.value"," Automower sucht (manuell umsetzen)");
fibaro:log("Status: Automower sucht (manuell umsetzen)")
fibaro:debug("Automower sucht (manuell umsetzen)")
elseif (AM_Status == 7) then
fibaro:call(selfId, "setProperty", "ui.LabelStatus.value"," Fehlerstatus");
fibaro:log("Status: Fehlerstatus")
fibaro:debug("Fehlerstatus")
elseif (AM_Status == 8) then
fibaro:call(selfId, "setProperty", "ui.LabelStatus.value"," Schleifensignal verloren");
fibaro:log("Status: Automower Schleifensignal verloren")
fibaro:debug("Automower Schleifensignal verloren")
else
fibaro:call(selfId, "setProperty", "ui.LabelState.value"," Error");
fibaro:log("Status: Ladefehler")
fibaro:debug("Ladefehler")
end
fibaro:setGlobal("AM_Status", AM_Status);
fibaro:sleep(2000);
fibaro:debug("Modus Auswertung gestartet")
if (AM_Mode == 0) then
fibaro:call(selfId, "setProperty", "ui.LabelMode.value"," Auto");
fibaro:log("Mode: Auto")
fibaro:debug("Auto")
elseif (AM_Mode == 1) then
fibaro:call(selfId, "setProperty", "ui.LabelMode.value"," Manuell");
fibaro:log("Mode: Manuell")
fibaro:debug("Manuell")
elseif (AM_Mode == 2) then
fibaro:call(selfId, "setProperty", "ui.LabelMode.value"," Home");
fibaro:log("Mode: Home")
fibaro:debug("Home")
else
fibaro:call(selfId, "setProperty", "ui.LabelMode.value"," Error");
fibaro:log("Mode: Fehler")
fibaro:debug("Fehler")
end
fibaro:setGlobal("AM_Mode", AM_Mode);
fibaro:sleep(2000);
fibaro:debug("Timer Auswertung gestartet")
if (AM_Timer == 0) then
fibaro:call(selfId, "setProperty", "ui.LabelTimer.value"," Deaktiviert");
fibaro:log("Timer: Deaktiviert")
fibaro:debug("Deaktiviert")
elseif (AM_Timer == 1) then
fibaro:call(selfId, "setProperty", "ui.LabelTimer.value"," Auto");
fibaro:log("Timer: Auto")
fibaro:debug("Auto")
elseif (AM_Timer == 2) then
fibaro:call(selfId, "setProperty", "ui.LabelTimer.value"," Standby");
fibaro:log("Timer: Standby")
fibaro:debug("Standby")
else
fibaro:call(selfId, "setProperty", "ui.LabelTimer.value"," Error");
fibaro:log("Timer: Fehler")
fibaro:debug("Fehler")
end
fibaro:setGlobal("AM_Timer", AM_Timer);
Re: Fibaro HC2 (LUA)
Unter folgender URL findet ihr einen Link zu dem Fertigen Virtual Device, welches ihr direkt in eure HC2 einfügen könnt.
https://www.dropbox.com/s/tia73sx1wewnl ... .json?dl=0
Jetzt nur noch die IP-Adresse eures H30x Modules eingeben unter: "IP Adresse" und den Port 80 unter: "TCP Port" dann geht das los.
https://www.dropbox.com/s/tia73sx1wewnl ... .json?dl=0
Jetzt nur noch die IP-Adresse eures H30x Modules eingeben unter: "IP Adresse" und den Port 80 unter: "TCP Port" dann geht das los.
Re: Fibaro HC2 (LUA)
Bild siehe hier:
- Dateianhänge
-
- Bildschirmfoto 2016-06-25 um 02.43.06.png (47.77 KiB) 7882 mal betrachtet
Re: Fibaro HC2 (LUA)
Noch eine kleine Information am Rande, der Status des Automower wird nur über das betätigen der "Status" taste im VD aktualisiert und auch nur wenn das H30x im WLAN erreichbar ist.
Falls es nicht erreichbar ist, z.b wenn der Timer inaktiv ist und der Mower Schläft, dann wird nach einer längeren Unterbrechung erst alle 30 min abgefragt.
Falls ihr den Status abfragen möchtet dann muss nur der Inhalt des folgenden LUA Befehls in die "Primäre Schleife" des VD`s eingefügt werden:
fibaro:debug('Starte PING')
local IP = '192.168.178.....'
local PORT = 80
local versuche = 3
local iconOFFLINE = "680" -- ANPASSEN; Gerät ist offline
local iconONLINE = "678" -- ANPASSEN; Gerät ist online
local iconCHECK = "679" -- ANPASSEN; Gerät wird angepingt
local function _ping(retry)
fibaro:call(fibaro:getSelfId(), "setProperty", "currentIcon", iconCHECK)
retry = retry or 0
local tcpSocket = Net.FTcpSocket(IP, PORT)
tcpSocket:setReadTimeout(250)
fibaro:debug('Suche..., versuche #' .. retry .. ' bitte warten...')
fibaro:sleep(250)
local bytes, errorCode = tcpSocket:write('ping')
if errorCode == 0 then
return true
else
if retry < versuche then
fibaro:debug('Nicht gefunden, erneut versuchen, bitte warten...')
fibaro:sleep(1000);
return _ping(retry + 1)
end
return false
end
end
local f, result = pcall(_ping)
if (f) then
if (result == true) and (fibaro:getGlobalValue("Variable_AM_Timer") == "Aktiv" ) then
fibaro:debug(IP.. ':' .. PORT .. ' wurde gefunden, der Timer Status des Automower 315 is Aktiv')
fibaro:call(890, "setProperty", "currentIcon", iconONLINE);
fibaro:debug("Status wird abgefragt");
fibaro:call(878, "pressButton", "6");
fibaro:debug("Status wurde abgefragt, warte für 2 Minuten");
fibaro:sleep(120000)
elseif (result == true) and (fibaro:getGlobalValue("Variable_AM_Timer") == "Stand-By" ) then
fibaro:debug(IP.. ':' .. PORT .. ' wurde gefunden, der Timer Status des Automower 315 ist Stand-By')
fibaro:call(890, "setProperty", "currentIcon", iconONLINE);
fibaro:debug("Status wird abgefragt");
fibaro:call(878, "pressButton", "6");
fibaro:debug("Status wurde abgefragt, warte für 30 Minuten");
fibaro:sleep(1800000)
elseif (result == true) and (fibaro:getGlobalValue("Variable_AM_Timer") == "Deaktiviert" ) then
fibaro:debug(IP.. ':' .. PORT .. ' wurde gefunden, der Timer Status des Automower 315 ist Deaktiviert')
fibaro:call(890, "setProperty", "currentIcon", iconONLINE);
fibaro:debug("Status wird abgefragt");
fibaro:call(878, "pressButton", "6");
fibaro:debug("Status wurde abgefragt, warte für 30 Minuten");
fibaro:sleep(1800000)
elseif (result == true) and (fibaro:getGlobalValue("Variable_AM_Timer") == "manuell" ) then
fibaro:debug(IP.. ':' .. PORT .. ' wurde gefunden, der Timer Status des Automower 315 ist manuell')
fibaro:call(890, "setProperty", "currentIcon", iconONLINE);
fibaro:debug("Status wird abgefragt");
fibaro:call(878, "pressButton", "6");
fibaro:debug("Status wurde abgefragt, warte für 10 Minuten");
fibaro:sleep(600000)
else
fibaro:debug(IP.. ':' .. PORT .. ' wurde nicht gefunden.')
fibaro:call(fibaro:getSelfId(), "setProperty", "currentIcon", iconOFFLINE)
fibaro:call(890, "setProperty", "currentIcon", iconOFFLINE);
fibaro:debug("Status des Automower wird aufgrund mangelnder Erreichbarkeit nicht abgefragt")
fibaro:debug("Status wurde nicht abgefragt, warte für 10 Minuten)");
fibaro:sleep(600000)
end
else
fibaro:debug('Error: ' .. f)
end
Info:
Dabei müssen noch die ID`s (878, 890) angepasst werden!!
Sowie die:
ocal iconOFFLINE = "680" -- ANPASSEN; Gerät ist offline
local iconONLINE = "678" -- ANPASSEN; Gerät ist online
local iconCHECK = "679" -- ANPASSEN; Gerät wird angelangt
ID`s
siehe Silo Forum:
http://www.siio.de/connected-home/klein ... abpruefen/
Somit:
Überprüfe ich zuerst ob der Automower erreichbar ist und dann wird entschieden wie oft er abgefragt wird!!!
Wenn erreichbar dann alle 2 Minuten bei aktiven Timer
Wenn erreichbar dann alle 10 Minuten bei Deaktivierten Timer
Wenn nicht erreichbar, dann alle 30 Minuten
Falls es nicht erreichbar ist, z.b wenn der Timer inaktiv ist und der Mower Schläft, dann wird nach einer längeren Unterbrechung erst alle 30 min abgefragt.
Falls ihr den Status abfragen möchtet dann muss nur der Inhalt des folgenden LUA Befehls in die "Primäre Schleife" des VD`s eingefügt werden:
fibaro:debug('Starte PING')
local IP = '192.168.178.....'
local PORT = 80
local versuche = 3
local iconOFFLINE = "680" -- ANPASSEN; Gerät ist offline
local iconONLINE = "678" -- ANPASSEN; Gerät ist online
local iconCHECK = "679" -- ANPASSEN; Gerät wird angepingt
local function _ping(retry)
fibaro:call(fibaro:getSelfId(), "setProperty", "currentIcon", iconCHECK)
retry = retry or 0
local tcpSocket = Net.FTcpSocket(IP, PORT)
tcpSocket:setReadTimeout(250)
fibaro:debug('Suche..., versuche #' .. retry .. ' bitte warten...')
fibaro:sleep(250)
local bytes, errorCode = tcpSocket:write('ping')
if errorCode == 0 then
return true
else
if retry < versuche then
fibaro:debug('Nicht gefunden, erneut versuchen, bitte warten...')
fibaro:sleep(1000);
return _ping(retry + 1)
end
return false
end
end
local f, result = pcall(_ping)
if (f) then
if (result == true) and (fibaro:getGlobalValue("Variable_AM_Timer") == "Aktiv" ) then
fibaro:debug(IP.. ':' .. PORT .. ' wurde gefunden, der Timer Status des Automower 315 is Aktiv')
fibaro:call(890, "setProperty", "currentIcon", iconONLINE);
fibaro:debug("Status wird abgefragt");
fibaro:call(878, "pressButton", "6");
fibaro:debug("Status wurde abgefragt, warte für 2 Minuten");
fibaro:sleep(120000)
elseif (result == true) and (fibaro:getGlobalValue("Variable_AM_Timer") == "Stand-By" ) then
fibaro:debug(IP.. ':' .. PORT .. ' wurde gefunden, der Timer Status des Automower 315 ist Stand-By')
fibaro:call(890, "setProperty", "currentIcon", iconONLINE);
fibaro:debug("Status wird abgefragt");
fibaro:call(878, "pressButton", "6");
fibaro:debug("Status wurde abgefragt, warte für 30 Minuten");
fibaro:sleep(1800000)
elseif (result == true) and (fibaro:getGlobalValue("Variable_AM_Timer") == "Deaktiviert" ) then
fibaro:debug(IP.. ':' .. PORT .. ' wurde gefunden, der Timer Status des Automower 315 ist Deaktiviert')
fibaro:call(890, "setProperty", "currentIcon", iconONLINE);
fibaro:debug("Status wird abgefragt");
fibaro:call(878, "pressButton", "6");
fibaro:debug("Status wurde abgefragt, warte für 30 Minuten");
fibaro:sleep(1800000)
elseif (result == true) and (fibaro:getGlobalValue("Variable_AM_Timer") == "manuell" ) then
fibaro:debug(IP.. ':' .. PORT .. ' wurde gefunden, der Timer Status des Automower 315 ist manuell')
fibaro:call(890, "setProperty", "currentIcon", iconONLINE);
fibaro:debug("Status wird abgefragt");
fibaro:call(878, "pressButton", "6");
fibaro:debug("Status wurde abgefragt, warte für 10 Minuten");
fibaro:sleep(600000)
else
fibaro:debug(IP.. ':' .. PORT .. ' wurde nicht gefunden.')
fibaro:call(fibaro:getSelfId(), "setProperty", "currentIcon", iconOFFLINE)
fibaro:call(890, "setProperty", "currentIcon", iconOFFLINE);
fibaro:debug("Status des Automower wird aufgrund mangelnder Erreichbarkeit nicht abgefragt")
fibaro:debug("Status wurde nicht abgefragt, warte für 10 Minuten)");
fibaro:sleep(600000)
end
else
fibaro:debug('Error: ' .. f)
end
Info:
Dabei müssen noch die ID`s (878, 890) angepasst werden!!
Sowie die:
ocal iconOFFLINE = "680" -- ANPASSEN; Gerät ist offline
local iconONLINE = "678" -- ANPASSEN; Gerät ist online
local iconCHECK = "679" -- ANPASSEN; Gerät wird angelangt
ID`s
siehe Silo Forum:
http://www.siio.de/connected-home/klein ... abpruefen/
Somit:
Überprüfe ich zuerst ob der Automower erreichbar ist und dann wird entschieden wie oft er abgefragt wird!!!
Wenn erreichbar dann alle 2 Minuten bei aktiven Timer
Wenn erreichbar dann alle 10 Minuten bei Deaktivierten Timer
Wenn nicht erreichbar, dann alle 30 Minuten
-
- Forum-Nutzer
- Beiträge: 28
- Registriert: Mo 4. Apr 2016, 07:32
- Wohnort: Wesel
- Mäher: Gardena smart SILENO+
- Firmware des Mähers (MSW): MSW 7.xx.xx
- Herstellungsjahr: 2016
- Robonect-Modul: Robonect Hx (Rev.3)
- Robonect Firmware: 0.0
Re: Fibaro HC2 (LUA)
Hi,
wie ist das denn mit User und Password für den Zugriff auf Robonect ?
Grüße, Axel
wie ist das denn mit User und Password für den Zugriff auf Robonect ?
Grüße, Axel
Re: Fibaro HC2 (LUA)
Hallo Alex,axbl hat geschrieben:Hi,
wie ist das denn mit User und Password für den Zugriff auf Robonect ?
Grüße, Axel
Wenn der Automower im selben Netzwerk ist und du ihn mit IP Adresse ansprichst benötigt man keinen USER oder PASSWORT...
Grüße Jens