MOPCON
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # 致敬「米家」 - 我家就是米家 - 黃志賢 {%hackmd MNcuRlXoQDak0uCmtaJKwA %} ###### tags: `MOPCON 2019` > 從這開始 ### 議題資源 + 簡報網址 https://hoyo.idv.tw/mopcon2019/ + 議題內所有原始碼 https://github.com/HoyoHuang/MOPCON2019 ### 今天目的 - 以小米智能插座 WiFi 版為例 + 一開始講者有分享影片,並敘述沒有在影片中看到什麼。而沒看到的東西為: + 閘道器(Gateway) + 如何設定 WiFi SSID & 密碼(SmartConfig) + SSL 傳輸加密 + 廠商如何出貨及設計 - 為什麼要自己做 - ㄑㄑㄑ譜 - 隱私 - 在荒郊野外 - 參加MOPCON, \OwO/ + 從選擇 IoT 開始 - ESP8266 + 可用 Arduino IDE 開發的最便宜 WiFi 模組(NodeMCU NT 100) + 支援 802.11 b/g/n + 具備類比 I/O & 數位 I/O + 決定架構 - 把 IoT 設定為 AP Mode(Server) + 在設為 AP Mode 後,該裝置的 IP 就會變成是固定 IP。 + 缺點:若使用「區域網路」可能就無法進行連線。但若是將 IP 設定為固定 IP 又可能會有安全性的問題。 + 決定架構 - 把 IoT 設為 Client user <--> server <--> IoT(Client) + 決定架構 - Client 也可雙向連線 + IoT 連線需求 + 商家出貨需有辨識身份 SN(Token) + WiFi 連線設定方法 - SSID, Password + SSL 傳輸加密 > 相關的問題可以搜尋「小米」 + Arduino 範例程式 + 類 C,至少需要 setup() & loop() + 程式特性為由上往下執行。 + Arduino - 使用 SmartConfig 設定 WiFi + 無螢幕 Client IoT 較佳 WiFi 設定方案 > SmartConfig 會自動把手機裡面的連線資訊傳送到 IoT,而 IoT 就會自動存入該連線資訊裡面的使用者設定。 原理是算 UDP 的封包長度,因此 APP 是 (Cordova + Pluging) + Arduino - SSL 加密 BearSSL::setFingerprint + 2.5.0 後開始支援,SSL 證書更新指紋也會更新。 + 但要注意 Arduino 的版本是否支援該 SSL 的 SDK。 + 第三方SSL 證書需要一直更新 + 可以自己頒一個N年證書(由於IoT不是網頁不太需要儼僅的第三方證書) + Hoyo 的選擇? Socket Server + 發彈幕功能就是使用 Web Soclet + 隔行如隔山,還是找框架吧... + Socket Server 框架是使用 Work man > 講者使用的程式語言是 PHP > 框架: Workerman + 長連結通訊難點 + 通訊協定:內容自訂 + 設計「認人」方法 + 長時間逾時 Time Out + 通訊 + 1 to 1 + 1對多 > 在開發過程中,因為 IoT 的 socket 通訊機制跟 WebSocket 是不同的,但因為為了開發上測試的方便,也可以先用 WebSocket 來測試,後續再轉成 IoT 用的 socket 來去實現 IoT 的功能。 + Socket 架構 IoT <-------> Server port: 3000 port: 3001 + Hoyo 怎麼做?Web - 前後端分離 + 前端:HTML, JS, CSS, JQuery, php.js + php.js: js 使用 php function + 後端:PHP, PHP query + 情境 - 將單一或多個動作組成 HTTP API + 假設插座有「開關」功能,則可以將該功能轉為一個 HTTP API。藉由這個 API 來去呼叫開燈或關燈的動作。 + 觸發情境的方法 + 智能音箱 + 語音助理 + 其它:IFTTT, Chat Bot, 密室逃脫...。 + 智能音箱 & 語音助理 + 智能音箱:Server - Server + 語音助理: + 決定架構 - 智能音箱串接 + 需要特定步驟才能在 APP 裝置清單內。

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully