openapi.yaml 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041
  1. openapi: 3.0.1
  2. info:
  3. title: ESP8266 MiLight Hub
  4. description: Official documention for MiLight Hub's REST API.
  5. contact:
  6. email: chris@sidoh.org
  7. license:
  8. name: MIT
  9. version: 1.0.0
  10. servers:
  11. - url: http://milight-hub
  12. tags:
  13. - name: System
  14. description: >
  15. Routes that return system information and allow you to control the device.
  16. - name: Settings
  17. description: Read and write settings
  18. - name: Device Control
  19. description: Control lighting devices
  20. - name: Device Control by Alias
  21. description: Control lighting devices using aliases rather than raw IDs
  22. - name: Raw Packet Handling
  23. description: Read and write raw Milight packets
  24. - name: Transitions
  25. description: Control transitions
  26. x-tagGroups:
  27. - name: Admin
  28. tags:
  29. - System
  30. - Settings
  31. - name: Devices
  32. tags:
  33. - Device Control
  34. - Device Control by Alias
  35. - Raw Packet Handling
  36. - name: Transitions
  37. tags:
  38. - Transitions
  39. paths:
  40. /about:
  41. get:
  42. tags:
  43. - System
  44. summary: Get system information
  45. responses:
  46. 200:
  47. description: success
  48. content:
  49. application/json:
  50. schema:
  51. $ref: '#/components/schemas/About'
  52. /remote_configs:
  53. get:
  54. tags:
  55. - System
  56. summary: List supported remote types
  57. responses:
  58. 200:
  59. description: success
  60. content:
  61. applicaiton/json:
  62. schema:
  63. type: array
  64. items:
  65. type: string
  66. example:
  67. $ref: '#/components/schemas/RemoteType/enum'
  68. /system:
  69. post:
  70. tags:
  71. - System
  72. summary: Send a system command
  73. description: >
  74. Send commands to the system. Supported commands:
  75. 1. `restart`. Restart the ESP8266.
  76. 1. `clear_wifi_config`. Clears on-board wifi information. ESP8266 will reboot and enter wifi config mode.
  77. requestBody:
  78. content:
  79. application/json:
  80. schema:
  81. type: object
  82. required:
  83. - command
  84. properties:
  85. command:
  86. type: string
  87. enum:
  88. - restart
  89. - clear_wifi_config
  90. responses:
  91. 200:
  92. description: command handled successfully
  93. content:
  94. application/json:
  95. schema:
  96. $ref: '#/components/schemas/BooleanResponse'
  97. 400:
  98. description: error
  99. content:
  100. application/json:
  101. schema:
  102. $ref: '#/components/schemas/BooleanResponse'
  103. /settings:
  104. get:
  105. tags:
  106. - Settings
  107. summary: Get existing settings
  108. responses:
  109. 200:
  110. description: success
  111. content:
  112. application/json:
  113. schema:
  114. $ref: '#/components/schemas/Settings'
  115. put:
  116. tags:
  117. - Settings
  118. summary: Patch existing settings
  119. requestBody:
  120. content:
  121. application/json:
  122. schema:
  123. $ref: '#/components/schemas/Settings'
  124. responses:
  125. 200:
  126. description: success
  127. content:
  128. application/json:
  129. schema:
  130. $ref: '#/components/schemas/BooleanResponse'
  131. post:
  132. tags:
  133. - Settings
  134. summary: Overwrite existing settings with a file
  135. requestBody:
  136. content:
  137. application/json:
  138. schema:
  139. $ref: '#/components/schemas/Settings'
  140. responses:
  141. 200:
  142. description: success
  143. content:
  144. application/json:
  145. schema:
  146. $ref: '#/components/schemas/BooleanResponse'
  147. /gateway_traffic/{remote-type}:
  148. get:
  149. tags:
  150. - Raw Packet Handling
  151. summary: Read a packet from a specific remote
  152. description:
  153. Read a packet from the given remote type. Does not return a response until a packet is read.
  154. If `remote-type` is unspecified, will read from all remote types simultaneously.
  155. parameters:
  156. - $ref: '#/components/parameters/RemoteType'
  157. responses:
  158. 200:
  159. description: success
  160. content:
  161. application/json:
  162. schema:
  163. $ref: '#/components/schemas/ReadPacket'
  164. /gateway_traffic:
  165. get:
  166. tags:
  167. - Raw Packet Handling
  168. summary: Read a packet from any remote
  169. description:
  170. Read a packet from any remote type. Does not return a response until a packet is read.
  171. responses:
  172. 200:
  173. description: success
  174. content:
  175. application/json:
  176. schema:
  177. $ref: '#/components/schemas/ReadPacket'
  178. /gateways/{device-id}/{remote-type}/{group-id}:
  179. parameters:
  180. - $ref: '#/components/parameters/DeviceId'
  181. - $ref: '#/components/parameters/RemoteType'
  182. - $ref: '#/components/parameters/GroupId'
  183. get:
  184. tags:
  185. - Device Control
  186. summary:
  187. Get device state
  188. description:
  189. If `blockOnQueue` is provided, a response will not be returned until any unprocessed
  190. packets in the command queue are finished sending.
  191. parameters:
  192. - $ref: '#/components/parameters/BlockOnQueue'
  193. responses:
  194. 200:
  195. description: success
  196. content:
  197. application/json:
  198. schema:
  199. $ref: '#/components/schemas/GroupState'
  200. put:
  201. tags:
  202. - Device Control
  203. summary:
  204. Patch device state
  205. description:
  206. Update state of the bulbs with the provided parameters. Existing parameters will be
  207. unchanged.
  208. if `blockOnQueue` is set to true, the response will not return until packets corresponding
  209. to the commands sent are processed, and the updated `GroupState` will be returned. If
  210. `blockOnQueue` is false or not provided, a simple response indicating success will be
  211. returned.
  212. parameters:
  213. - $ref: '#/components/parameters/BlockOnQueue'
  214. requestBody:
  215. content:
  216. application/json:
  217. schema:
  218. allOf:
  219. - $ref: '#/components/schemas/GroupState'
  220. - $ref: '#/components/schemas/GroupStateCommands'
  221. responses:
  222. 400:
  223. description: error with request
  224. content:
  225. application/json:
  226. schema:
  227. $ref: '#/components/schemas/BooleanResponse'
  228. 200:
  229. description: >
  230. Success.
  231. content:
  232. application/json:
  233. schema:
  234. oneOf:
  235. - $ref: '#/components/schemas/BooleanResponse'
  236. - $ref: '#/components/schemas/GroupState'
  237. delete:
  238. tags:
  239. - Device Control
  240. summary:
  241. Delete kept state
  242. description:
  243. Usets all known values for state fields for the corresponding device. If MQTT is
  244. configured, the retained state message corresponding to this device will also be
  245. deleted.
  246. responses:
  247. 200:
  248. description: success
  249. content:
  250. application/json:
  251. schema:
  252. $ref: '#/components/schemas/BooleanResponse'
  253. /gateways/{device-alias}:
  254. parameters:
  255. - $ref: '#/components/parameters/DeviceAlias'
  256. get:
  257. tags:
  258. - Device Control by Alias
  259. summary: Get device state by alias
  260. responses:
  261. 404:
  262. description: provided device alias does not exist
  263. 200:
  264. description: success
  265. content:
  266. application/json:
  267. schema:
  268. $ref: '#/components/schemas/GroupState'
  269. put:
  270. tags:
  271. - Device Control by Alias
  272. summary: Patch device state by alias
  273. parameters:
  274. - $ref: '#/components/parameters/BlockOnQueue'
  275. requestBody:
  276. content:
  277. application/json:
  278. schema:
  279. allOf:
  280. - $ref: '#/components/schemas/GroupState'
  281. - $ref: '#/components/schemas/GroupStateCommands'
  282. responses:
  283. 400:
  284. description: error with request
  285. content:
  286. application/json:
  287. schema:
  288. $ref: '#/components/schemas/BooleanResponse'
  289. 200:
  290. description: success
  291. content:
  292. application/json:
  293. schema:
  294. $ref: '#/components/schemas/GroupState'
  295. delete:
  296. tags:
  297. - Device Control by Alias
  298. summary: Delete kept state for alias
  299. description:
  300. Usets all known values for state fields for the corresponding device. If MQTT is
  301. configured, the retained state message corresponding to this device will also be
  302. deleted.
  303. responses:
  304. 200:
  305. description: success
  306. content:
  307. application/json:
  308. schema:
  309. $ref: '#/components/schemas/BooleanResponse'
  310. /raw_commands/{remote-type}:
  311. parameters:
  312. - $ref: '#/components/parameters/RemoteType'
  313. post:
  314. tags:
  315. - Raw Packet Handling
  316. summary: Send a raw packet
  317. requestBody:
  318. content:
  319. application/json:
  320. schema:
  321. type: object
  322. properties:
  323. packet:
  324. type: string
  325. pattern: "([A-Fa-f0-9]{2}[ ])+"
  326. description: Raw packet to send
  327. example: '01 02 03 04 05 06 07 08 09'
  328. num_repeats:
  329. type: integer
  330. minimum: 1
  331. description: Number of repeated packets to send
  332. example: 50
  333. responses:
  334. 200:
  335. description: success
  336. content:
  337. applicaiton/json:
  338. schema:
  339. $ref: '#/components/schemas/BooleanResponse'
  340. /transitions:
  341. get:
  342. tags:
  343. - Transitions
  344. summary: List all active transitions
  345. responses:
  346. 200:
  347. description: success
  348. content:
  349. application/json:
  350. schema:
  351. type: array
  352. items:
  353. $ref: '#/components/schemas/TransitionData'
  354. post:
  355. tags:
  356. - Transitions
  357. summary: Create a new transition
  358. requestBody:
  359. content:
  360. application/json:
  361. schema:
  362. $ref: '#/components/schemas/TransitionData'
  363. responses:
  364. 400:
  365. description: error
  366. content:
  367. application/json:
  368. schema:
  369. $ref: '#/components/schemas/BooleanResponse'
  370. 200:
  371. description: success
  372. content:
  373. application/json:
  374. schema:
  375. $ref: '#/components/schemas/BooleanResponse'
  376. /transitions/{id}:
  377. parameters:
  378. - name: id
  379. in: path
  380. description: ID of transition. This will be an auto-incrementing number reset after a restart.
  381. schema:
  382. type: integer
  383. required: true
  384. get:
  385. tags:
  386. - Transitions
  387. summary: Get properties for a transition
  388. responses:
  389. 404:
  390. description: Provided transition ID not found
  391. 200:
  392. description: success
  393. content:
  394. application/json:
  395. schema:
  396. $ref: '#/components/schemas/TransitionData'
  397. delete:
  398. tags:
  399. - Transitions
  400. summary: Delete a transition
  401. responses:
  402. 404:
  403. description: Provided transition ID not found
  404. content:
  405. application/json:
  406. schema:
  407. $ref: '#/components/schemas/BooleanResponse'
  408. 200:
  409. description: success
  410. content:
  411. application/json:
  412. schema:
  413. $ref: '#/components/schemas/BooleanResponse'
  414. /firmware:
  415. post:
  416. tags:
  417. - System
  418. summary:
  419. Update firmware
  420. requestBody:
  421. description: Firmware file
  422. content:
  423. multipart/form-data:
  424. schema:
  425. type: object
  426. properties:
  427. fileName:
  428. type: string
  429. format: binary
  430. responses:
  431. 200:
  432. description: success
  433. 500:
  434. description: server error
  435. components:
  436. parameters:
  437. DeviceAlias:
  438. name: device-alias
  439. in: path
  440. description: Device alias saved in settings
  441. schema:
  442. type: string
  443. required: true
  444. BlockOnQueue:
  445. name: blockOnQueue
  446. in: query
  447. description: If true, response will block on update packets being sent before returning
  448. schema:
  449. type: boolean
  450. required: false
  451. GroupId:
  452. name: group-id
  453. in: path
  454. description: >
  455. Group ID. Should be 0-8, depending on remote type. Group 0 is a "wildcard" group. All bulbs paired with the same device ID will respond to commands sent to Group 0.
  456. schema:
  457. type: integer
  458. minimum: 0
  459. maximum: 8
  460. required: true
  461. DeviceId:
  462. name: device-id
  463. in: path
  464. description: 2-byte device ID. Can be decimal or hexadecimal.
  465. schema:
  466. oneOf:
  467. - type: integer
  468. minimum: 0
  469. maximum: 65535
  470. - type: string
  471. pattern: '0x[a-fA-F0-9]+'
  472. example: '0x1234'
  473. required: true
  474. RemoteType:
  475. name: remote-type
  476. in: path
  477. description: Type of remote to read a packet from. If unspecified, will read packets from all remote types.
  478. schema:
  479. $ref: '#/components/schemas/RemoteType'
  480. required: true
  481. schemas:
  482. State:
  483. description: "On/Off state"
  484. type: string
  485. enum:
  486. - On
  487. - Off
  488. example: On
  489. GroupStateCommand:
  490. type: string
  491. enum:
  492. - unpair
  493. - pair
  494. - set_white
  495. - night_mode
  496. - level_up
  497. - level_down
  498. - temperature_up
  499. - temperature_down
  500. - next_mode
  501. - previous_mode
  502. - mode_speed_down
  503. - mode_speed_up
  504. - toggle
  505. example: pair
  506. description: >
  507. Commands that affect a given group. Descriptiosn follow:
  508. * `pair`. Emulates the pairing process. Send this command right as you connect an unpaired bulb and it will pair with the device ID being used.
  509. * `unpair`. Emulates the unpairing process. Send as you connect a paired bulb to have it disassociate with the device ID being used.
  510. * `set_white`. Turns off RGB and enters WW/CW mode.
  511. * `night_mode`. Most devices support a "night mode," which has LEDs turned to a very dim setting -- lower than brightness 0.
  512. * `level_up`. Turns down the brightness. Not all dimmable bulbs support this command.
  513. * `level_down`. Turns down the brightness. Not all dimmable bulbs support this command.
  514. * `temperature_up`. Turns up the white temperature. Not all bulbs with adjustable white temperature support this command.
  515. * `temperature_down`. Turns down the white temperature. Not all bulbs with adjustable white temperature support this command.
  516. * `next_mode`. Cycles to the next "disco mode".
  517. * `previous_mode`. Cycles to the previous disco mode.
  518. * `mode_speed_up`. Turn transition speed for current mode up.
  519. * `mode_speed_down`. Turn transition speed for current mode down.
  520. * `toggle`. Toggle on/off state.
  521. TransitionField:
  522. type: string
  523. enum:
  524. - hue
  525. - saturation
  526. - brightness
  527. - level
  528. - kelvin
  529. - color_temp
  530. - color
  531. - status
  532. example: brightness
  533. description: >
  534. If transitioning `status`:
  535. * If transitioning to `OFF`, will fade to 0 brightness and then turn off.
  536. * If transitioning to `ON`, will turn on, set brightness to 0, and fade to brightness 100.
  537. TransitionValue:
  538. oneOf:
  539. - type: integer
  540. - type: string
  541. pattern: '[0-9]{1,3},[0-9]{1,3},[0-9]{1,3}'
  542. description: Either an int value or a color
  543. TransitionArgs:
  544. type: object
  545. properties:
  546. field:
  547. $ref: '#/components/schemas/TransitionField'
  548. start_value:
  549. $ref: '#/components/schemas/TransitionValue'
  550. end_value:
  551. $ref: '#/components/schemas/TransitionValue'
  552. duration:
  553. type: number
  554. format: float
  555. description: Duration of transition, measured in seconds
  556. period:
  557. type: integer
  558. description: Length of time between updates in a transition, measured in milliseconds
  559. num_periods:
  560. type: integer
  561. description: Number of packets sent over the course of the transition
  562. TransitionData:
  563. allOf:
  564. - $ref: '#/components/schemas/TransitionArgs'
  565. - type: object
  566. properties:
  567. id:
  568. type: integer
  569. last_sent:
  570. type: integer
  571. description: Timestamp since last update was sent.
  572. bulb:
  573. $ref: '#/components/schemas/BulbId'
  574. type:
  575. readOnly: true
  576. description: >
  577. Specifies whether this is a simple field transition, or a color transition.
  578. type: string
  579. enum:
  580. - field
  581. - color
  582. current_value:
  583. $ref: '#/components/schemas/TransitionValue'
  584. end_value:
  585. $ref: '#/components/schemas/TransitionValue'
  586. BulbId:
  587. type: object
  588. properties:
  589. device_id:
  590. type: integer
  591. minimum: 0
  592. maximum: 65536
  593. example: 1234
  594. group_id:
  595. type: integer
  596. minimum: 0
  597. maximum: 8
  598. example: 1
  599. device_type:
  600. $ref: '#/components/schemas/RemoteType'
  601. GroupStateCommands:
  602. type: object
  603. properties:
  604. command:
  605. oneOf:
  606. - $ref: '#/components/schemas/GroupStateCommand'
  607. - type: object
  608. properties:
  609. command:
  610. type: string
  611. enum:
  612. - transition
  613. args:
  614. $ref: '#/components/schemas/TransitionArgs'
  615. commands:
  616. type: array
  617. items:
  618. $ref: '#/components/schemas/GroupStateCommand'
  619. example:
  620. - level_up
  621. - temperature_up
  622. GroupState:
  623. type: object
  624. description: Group state
  625. properties:
  626. state:
  627. $ref: '#/components/schemas/State'
  628. status:
  629. $ref: '#/components/schemas/State'
  630. hue:
  631. type: integer
  632. minimum: 0
  633. maximum: 359
  634. description: Color hue. Will change bulb to color mode.
  635. saturation:
  636. type: integer
  637. minimum: 0
  638. maximum: 100
  639. description: Color saturation. Will normally change bulb to color mode.
  640. kelvin:
  641. type: integer
  642. minimum: 0
  643. maximum: 100
  644. description: White temperature. 0 is coolest, 100 is warmest.
  645. temperature:
  646. type: integer
  647. minimum: 0
  648. maximum: 100
  649. description: Alias for `kelvin`.
  650. color_temp:
  651. type: integer
  652. minimum: 153
  653. maximum: 370
  654. description: White temperature measured in mireds. Lower values are cooler.
  655. mode:
  656. type: integer
  657. description: Party mode ID. Actual effect depends on the bulb.
  658. color:
  659. oneOf:
  660. - type: string
  661. pattern: '[0-9]{1,3},[0-9]{1,3},[0-9]{1,3}'
  662. example: '255,255,0'
  663. - type: object
  664. properties:
  665. r:
  666. type: integer
  667. g:
  668. type: integer
  669. b:
  670. type: integer
  671. example:
  672. r: 255
  673. g: 255
  674. b: 0
  675. example:
  676. '255,0,255'
  677. level:
  678. type: integer
  679. minimum: 0
  680. maximum: 100
  681. description: Brightness on a 0-100 scale.
  682. example: 50
  683. brightness:
  684. type: integer
  685. minimum: 0
  686. maximum: 255
  687. description: Brightness on a 0-255 scale.
  688. example: 170
  689. effect:
  690. type: string
  691. enum:
  692. - night_mode
  693. - white_mode
  694. transition:
  695. type: number
  696. description: >
  697. Enables a transition from current state to the provided state.
  698. example: 2.0
  699. RemoteType:
  700. type: string
  701. enum:
  702. - "rgbw"
  703. - "cct"
  704. - "rgb_cct"
  705. - "rgb"
  706. - "fut089"
  707. - "fut091"
  708. - "fut020"
  709. example: rgb_cct
  710. RF24Channel:
  711. type: string
  712. enum:
  713. - LOW
  714. - MID
  715. - HIGH
  716. LedMode:
  717. type: string
  718. enum:
  719. - Off
  720. - Slow toggle
  721. - Fast toggle
  722. - Slow blip
  723. - Fast blip
  724. - Flicker
  725. - On
  726. GroupStateField:
  727. type: string
  728. enum:
  729. - state
  730. - status
  731. - brightness
  732. - level
  733. - hue
  734. - saturation
  735. - color
  736. - mode
  737. - kelvin
  738. - color_temp
  739. - bulb_mode
  740. - computed_color
  741. - effect
  742. - device_id
  743. - group_id
  744. - device_type
  745. - oh_color
  746. - hex_color
  747. description: >
  748. Defines a field which is a part of state for a particular light device. Most fields are self-explanatory, but documentation for each follows:
  749. * `state` / `status` - same value with different keys (useful if your platform expects one or the other).
  750. * `brightness` / `level` - [0, 255] and [0, 100] scales of the same value.
  751. * `kelvin / color_temp` - [0, 100] and [153, 370] scales for the same value. The later's unit is mireds.
  752. * `bulb_mode` - what mode the bulb is in: white, rgb, etc.
  753. * `color` / `computed_color` - behaves the same when bulb is in rgb mode. `computed_color` will send RGB = 255,255,255 when in white mode. This is useful for HomeAssistant where it always expects the color to be set.
  754. * `oh_color` - same as `color` with a format compatible with [OpenHAB's colorRGB channel type](https://www.openhab.org/addons/bindings/mqtt.generic/#channel-type-colorrgb-colorhsb).
  755. * `hex_color` - same as `color` except in hex color (e.g., `#FF0000` for red).
  756. * `device_id` / `device_type` / `group_id` - this information is in the MQTT topic or REST route, but can be included in the payload in the case that processing the topic or route is more difficult.
  757. DeviceId:
  758. type: array
  759. items: {}
  760. example:
  761. - 1234
  762. - "rgb_cct"
  763. - 1
  764. Settings:
  765. type: object
  766. properties:
  767. admin_username:
  768. type: string
  769. description: If spcified along with `admin_password`, HTTP basic auth will be enabled to access all REST endpoints.
  770. default: ""
  771. admin_password:
  772. type: string
  773. description: If spcified along with `admin_username`, HTTP basic auth will be enabled to access all REST endpoints.
  774. default: ""
  775. ce_pin:
  776. type: integer
  777. description: CE pin to use for SPI radio (nRF24, LT8900)
  778. default: 4
  779. csn_pin:
  780. type: integer
  781. description: CSN pin to use with nRF24
  782. default: 15
  783. reset_pin:
  784. type: integer
  785. description: Reset pin to use with LT8900
  786. default: 0
  787. led_pin:
  788. type: integer
  789. description: Pin to control for status LED. Set to a negative value to invert on/off status.
  790. default: -2
  791. packet_repeats:
  792. type: integer
  793. description: Number of times to resend the same 2.4 GHz milight packet when a command is sent.
  794. default: 50
  795. http_repeat_factor:
  796. type: integer
  797. description: Packet repeats resulting from REST commands will be multiplied by this number.
  798. default: 1
  799. auto_restart_period:
  800. type: integer
  801. description: Automatically restart the device after the number of specified minutes. Use 0 to disable.
  802. default: 0
  803. mqtt_server:
  804. type: string
  805. description: MQTT server to connect to.
  806. format: hostname
  807. mqtt_username:
  808. type: string
  809. description: If specified, use this username to authenticate with the MQTT server.
  810. mqtt_password:
  811. type: string
  812. description: If specified, use this password to authenticate with the MQTT server.
  813. mqtt_topic_pattern:
  814. type: string
  815. description: Topic pattern to listen on for commands. More detail on the format in README.
  816. example: milight/commands/:device_id/:device_type/:group_id
  817. mqtt_update_topic_pattern:
  818. type: string
  819. description: Topic pattern individual intercepted commands will be sent to. More detail on the format in README.
  820. example: milight/updates/:device_id/:device_type/:group_id
  821. mqtt_update_state_pattern:
  822. type: string
  823. description: Topic pattern device state will be sent to. More detail on the format in README.
  824. example: milight/state/:device_id/:device_type/:group_id
  825. mqtt_client_status_topic:
  826. type: string
  827. description: Topic client status will be sent to.
  828. example: milight/status
  829. simple_mqtt_client_status:
  830. type: boolean
  831. description: If true, will use a simple enum flag (`connected` or `disconnected`) to indicate status. If false, will send a rich JSON message including IP address, version, etc.
  832. default: true
  833. discovery_port:
  834. type: integer
  835. description: UDP discovery port
  836. default: 48899
  837. listen_repeats:
  838. type: integer
  839. description: Controls how many cycles are spent listening for packets. Set to 0 to disable passive listening.
  840. default: 3
  841. state_flush_interval:
  842. type: integer
  843. description: Controls how many miliseconds must pass between states being flushed to persistent storage. Set to 0 to disable throttling.
  844. default: 10000
  845. mqtt_state_rate_limit:
  846. type: integer
  847. description: Controls how many miliseconds must pass between MQTT state updates. Set to 0 to disable throttling.
  848. default: 500
  849. packet_repeat_throttle_threshold:
  850. type: integer
  851. description:
  852. Controls how packet repeats are throttled. Packets sent with less time (measured in milliseconds) between them than this value (in milliseconds) will cause packet repeats to be throttled down. More than this value will unthrottle up.
  853. default: 200
  854. packet_repeat_throttle_sensitivity:
  855. type: integer
  856. description:
  857. Controls how packet repeats are throttled. Higher values cause packets to be throttled up and down faster. Set to 0 to disable throttling.
  858. default: 0
  859. minimum: 0
  860. maximum: 1000
  861. packet_repeat_minimum:
  862. type: integer
  863. description:
  864. Controls how far throttling can decrease the number of repeated packets
  865. default: 3
  866. enable_automatic_mode_switching:
  867. type: boolean
  868. description:
  869. When making updates to hue or white temperature in a different bulb mode, switch back to the original bulb mode after applying the setting change.
  870. default: false
  871. led_mode_wifi_config:
  872. $ref: '#/components/schemas/LedMode'
  873. led_mode_wifi_failed:
  874. $ref: '#/components/schemas/LedMode'
  875. led_mode_operating:
  876. $ref: '#/components/schemas/LedMode'
  877. led_mode_packet:
  878. $ref: '#/components/schemas/LedMode'
  879. led_mode_packet_count:
  880. type: integer
  881. description: Number of times the LED will flash when packets are changing
  882. default: 3
  883. hostname:
  884. type: string
  885. description: Hostname that will be advertized on a DHCP request
  886. pattern: "[a-zA-Z0-9-]+"
  887. default: milight-hub
  888. rf24_power_level:
  889. type: string
  890. enum:
  891. - MIN
  892. - LOW
  893. - HIGH
  894. - MAX
  895. description: Power level used when packets are sent. See nRF24 documentation for further detail.
  896. default: MAX
  897. rf24_listen_channel:
  898. $ref: '#/components/schemas/RF24Channel'
  899. wifi_static_ip:
  900. type: string
  901. format: ipv4
  902. description: If specified, the static IP address to use
  903. wifi_static_ip_gateway:
  904. type: string
  905. format: ipv4
  906. description: If specified along with static IP, the gateway address to use
  907. wifi_static_ip_netmask:
  908. type: string
  909. format: ipv4
  910. description: If specified along with static IP, the netmask to use
  911. packet_repeats_per_loop:
  912. type: integer
  913. default: 10
  914. description: Packets are sent asynchronously. This number controls the number of repeats sent during each iteration. Increase this number to improve packet throughput. Decrease to improve system multi-tasking.
  915. home_assistant_discovery_prefix:
  916. type: string
  917. description: If specified along with MQTT settings, will enable HomeAssistant MQTT discovery using the specified discovery prefix. HomeAssistant's default is `homeassistant/`.
  918. wifi_mode:
  919. type: string
  920. enum:
  921. - B
  922. - G
  923. - N
  924. description: Forces WiFi into the spcified mode. Try using B or G mode if you are having stability issues.
  925. default: N
  926. rf24_channels:
  927. type: array
  928. items:
  929. $ref: '#/components/schemas/RF24Channel'
  930. description: Defines which channels we send on. Each remote type has three channels. We can send on any subset of these.
  931. device_ids:
  932. type: array
  933. items:
  934. $ref: '#/components/schemas/DeviceId'
  935. description:
  936. "List of saved device IDs, stored as 3-long arrays. Elements are: 1) remote ID, 2) remote type, 3) group ID"
  937. example:
  938. - [1234, 'rgb_cct', 1]
  939. - [5678, 'fut089', 5]
  940. gateway_configs:
  941. type: array
  942. items:
  943. type: integer
  944. description: "List of UDP servers, stored as 3-long arrays. Elements are 1) remote ID to bind to, 2) UDP port to listen on, 3) protocol version (5 or 6)"
  945. example:
  946. - [1234, 5555, 6]
  947. group_state_fields:
  948. type: array
  949. items:
  950. $ref: '#/components/schemas/GroupStateField'
  951. group_id_aliases:
  952. type: object
  953. description: Keys are aliases, values are 3-long arrays with same schema as items in `device_ids`.
  954. example:
  955. alias1: [1234, 'rgb_cct', 1]
  956. alias2: [1234, 'rgb_cct', 2]
  957. BooleanResponse:
  958. type: object
  959. required:
  960. - success
  961. properties:
  962. success:
  963. type: boolean
  964. error:
  965. type: string
  966. description: If an error occurred, message specifying what went wrong
  967. About:
  968. type: object
  969. properties:
  970. firmware:
  971. type: string
  972. description: Always set to "milight-hub"
  973. version:
  974. type: string
  975. description: Semver version string
  976. ip_address:
  977. type: string
  978. reset_reason:
  979. type: string
  980. description: Reason the system was last rebooted
  981. variant:
  982. type: string
  983. description: Firmware variant (e.g., d1_mini, nodemcuv2)
  984. free_heap:
  985. type: integer
  986. format: int64
  987. description: Amount of free heap remaining (measured in bytes)
  988. arduino_version:
  989. type: string
  990. description: Version of Arduino SDK firmware was built with
  991. queue_stats:
  992. type: object
  993. properties:
  994. length:
  995. type: integer
  996. description: Number of enqueued packets to be sent
  997. dropped_packets:
  998. type: integer
  999. description: Number of packets that have been dropped since last reboot
  1000. ReadPacket:
  1001. type: object
  1002. properties:
  1003. packet_info:
  1004. type: string