Skip to content

๐Ÿ† [๋Œ€์ƒ์ž‘] ์ž„๋ฒ ๋””๋“œ ์†Œํ”„ํŠธ์›จ์–ด ๊ฒฝ์ง„๋Œ€ํšŒ webOS๋ถ€๋ฌธ ๋ฐฉํŒŒ์ œํŒ€ - Control ๊ธฐ๋Šฅ & Control Recommend ๊ธฐ๋Šฅ

Notifications You must be signed in to change notification settings

webOS-KOSS/ControlRecommend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

31 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

NoticeAlert

NoticeAlert

์†Œ๊ฐœ

๊ฐ€์ „์ œ์–ด ๊ธฐ๋Šฅ๊ณผ ์•„ํŒŒํŠธ ๋‚ด ์‚ฌ๋žŒ๋“ค๊ณผ ์†Œํ†ต์„ ์œ„ํ•œ ์•„ํŒŒํŠธ ๊ฒŒ์‹œํŒ์œผ๋กœ ์ด๋ฃจ์–ด ์ ธ์žˆ๋‹ค.
๊ฐ€์ „์ œ์–ด์™€ ๊ฐ™์€ ๊ฒฝ์šฐ์—๋Š” ์ด๋ฏธ ์ตœ์‹  ์›”ํŒจ๋“œ์—๋Š” ํƒ‘์žฌ๋˜์–ด ์žˆ์œผ๋ฉฐ ์ฐฝ๋ฌธ, ์กฐ๋ช… ์ œ์–ด์— ๋ธ”๋ผ์ธ๋“œ ์ œ์–ด ๊ธฐ๋Šฅ์„ ๋”ํ•ด์„œ ์›”ํŒจ๋“œ๋กœ ๊ฐ„ํŽธํ•˜๊ฒŒ ์กฐ์ž‘ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ–ˆ์œผ๋ฉฐ, ๊ฐ€์ „์ œ์–ด ๊ธฐ๋Šฅ๊ณผ ์—ฐ๋™๋˜๋Š” ๊ฒŒ์‹œํŒ ๊ธฐ๋Šฅ๋„ ์ถ”๊ฐ€ํ•˜์˜€๋‹ค. ๊ณต์ง€ ๊ฒŒ์‹œํŒ์— ์ž‘์„ฑ๋œ ๊ธ€์€ ์•Œ๋ฆผ์ด ๋– ์„œ ๊ณต์ง€๋ฅผ ๋†“์น˜์ง€ ์•Š๋„๋ก ํ•œ๋‹ค. ๋˜ํ•œ ๊ฑฐ์ฃผ์ž๋ผ๋ฆฌ ์†Œํ†ตํ•  ์ˆ˜ ์žˆ๋Š” ์ผ๋ฐ˜ ๊ฒŒ์‹œํŒ์„ ๋งŒ๋“ค์–ด ์–ผ๊ตด์„ ๋งž๋Œ€๊ณ  ์ด์•ผ๊ธฐ ํ•˜๊ธฐ ๋ถˆํŽธํ•œ ์ ๋“ค์„ ๊ฒŒ์‹œํŒ์„ ํ†ตํ•ด ํ•ด์†Œํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•œ๋‹ค.

Home ++ ์›”ํŒจ๋“œ์˜ ๊ฐ€์ „์ œ์–ด ๊ธฐ๋Šฅ์€ ESP8266(ํƒํŠธ ์Šค์œ„์น˜)๋‚˜ ESP32(์กฐ์ด ์Šคํ‹ฑ)์„ ํ†ตํ•œ ์•„๋‚ ๋กœ๊ทธ ์ œ์–ด์™€ enact์˜ MQTT ํ†ต์‹ ์„ ํ†ตํ•œ ๋””์ง€ํ„ธ ์ œ์–ด๋ฅผ ๋™์‹œ์— ํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋งŒ๋“ค์—ˆ๋‹ค. ๋˜ํ•œ, ๊ด€๋ฆฌ์‚ฌ๋ฌด์†Œ์—์„œ notice ๊ฒŒ์‹œํŒ์— ์˜ฌ๋ฆฌ๊ฒŒ ๋˜๊ณ , ๊ฐ€์ „ ์ œ์–ด ์ถ”์ฒœ์„ ์„ ํƒํ•˜๋ฉด ์•Œ๋ฆผ๊ณผ ํ•จ๊ป˜ Alert๋ฅผ ํ†ตํ•ด์„œ ๊ฐ€์ „ ์ œ์–ด ์ถ”์ฒœ์„ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ์‚ฌ์šฉ์ž๋Š” ์ถ”์ฒœ์— ๋Œ€ํ•ด์„œ Yes์™€ No๋ฅผ ํ†ตํ•ด์„œ ๊ฐ€์ „์ œ์–ด๋ฅผ ์‰ฝ๊ฒŒ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

