openapi.yaml 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043
  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. TransitionData:
  560. allOf:
  561. - $ref: '#/components/schemas/TransitionArgs'
  562. - type: object
  563. properties:
  564. id:
  565. type: integer
  566. last_sent:
  567. type: integer
  568. description: Timestamp since last update was sent.
  569. bulb:
  570. $ref: '#/components/schemas/BulbId'
  571. type:
  572. readOnly: true
  573. description: >
  574. Specifies whether this is a simple field transition, or a color transition.
  575. type: string
  576. enum:
  577. - field
  578. - color
  579. current_value:
  580. $ref: '#/components/schemas/TransitionValue'
  581. end_value:
  582. $ref: '#/components/schemas/TransitionValue'
  583. BulbId:
  584. type: object
  585. properties:
  586. device_id:
  587. type: integer
  588. minimum: 0
  589. maximum: 65536
  590. example: 1234
  591. group_id:
  592. type: integer
  593. minimum: 0
  594. maximum: 8
  595. example: 1
  596. device_type:
  597. $ref: '#/components/schemas/RemoteType'
  598. GroupStateCommands:
  599. type: object
  600. properties:
  601. command:
  602. oneOf:
  603. - $ref: '#/components/schemas/GroupStateCommand'
  604. - type: object
  605. properties:
  606. command:
  607. type: string
  608. enum:
  609. - transition
  610. args:
  611. $ref: '#/components/schemas/TransitionArgs'
  612. commands:
  613. type: array
  614. items:
  615. $ref: '#/components/schemas/GroupStateCommand'
  616. example:
  617. - level_up
  618. - temperature_up
  619. GroupState:
  620. type: object
  621. description: Group state
  622. properties:
  623. state:
  624. $ref: '#/components/schemas/State'
  625. status:
  626. $ref: '#/components/schemas/State'
  627. hue:
  628. type: integer
  629. minimum: 0
  630. maximum: 359
  631. description: Color hue. Will change bulb to color mode.
  632. saturation:
  633. type: integer
  634. minimum: 0
  635. maximum: 100
  636. description: Color saturation. Will normally change bulb to color mode.
  637. kelvin:
  638. type: integer
  639. minimum: 0
  640. maximum: 100
  641. description: White temperature. 0 is coolest, 100 is warmest.
  642. temperature:
  643. type: integer
  644. minimum: 0
  645. maximum: 100
  646. description: Alias for `kelvin`.
  647. color_temp:
  648. type: integer
  649. minimum: 153
  650. maximum: 370
  651. description: White temperature measured in mireds. Lower values are cooler.
  652. mode:
  653. type: integer
  654. description: Party mode ID. Actual effect depends on the bulb.
  655. color:
  656. oneOf:
  657. - type: string
  658. pattern: '[0-9]{1,3},[0-9]{1,3},[0-9]{1,3}'
  659. example: '255,255,0'
  660. - type: object
  661. properties:
  662. r:
  663. type: integer
  664. g:
  665. type: integer
  666. b:
  667. type: integer
  668. example:
  669. r: 255
  670. g: 255
  671. b: 0
  672. example:
  673. '255,0,255'
  674. level:
  675. type: integer
  676. minimum: 0
  677. maximum: 100
  678. description: Brightness on a 0-100 scale.
  679. example: 50
  680. brightness:
  681. type: integer
  682. minimum: 0
  683. maximum: 255
  684. description: Brightness on a 0-255 scale.
  685. example: 170
  686. effect:
  687. type: string
  688. enum:
  689. - night_mode
  690. - white_mode
  691. transition:
  692. type: number
  693. description: >
  694. Enables a transition from current state to the provided state.
  695. example: 2.0
  696. RemoteType:
  697. type: string
  698. enum:
  699. - "rgbw"
  700. - "cct"
  701. - "rgb_cct"
  702. - "rgb"
  703. - "fut089"
  704. - "fut091"
  705. - "fut020"
  706. example: rgb_cct
  707. RF24Channel:
  708. type: string
  709. enum:
  710. - LOW
  711. - MID
  712. - HIGH
  713. LedMode:
  714. type: string
  715. enum:
  716. - Off
  717. - Slow toggle
  718. - Fast toggle
  719. - Slow blip
  720. - Fast blip
  721. - Flicker
  722. - On
  723. GroupStateField:
  724. type: string
  725. enum:
  726. - state
  727. - status
  728. - brightness
  729. - level
  730. - hue
  731. - saturation
  732. - color
  733. - mode
  734. - kelvin
  735. - color_temp
  736. - bulb_mode
  737. - computed_color
  738. - effect
  739. - device_id
  740. - group_id
  741. - device_type
  742. - oh_color
  743. - hex_color
  744. description: >
  745. Defines a field which is a part of state for a particular light device. Most fields are self-explanatory, but documentation for each follows:
  746. * `state` / `status` - same value with different keys (useful if your platform expects one or the other).
  747. * `brightness` / `level` - [0, 255] and [0, 100] scales of the same value.
  748. * `kelvin / color_temp` - [0, 100] and [153, 370] scales for the same value. The later's unit is mireds.
  749. * `bulb_mode` - what mode the bulb is in: white, rgb, etc.
  750. * `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.
  751. * `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).
  752. * `hex_color` - same as `color` except in hex color (e.g., `#FF0000` for red).
  753. * `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.
  754. DeviceId:
  755. type: array
  756. items: {}
  757. example:
  758. - 1234
  759. - "rgb_cct"
  760. - 1
  761. Settings:
  762. type: object
  763. properties:
  764. admin_username:
  765. type: string
  766. description: If spcified along with `admin_password`, HTTP basic auth will be enabled to access all REST endpoints.
  767. default: ""
  768. admin_password:
  769. type: string
  770. description: If spcified along with `admin_username`, HTTP basic auth will be enabled to access all REST endpoints.
  771. default: ""
  772. ce_pin:
  773. type: integer
  774. description: CE pin to use for SPI radio (nRF24, LT8900)
  775. default: 4
  776. csn_pin:
  777. type: integer
  778. description: CSN pin to use with nRF24
  779. default: 15
  780. reset_pin:
  781. type: integer
  782. description: Reset pin to use with LT8900
  783. default: 0
  784. led_pin:
  785. type: integer
  786. description: Pin to control for status LED. Set to a negative value to invert on/off status.
  787. default: -2
  788. packet_repeats:
  789. type: integer
  790. description: Number of times to resend the same 2.4 GHz milight packet when a command is sent.
  791. default: 50
  792. http_repeat_factor:
  793. type: integer
  794. description: Packet repeats resulting from REST commands will be multiplied by this number.
  795. default: 1
  796. auto_restart_period:
  797. type: integer
  798. description: Automatically restart the device after the number of specified minutes. Use 0 to disable.
  799. default: 0
  800. mqtt_server:
  801. type: string
  802. description: MQTT server to connect to.
  803. format: hostname
  804. mqtt_username:
  805. type: string
  806. description: If specified, use this username to authenticate with the MQTT server.
  807. mqtt_password:
  808. type: string
  809. description: If specified, use this password to authenticate with the MQTT server.
  810. mqtt_topic_pattern:
  811. type: string
  812. description: Topic pattern to listen on for commands. More detail on the format in README.
  813. example: milight/commands/:device_id/:device_type/:group_id
  814. mqtt_update_topic_pattern:
  815. type: string
  816. description: Topic pattern individual intercepted commands will be sent to. More detail on the format in README.
  817. example: milight/updates/:device_id/:device_type/:group_id
  818. mqtt_update_state_pattern:
  819. type: string
  820. description: Topic pattern device state will be sent to. More detail on the format in README.
  821. example: milight/state/:device_id/:device_type/:group_id
  822. mqtt_client_status_topic:
  823. type: string
  824. description: Topic client status will be sent to.
  825. example: milight/status
  826. simple_mqtt_client_status:
  827. type: boolean
  828. 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.
  829. default: true
  830. discovery_port:
  831. type: integer
  832. description: UDP discovery port
  833. default: 48899
  834. listen_repeats:
  835. type: integer
  836. description: Controls how many cycles are spent listening for packets. Set to 0 to disable passive listening.
  837. default: 3
  838. state_flush_interval:
  839. type: integer
  840. description: Controls how many miliseconds must pass between states being flushed to persistent storage. Set to 0 to disable throttling.
  841. default: 10000
  842. mqtt_state_rate_limit:
  843. type: integer
  844. description: Controls how many miliseconds must pass between MQTT state updates. Set to 0 to disable throttling.
  845. default: 500
  846. packet_repeat_throttle_threshold:
  847. type: integer
  848. description:
  849. 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.
  850. default: 200
  851. packet_repeat_throttle_sensitivity:
  852. type: integer
  853. description:
  854. Controls how packet repeats are throttled. Higher values cause packets to be throttled up and down faster. Set to 0 to disable throttling.
  855. default: 0
  856. minimum: 0
  857. maximum: 1000
  858. packet_repeat_minimum:
  859. type: integer
  860. description:
  861. Controls how far throttling can decrease the number of repeated packets
  862. default: 3
  863. enable_automatic_mode_switching:
  864. type: boolean
  865. description:
  866. 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.
  867. default: false
  868. led_mode_wifi_config:
  869. $ref: '#/components/schemas/LedMode'
  870. led_mode_wifi_failed:
  871. $ref: '#/components/schemas/LedMode'
  872. led_mode_operating:
  873. $ref: '#/components/schemas/LedMode'
  874. led_mode_packet:
  875. $ref: '#/components/schemas/LedMode'
  876. led_mode_packet_count:
  877. type: integer
  878. description: Number of times the LED will flash when packets are changing
  879. default: 3
  880. hostname:
  881. type: string
  882. description: Hostname that will be advertized on a DHCP request
  883. pattern: "[a-zA-Z0-9-]+"
  884. default: milight-hub
  885. rf24_power_level:
  886. type: string
  887. enum:
  888. - MIN
  889. - LOW
  890. - HIGH
  891. - MAX
  892. description: Power level used when packets are sent. See nRF24 documentation for further detail.
  893. default: MAX
  894. rf24_listen_channel:
  895. $ref: '#/components/schemas/RF24Channel'
  896. wifi_static_ip:
  897. type: string
  898. format: ipv4
  899. description: If specified, the static IP address to use
  900. wifi_static_ip_gateway:
  901. type: string
  902. format: ipv4
  903. description: If specified along with static IP, the gateway address to use
  904. wifi_static_ip_netmask:
  905. type: string
  906. format: ipv4
  907. description: If specified along with static IP, the netmask to use
  908. packet_repeats_per_loop:
  909. type: integer
  910. default: 10
  911. 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.
  912. home_assistant_discovery_prefix:
  913. type: string
  914. description: If specified along with MQTT settings, will enable HomeAssistant MQTT discovery using the specified discovery prefix. HomeAssistant's default is `homeassistant/`.
  915. wifi_mode:
  916. type: string
  917. enum:
  918. - B
  919. - G
  920. - N
  921. description: Forces WiFi into the spcified mode. Try using B or G mode if you are having stability issues.
  922. default: N
  923. rf24_channels:
  924. type: array
  925. items:
  926. $ref: '#/components/schemas/RF24Channel'
  927. description: Defines which channels we send on. Each remote type has three channels. We can send on any subset of these.
  928. device_ids:
  929. type: array
  930. items:
  931. $ref: '#/components/schemas/DeviceId'
  932. description:
  933. "List of saved device IDs, stored as 3-long arrays. Elements are: 1) remote ID, 2) remote type, 3) group ID"
  934. example:
  935. - [1234, 'rgb_cct', 1]
  936. - [5678, 'fut089', 5]
  937. gateway_configs:
  938. type: array
  939. items:
  940. type: integer
  941. 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)"
  942. example:
  943. - [1234, 5555, 6]
  944. group_state_fields:
  945. type: array
  946. items:
  947. $ref: '#/components/schemas/GroupStateField'
  948. group_id_aliases:
  949. type: object
  950. description: Keys are aliases, values are 3-long arrays with same schema as items in `device_ids`.
  951. example:
  952. alias1: [1234, 'rgb_cct', 1]
  953. alias2: [1234, 'rgb_cct', 2]
  954. default_transition_period:
  955. type: integer
  956. description: |
  957. Default number of milliseconds between transition packets. Set this value lower for more granular transitions, or higher if
  958. you are having performance issues during transitions.
  959. BooleanResponse:
  960. type: object
  961. required:
  962. - success
  963. properties:
  964. success:
  965. type: boolean
  966. error:
  967. type: string
  968. description: If an error occurred, message specifying what went wrong
  969. About:
  970. type: object
  971. properties:
  972. firmware:
  973. type: string
  974. description: Always set to "milight-hub"
  975. version:
  976. type: string
  977. description: Semver version string
  978. ip_address:
  979. type: string
  980. reset_reason:
  981. type: string
  982. description: Reason the system was last rebooted
  983. variant:
  984. type: string
  985. description: Firmware variant (e.g., d1_mini, nodemcuv2)
  986. free_heap:
  987. type: integer
  988. format: int64
  989. description: Amount of free heap remaining (measured in bytes)
  990. arduino_version:
  991. type: string
  992. description: Version of Arduino SDK firmware was built with
  993. queue_stats:
  994. type: object
  995. properties:
  996. length:
  997. type: integer
  998. description: Number of enqueued packets to be sent
  999. dropped_packets:
  1000. type: integer
  1001. description: Number of packets that have been dropped since last reboot
  1002. ReadPacket:
  1003. type: object
  1004. properties:
  1005. packet_info:
  1006. type: string