• Vítejte na XBMC-Kodi.cz
  • Česko-slovenská komunita fanoušků XBMC/Kodi
Vítejte návštevníku! Přihlášení Registrace


Hodnocení tématu:
  • 2 Hlas(ů) - 1.5 Průměr
  • 1
  • 2
  • 3
  • 4
  • 5
Domácí automatizace - bezpečně
@S474N: primárně se snažím vše řešit pomocí běžných node. Je to i preferované řešení komunity okolo tohoto projektu. Ale jak je ti známo, ne vždy to takhle jde a pak si nucen použít funkční node. Na ukázku třeba node pro výpočet pocitové teploty podle kanadského modelu:
Kód:
const T = msg.payload.teplota
const W = msg.payload.vitr

const wc = 13.12 + (0.6215 * T) - (11.37 * W**0.16) + (0.3965 * T * W**0.16)

return { payload: (Math.floor(wc)), topic: "wct" };
node pro české svátky:
Kód:
let d = new Date();
if (d.getMonth() == 0 && d.getDate() == 1) {
    return msg;
}
else if (d.getMonth() == 3 && d.getDate() == 19) {
    return msg;
}
else if (d.getMonth() == 3 && d.getDate() == 22) {
    return msg;
}
else if (d.getMonth() == 4 && d.getDate() == 1) {
    return msg;
}
else if (d.getMonth() == 4 && d.getDate() == 8) {
    return msg;
}
else if (d.getMonth() == 6 && d.getDate() == 5) {
    return msg;
}
else if (d.getMonth() == 6 && d.getDate() == 6) {
    return msg;
}
else if (d.getMonth() == 8 && d.getDate() == 28) {
    return msg;
}
else if (d.getMonth() == 9 && d.getDate() == 28) {
    return msg;
}
else if (d.getMonth() ==10 && d.getDate() == 17) {
    return msg;
}
else if (d.getMonth() == 11 && d.getDate() == 24) {
    return msg;
}
else if (d.getMonth() == 11 && d.getDate() == 25) {
    return msg;
}
else if (d.getMonth() == 11 && d.getDate() == 26) {
    return msg;
}
return null;
node pro časovou značku
Kód:
var today = new Date();
var now = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate()+' '+today.getHours() + ":" + today.getMinutes();
return {payload: now };
node pro třídění podle aktuálního měsíce
Kód:
var today = new Date();
var now = today.getMonth()+1;

if (now == 1) {return[ msg, null, null, null, null, null, null, null, null, null, null, null];}
if (now == 2) {return[ null, msg, null, null, null, null, null, null, null, null, null, null];}
if (now == 3) {return[ null, null, msg, null, null, null, null, null, null, null, null, null];}
if (now == 4) {return[ null, null, null, msg, null, null, null, null, null, null, null, null];}
if (now == 5) {return[ null, null, null, null, msg, null, null, null, null, null, null, null];}
if (now == 6) {return[ null, null, null, null, null, msg, null, null, null, null, null, null];}
if (now == 7) {return[ null, null, null, null, null, null, msg, null, null, null, null, null];}
if (now == 8) {return[ null, null, null, null, null, null, null, msg, null, null, null, null];}
if (now == 9) {return[ null, null, null, null, null, null, null, null, msg, null, null, null];}
if (now == 10) {return[ null, null, null, null, null, null, null, null, null, msg, null, null];}
if (now == 11) {return[ null, null, null, null, null, null, null, null, null, null, msg, null];}
if (now == 12) {return[ null, null, null, null, null, null, null, null, null, null, null, msg];}
atd. Fukcí mám opravdu napsaných na kila. Dokonce jsem v node-red napsal komplet regulaci Ikea žárovky s jejich ovladačem E1524/E1810. Vše z pohledu uživatele funguje jako by byl ovladač spárovaný přímo se žárovkou, ale přitom vše teče přes node-red. Výhodou je plynulá regulace jasu i chromatičnosti oproti řešení Ikea.
 
Citovat
  


Příspěvků v tématu
Domácí automatizace - bezpečně - od Cinda - 10.10.2020, 16:53
Domácí automatizace - bezpečně - od Cinda - 11.10.2020, 12:03
Domácí automatizace - bezpečně - od cuore - 11.10.2020, 13:20
Domácí automatizace - bezpečně - od Cinda - 12.10.2020, 10:31
RE: Domácí automatizace - bezpečně - od cuore - 12.10.2020, 15:45
Domácí automatizace - bezpečně - od Cinda - 17.10.2020, 15:58
Domácí automatizace - bezpečně - od Cinda - 17.10.2020, 19:28
Domácí automatizace - bezpečně - od Cinda - 18.10.2020, 11:16

Přejít na fórum:


Prochází: 5 host(ů)