System Architecture

SystemArchitecture

Flow Chart

FlowChart

๊ธฐ์ˆ  ์†Œ๊ฐœ

AWS EC2(ํด๋ผ์šฐ๋“œ ์„œ๋ฒ„):

  • ๋ณด์•ˆ ๊ทธ๋ฃน์˜ ์ธ๋ฐ”์šด๋“œ ๊ทœ์น™์—์„œ 8080ํฌํŠธ๋ฅผ ๊ฐœ๋ฐฉํ•˜์—ฌ ํฌํŠธ ํฌ์›Œ๋”ฉ์„ ํ•˜์˜€๋‹ค.

  • Express.js(๊ฒŒ์‹œํŒ ์„œ๋ฒ„)
    • ๊ณต์ง€์šฉ Notice ๊ฒŒ์‹œํŒ๊ณผ, ์•„ํŒŒํŠธ ์ฃผ๋ฏผ ์ „์šฉ General ๊ฒŒ์‹œํŒ์ด ์กด์žฌํ•œ๋‹ค.
    • ๊ฐ๊ฐ ๋น„๋ฐ€๋ฒˆํ˜ธ(Notice, General)์„ ์ž…๋ ฅํ•ด์•ผ ๊ฒŒ์‹œ๋ฌผ์„ ๋“ฑ๋กํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•˜์˜€๊ณ , ๊ณต์ง€์šฉ ๊ฒŒ์‹œํŒ ๊ฐ™์€ ๊ฒฝ์šฐ์—๋Š” ๊ฒŒ์‹œ๋ฌผ์„ ๋“ฑ๋กํ•จ๊ณผ ๋™์‹œ์— ๋ชจ๋“  wallpad, ์ฆ‰ post/notice topic์„ subscribeํ•˜๊ณ  ์žˆ๋Š” wallpad์— com.webos.notification/createToast ์•Œ๋ฆผ๊ณผ com.webos.service.tts/speak ์•Œ๋ฆผ์ด ๋™์‹œ์— ๊ฐ€๊ฒŒ ๋˜์–ด์žˆ๋‹ค.
    • ๋งŒ์•ฝ ๊ณต์ง€๋ฅผ ๋“ฑ๋กํ•  ๋•Œ, ๊ฐ€์ „์ œ์–ด ์ถ”์ฒœ ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉํ•˜๋ฉด, ์‚ฌ์šฉ์ž์—๊ฒŒ ์–ด๋– ํ•œ ์ด์œ ๋กœ ์–ด๋–ค ๊ฐ€์ „์ œ์–ด๋ฅผ ์–ธ์ œ๋ถ€ํ„ฐ ์–ธ์ œ๊นŒ์ง€ ์ด๋ ‡๊ฒŒ ์ œ์–ด๋ฅผ ์ถ”์ฒœํ•˜๊ฒ ๋‹ค๋ผ๋Š” com.webos.notification/createAlert ์•Œ๋ฆผ์„ ํ†ตํ•ด ์ œ์–ด๋ฅผ ์ถ”์ฒœํ•˜๊ณ , ์‚ฌ์šฉ์ž๊ฐ€ yes๋ฅผ ๋ˆ„๋ฅด๋ฉด ํ•ด๋‹น ๊ฐ€์ „์ œ์–ด๊ฐ€ ์Šค์ผ€์ฅด๋ง ๋˜๋Š” ๊ตฌ์กฐ๋กœ ๋งŒ๋“ค์—ˆ๋‹ค.

webOS(์›”ํŒจ๋“œ) - 2.18.0:

  • ENACT(com.control.app)
    • LED ์ œ์–ด์— ์žˆ์–ด์„œ๋Š” ํ˜„์žฌ LED์˜ ์ƒํƒœ๋ฅผ ์•„๋Š” ๊ฒƒ์ด ์ค‘์š”ํ•˜๊ธฐ ๋•Œ๋ฌธ์—, LED์˜ ์ƒํƒœ๋ฅผ ๋งจ ์ฒ˜์Œ, useEFFECT๋ฅผ ํ†ตํ•ด์„œ init service๋ฅผ ๊ฐ€์ ธ์˜ค๋Š” ๊ฒƒ์œผ๋กœ ESP8266์— ์ •๋ณด๋ฅผ ์š”์ฒญํ•ด์„œ ๊ฐ€์ ธ์˜ค๊ณ , ๊ทธ ์ดํ›„์—๋Š” ๊ฐ์ข… ๊ฐ€์ „์ œ์–ด๋ฅผ ์‹คํ–‰์‹œํ‚ค๊ณ  callback์œผ๋กœ subscribe Service๋ฅผ ์‹คํ–‰์‹œํ‚ค๋Š” ๋ฐฉ๋ฒ•์„ ์‚ฌ์šฉํ–ˆ๋‹ค.

  • Node.JS(com.control.app.service)
    • init service: ๋งจ ์ฒ˜์Œ๋งŒ ์‹คํ–‰๋˜๋Š” ์„œ๋น„์Šค๋กœ, ํ•ด๋‹น ์„œ๋น„์Šค๊ฐ€ ์‹คํ–‰๋˜๋ฉด init/led topic์œผ๋กœ ์š”์ฒญ์„ ๋ณด๋‚ด์„œ ESP8266์œผ๋กœ๋ถ€ํ„ฐ ํ˜„์žฌ LED์˜ ์ƒํƒœ๋ฅผ status/led ๋ฅผ subscribeํ•˜์—ฌ ์ œ๊ณต๋ฐ›์Šต๋‹ˆ๋‹ค.
    • led service: enact๋กœ๋ถ€ํ„ฐ ๋„˜๊ฒจ๋ฐ›์€ ๋ฐ์ดํ„ฐ๋ฅผ parsingํ•˜์—ฌ control/led topic์— ๋ณด๋‚ด led๋ฅผ ์ œ์–ดํ•ฉ๋‹ˆ๋‹ค.
    • blind service: enact๋กœ๋ถ€ํ„ฐ ๋„˜๊ฒจ๋ฐ›์€ ๋ฐ์ดํ„ฐ๋ฅผ parsingํ•˜์—ฌ control/blind topic์— ๋ณด๋‚ด blind๋ฅผ 5๋‹จ๊ณ„๋กœ ์ œ์–ดํ•ฉ๋‹ˆ๋‹ค.
    • window service: enact๋กœ๋ถ€ํ„ฐ ๋„˜๊ฒจ๋ฐ›์€ ๋ฐ์ดํ„ฐ๋ฅผ parsingํ•˜์—ฌ control/window topic์— ๋ณด๋‚ด window๋ฅผ 5๋‹จ๊ณ„๋กœ ์ œ์–ดํ•ฉ๋‹ˆ๋‹ค.
    • subscribe service: status/led topic์„ subscribeํ•˜์—ฌ ESP8266์œผ๋กœ๋ถ€ํ„ฐ ๋„˜์–ด์˜จ LED ์ƒํƒœ ์ •๋ณด๋ฅผ enact์— ๊ณ„์† ์ „๋‹ฌํ•ด์ฃผ์–ด led์ƒํƒœ๋ฅผ ์‹ค์‹œ๊ฐ„ ๋ฐ˜์˜ํ•˜๋Š”๋ฐ ์‚ฌ์šฉ๋œ๋‹ค. ๋˜ํ•œ ์„œ๋น„์Šค๊ฐ€ ์Œ“์ด๋Š” ๊ฒƒ์„ ๋ฐฉ์ง€ํ•˜๊ธฐ ์œ„ํ•ด control/* topic์— ๋ฐ์ดํ„ฐ๊ฐ€ ๋“ค์–ด์˜ค๋ฉด ์„œ๋น„์Šค๋ฅผ ์ทจ์†Œํ•œ๋‹ค.

webOS(์›”ํŒจ๋“œ) - 2.17.0:

  • ENACT(com.reservation.app)
    • ํ˜„์žฌ๋Š” ๋ฒ„ํŠผ๋งŒ ์žˆ๋Š” UI์ง€๋งŒ ๋‚˜์ค‘์— com.webos.service.activitymanager ๊ฐ€ 2.18.0 ๋ฒ„์ ผ์—์„œ ์ž‘๋™ํ•œ๋‹ค๋ฉด ์œ„์˜ ์›น์•ฑ๊ณผ ํ•ฉ์น  ์˜ˆ์ •์ด๋‹ค.

  • Node.JS(com.control.app.service)
    • child service: post/notice topic์—์„œ ๊ฐ€์ „์ œ์–ด ์ถ”์ฒœ๊ณผ ๊ด€๋ จ๋œ ๋ฐ์ดํ„ฐ๊ฐ€ ๋“ค์–ด์˜ค๋ฉด, ๋ฐ์ดํ„ฐ๋ฅผ ์•Œ๋งž๊ฒŒ parsingํ•˜์—ฌ node ๊ธฐ๋ณธ ๋ชจ๋“ˆ์ธ Child Process๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ com.webos.notification/createAlert ๋ฅผ ์‹คํ–‰์‹œํ‚จ๋‹ค. ๊ทธ๋ ‡๊ฒŒ ์‹คํ–‰๋œ Alert์—์„œ ์‚ฌ์šฉ์ž๋Š” ์ถ”์ฒœ๋œ ๊ฐ€์ „์ œ์–ด๋ฅผ ์‹คํ–‰ํ• ์ง€ ์•ˆํ• ์ง€๋ฅผ ๊ฒฐ์ •ํ•˜๊ฒŒ ๋˜๊ณ  ์‹คํ–‰ํ•œ๋‹ค๋ผ๊ณ  ํ•˜๋ฉด, control service ๋ฅผ ์‹คํ–‰ํ•œ๋‹ค.
    • control service: child service์—์„œ ๋“ค์–ด์˜จ ๋ฐ์ดํ„ฐ๋ฅผ parsingํ•˜์—ฌ ์ถ”์ฒœ๋œ ๊ฐ€์ „์ œ์–ด๋ฅผ com.webos.service.activitymanager ์˜ create ๋ฉ”์†Œ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ reservation service๋ฅผ ์˜ˆ์•ฝ๋œ ์‹œ๊ฐ„์— ์‹คํ–‰๋˜๊ฒŒ ํ•œ๋‹ค.
    • reservation service: ๊ฐ๊ฐ์˜ ๊ฐ€์ „์ œ์–ด topic์— ๋ฐ์ดํ„ฐ๋ฅผ publishํ•˜์—ฌ ๊ฐ€์ „์„ ์ง์ ‘ ์ œ์–ดํ•œ๋‹ค.

Arduino(ํ˜„๊ด€):

  • ESP8266(LED)
    • tact ์Šค์œ„์น˜๋ฅผ ํ†ตํ•ด ์Šค์œ„์น˜๊ฐ€ ๋ˆŒ๋Ÿฌ์กŒ๋‹ค ๋–จ์–ด์ง€๋Š” ๊ทธ ์ˆœ๊ฐ„์— LED๋ฅผ ์ œ์–ดํ•˜๊ณ  status/led topic์— publishํ•œ๋‹ค. ๋˜ํ•œ, control/led ์— ๋ฐ์ดํ„ฐ๊ฐ€ ๋“ค์–ด์˜ค๋ฉด ๊ทธ์— ๋งž๊ฒŒ LED 3๊ฐœ๋ฅผ ๊ฐ๊ฐ ์ œ์–ดํ•œ๋‹ค.
  • ESP32(Blind, Window)
    • JoyStick์„ ํ†ตํ•ด ์ขŒ์šฐ๋กœ๋Š” window๋ฅผ ์ œ์–ดํ•˜๊ณ , ์ƒํ•˜๋กœ๋Š” blind๋ฅผ step motor๋กœ ์ œ์–ดํ•˜๋Š” ๋ฐฉ์‹์„ ์‚ฌ์šฉํ–ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  control/window , control/blind topic์— ๋ฐ์ดํ„ฐ๊ฐ€ ๋“ค์–ด์˜ค๋ฉด ๋งตํ•‘ ๋œ ์Šคํ…์„ ๊ธฐ๋ฐ˜์œผ๋กœ 5๋‹จ๊ณ„ ์ค‘ ๋“ค์–ด์˜จ ๋ฐ์ดํ„ฐ์— ํ•ด๋‹นํ•˜๋Š” ์œ„์น˜๋กœ ์ •ํ™•ํžˆ ์ด๋™ํ•œ๋‹ค.

๊ฐœ๋ฐœํ™˜๊ฒฝ ๋ฐ ๊ฐœ๋ฐœ์–ธ์–ด

  • ์šด์˜์ฒด์ œ : Windows 11, Ubuntu 20.04.5 LTS, webOS 2.18.0, webOS 2.17.0
  • ๋””๋ฐ”์ด์Šค ๊ตฌ์„ฑ : Raspberry Pi 4B 2EA
  • IDE : Visual Studio Code, Arduino IDE
  • ๊ฐœ๋ฐœ ์–ธ์–ด : ENACT, Node.JS, Arduino
  • package manager : npm, yarn

Quick Start

ares-setup-device์—์„œ default๋ฅผ ์ž์‹ ์ด ์„ค์น˜ํ•  webOS(2.18.0)์˜ IP๋กœ ์„ค์ •ํ•˜์„ธ์š”.

source wallpad1.setup.sh

ares-setup-device์—์„œ default๋ฅผ ์ž์‹ ์ด ์„ค์น˜ํ•  webOS(2.17.0)์˜ IP๋กœ ์„ค์ •ํ•˜์„ธ์š”.

source wallpad2.setup.sh

์žฅ์•  ์š”์ธ

  1. webOS 2.18.0์—์„œ com.webos.service.createActivity LS2 API๊ฐ€ ์‚ฌ์šฉ๋˜์ง€ ์•Š๋Š” ๋ฒ„๊ทธ๊ฐ€ ์žˆ๋‹ค.
    --> ํ•ด๋‹น ๋ฒ„๊ทธ๋ฅผ ํ•ด๊ฒฐํ•˜๋ฉด 2.17.0์œผ๋กœ ์‚ฌ์šฉํ•˜๋˜ reservation app์„ control app์œผ๋กœ ํ•ฉ์น  ๊ณ„ํš์ด๋‹ค.
  2. com.webos.notification/createAlert์™€ ๊ฐ™์€ ๊ฒฝ์šฐ์—๋Š” 3rd party ์•ฑ์—์„œ๋Š” ๊ถŒํ•œ ์˜ค๋ฅ˜๊ฐ€ ๋‚œ๋‹ค.
    --> ์ด๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด node์˜ ๊ธฐ๋ณธ ๋ชจ๋“ˆ์ธ Child Process๋ฅผ ํ†ตํ•ด luna-send๋กœ ์ง์ ‘ ์‚ฌ์šฉํ•˜๊ฒŒ ๋˜์—ˆ๋‹ค.
  3. enact์—์„œ subscribe ์˜ต์…˜์„ ํ†ตํ•ด js_service๋ฅผ ์‹คํ–‰ํ•˜๋ฉด, ๋‹จ๋ฐœ์ ์œผ๋กœ๊ฐ€ ์•„๋‹Œ msg.respond๋ฅผ ํ†ตํ•ด ๊ณ„์† ๋ฐ์ดํ„ฐ๋ฅผ ๋ณด๋‚ด๋ฉด ๊ณ„์† callback์„ ์‹คํ–‰์‹œํ‚ฌ ์ˆ˜ ์žˆ๋‹ค. ํ•˜์ง€๋งŒ ํ•ด๋‹น subscribe๋Š” ๋‹ค๋ฅธ ์„œ๋น„์Šค๋ฅผ ์‹คํ–‰ํ•˜๋Š” ์ˆœ๊ฐ„ ๋Š๊ธฐ๊ฒŒ ๋˜๋Š” ๋ฌธ์ œ๊ฐ€ ์žˆ์—ˆ๋‹ค.
    --> ๋‹ค๋ฅธ ์„œ๋น„์Šค๊ฐ€ ์‹คํ–‰๋˜๊ณ , ๋๋‚˜๋Š” ์ˆœ๊ฐ„ ๋ฐ”๋กœ ๋‹ค์‹œ subscribe ์˜ต์…˜์„ ํ†ตํ•ด ์„œ๋น„์Šค๋ฅผ ๋ถˆ๋Ÿฌ์˜ค๋Š” ๋ฐฉ์‹์„ ํ†ตํ•ด์„œ LED์˜ ์ƒํƒœ ๋ณ€ํ™”๋ฅผ ๊ณ„์† ๋ฐ˜์˜์‹œ์ผœ์ค„ ์ˆ˜ ์žˆ์—ˆ๋‹ค.

About

๐Ÿ† [๋Œ€์ƒ์ž‘] ์ž„๋ฒ ๋””๋“œ ์†Œํ”„ํŠธ์›จ์–ด ๊ฒฝ์ง„๋Œ€ํšŒ webOS๋ถ€๋ฌธ ๋ฐฉํŒŒ์ œํŒ€ - Control ๊ธฐ๋Šฅ & Control Recommend ๊ธฐ๋Šฅ

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •