{"id":177755,"date":"2013-04-24T20:28:03","date_gmt":"2013-04-24T16:28:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=177755"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=177755","title":{"rendered":"<span class=\"post_title\">\u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u044b\u043c\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/47b\/87b\/ef5\/47b87bef5734b0b9499e0fa6abdb1361.jpg\" align=\"right\"\/>\u0427\u0442\u043e \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c:<\/p>\n<ul>\n<li>\u043f\u0440\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432 jenkins \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043d\u0430 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435 \u0438 \u043a\u0430\u043a \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u2014 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0435\u0433\u043e \u043d\u0430 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0434\u0438\u0441\u043f\u043b\u0435\u0439, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0439 \u043a arduino;<\/li>\n<li>\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u043d\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0435 \u0438\u043b\u0438 \u043f\u043b\u0430\u043d\u0448\u0435\u0442\u0435, \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u043c\u0443\u0437\u044b\u043a\u0438 \u043d\u0430 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435 \u0438 \u0432\u0438\u0434\u0435\u043e\u043f\u043b\u0435\u0435\u0440\u043e\u043c \u043d\u0430 raspberry pi;<\/li>\n<li>\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u0441\u043d\u0430\u0440\u0443\u0436\u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438, \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u0432, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 ardiono.<\/li>\n<\/ul>\n<p>  \u0427\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c:<\/p>\n<ul>\n<li>\u043a\u043b\u0438\u0435\u043d\u0442, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c\u044b\u0439 \u043d\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435, \u0441 \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0446\u0438\u0435\u0439 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043d\u0430 python;<\/li>\n<li>RESTful api \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u00ab\u043c\u0435\u0442\u043e\u0434\u043e\u0432\u00bb(\u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u0441\u043f\u0440\u0430\u0432\u0430 \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u0430 \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0433\u043e);<\/li>\n<li>\u00ab\u043f\u0430\u043d\u0435\u043b\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u00bb \u0441 web-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c;<\/li>\n<li>\u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438, \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u0438 \u043f\u0430\u043d\u0435\u043b\u044f\u043c\u0438.<\/li>\n<\/ul>\n<p>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>\u0421\u0441\u044b\u043b\u043a\u0438<\/h4>\n<p>  \u0421\u0435\u0440\u0432\u0438\u0441 \u2014 <a href=\"http:\/\/rdevic.es\/\">rdevic.es<\/a><br \/>  \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u2014 <a href=\"https:\/\/github.com\/nvbn\/rdevices-server\">rdevices-server<\/a><br \/>  \u0418\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u2014 <a href=\"https:\/\/github.com\/nvbn\/rdevices-client\">rdevices-client<\/a><\/p>\n<h4>\u0427\u0442\u043e \u0432\u043d\u0443\u0442\u0440\u0438<\/h4>\n<p>  <a href=\"https:\/\/docs.google.com\/drawings\/d\/1BkDt1tzL0h04Yt5nMBydQjrErncd1M8vBttkIXu46aM\/edit?usp=sharing\"><img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/d46\/5db\/21b\/d465db21b8aef4e031db8146a2f36a8c.png\"\/><\/a><\/p>\n<p>  <b>rdclient<\/b> \u2014 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0434\u0435\u043a\u043b\u0430\u0440\u0438\u0440\u0443\u0435\u0442 \u043c\u0435\u0442\u043e\u0434\u044b, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442 \u0438\u0445 \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043e\u0431\u0440\u0430\u0442\u043d\u043e. \u041d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 python. \u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0441\u0432\u044f\u0437\u0438 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u00d8MQ, \u043d\u043e \u0434\u043b\u044f \u0435\u0433\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u0441\u043e\u043a\u0435\u0442\u044b.<\/p>\n<p>  <b>connector<\/b> \u2014 \u0434\u0435\u043c\u043e\u043d \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043e\u0442 API, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0445 \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0435\u0433\u043e \u0432 \u0431\u0430\u0437\u0443 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u0435\u043c\u043e\u043d \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0439. \u041d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 python \u0438 tornado. \u0414\u043b\u044f \u0441\u0432\u044f\u0437\u0438 \u0441 API \u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f redis.<\/p>\n<p>  <b>RESTfull API<\/b> \u2014 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438\u043b\u0438 \u0447\u0435\u0440\u0435\u0437 \u00ab\u043f\u0430\u043d\u0435\u043b\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u00bb \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442 \u0438\u0445 connector&#8217;\u0443. \u041d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 python, django \u0438 tastypie.<\/p>\n<p>  <b>push notifications<\/b> \u2014 \u0434\u0435\u043c\u043e\u043d \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f \u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043e\u0442 connector&#8217;\u0430 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442 \u0438\u0445 \u0432 \u00ab\u043f\u0430\u043d\u0435\u043b\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u00bb. \u0421\u0434\u0435\u043b\u0430\u043d \u0434\u043b\u044f \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a API. \u041d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 python, tornado \u0438 sockjs.<\/p>\n<p>  <b>dashboard<\/b> \u2014 web-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438 \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u0438 \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435. \u0414\u043b\u044f \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f html, \u0434\u043b\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u2014 JavaScript, CoffeeScript \u0438\u043b\u0438 IcedCoffeeScript.<\/p>\n<h4>\u041a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e<\/h4>\n<p>  \u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0435\u0433\u043e \u0432\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c pip \u0438 git, \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0443 \u0432\u0430\u0441 \u043d\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u044b.<\/p>\n<p>  \u0418 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c rdclient:  <\/p>\n<pre><code class=\"bash\">pip install -e git:\/\/github.com\/nvbn\/rdevices-client.git#egg=rdclient <\/code><\/pre>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/64b\/716\/0ba\/64b7160ba4356ec60ebcae36dd3c5f8a.png\" align=\"right\"\/><br \/>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e <a href=\"http:\/\/rdevic.es\/devices\/create\/\">\u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e<\/a> \u0447\u0435\u0440\u0435\u0437 \u0441\u0430\u0439\u0442 \u0438 \u0441\u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e <code>uuid<\/code>.<\/p>\n<p>  \u0414\u043b\u044f \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0446\u0438\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c python \u0444\u0430\u0439\u043b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>device.py<\/code>, \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 <code>Device<\/code>, \u0434\u0435\u043a\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b \u0441 <code>method(result, [arg1], [arg2], ..)<\/code> \u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u044c <code>uuid<\/code> \u0432 <code>Meta<\/code>.<br \/>  \u0410\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u0430, \u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0432\u043d\u044b\u0445 \u0446\u0435\u043b\u044f\u0445.<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430:  <\/p>\n<pre><code class=\"python\">from rdclient import Device, method  class MyDevice(Device):     class Meta:         uuid = 'DEVICE_UUID'          @method('None')     def print_123(self):         print 123          @method('int', a='int', b='int')     def sum_a_and_b(self, a, b):         return a + b <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043a\u043b\u0438\u0435\u043d\u0442:  <\/p>\n<pre><code class=\"bash\">rdclient device.py <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043a\u0440\u0430\u0442\u043a\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0434\u043b\u044f \u0435\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430.<\/p>\n<p>  \u0414\u043b\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0435\u0441\u0442\u044c \u0443\u0436\u0435 \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u043c\u0438\u043a\u0441\u0438\u043d\u044b:  <\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/nvbn\/rdevices-client\/blob\/develop\/rdclient\/mixins\/arduino.py\">Arduino<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/nvbn\/rdevices-client\/blob\/develop\/rdclient\/mixins\/notify_send.py\">notify-send<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/nvbn\/rdevices-client\/blob\/develop\/rdclient\/mixins\/omxplayer.py\">OMXPlayer<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/nvbn\/rdevices-client\/blob\/develop\/rdclient\/mixins\/pactl.py\">pactl<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/nvbn\/rdevices-client\/blob\/develop\/rdclient\/mixins\/rhythmbox.py\">rhythmbox<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/nvbn\/rdevices-client\/blob\/develop\/rdclient\/mixins\/shell.py\">ls<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/nvbn\/rdevices-client\/blob\/develop\/rdclient\/mixins\/smplayer.py\">smplayer<\/a><\/li>\n<\/ul>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/184\/8e0\/910\/1848e0910e70e96a4fb0ba7f13243955.png\" align=\"right\"\/>  <\/p>\n<h4>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 API<\/h4>\n<p>  \u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c <a href=\"http:\/\/rdevic.es\/accounts\/nvbn\/keys\/\">\u043a\u043b\u044e\u0447 \u0434\u043b\u044f \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a API<\/a>.<\/p>\n<p>  \u0412\u0441\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0432 json \u0438\u043b\u0438 xml \u0438 \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"coffeescript\">Accept: application\/json Content-type: application\/json <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c POST-\u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0430 <code>http:\/\/rdevic.es\/api\/v1\/device_method_call?username=USERNAME&api_key=API_KEY\/<\/code> \u0441 \u0442\u0435\u043b\u043e\u043c, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u043c \u043e\u0431\u044a\u0435\u043a\u0442(\u0432 json \u0438\u043b\u0438 xml):  <\/p>\n<pre><code class=\"javascript\">{     method: METHOD_NAME,     device: DEVICE_UUID,     request: {         arg1: 'arg1Value',         arg2: 'arg2Value'     } } <\/code><\/pre>\n<p>  \u0412 \u043e\u0442\u0432\u0435\u0442 \u043f\u0440\u0438\u0434\u0451\u0442:  <\/p>\n<pre><code class=\"javascript\">{     method_id: METHOD_ID,     request: {         arg1: 'arg1Value',         arg2: 'arg2Value'     },     response: {},     state: 0,     text_state: 'started',     id: CALL_ID,     resource_uri: '\/api\/v1\/device_method_call\/CALL_ID\/', } <\/code><\/pre>\n<p>  \u041e\u0431\u043d\u043e\u0432\u043b\u0451\u043d\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c, \u0441\u0434\u0435\u043b\u0430\u0432 GET-\u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <code>resource_uri?username=USERNAME&api_key=API_KEY<\/code>. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u0437\u043e\u0432\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043f\u043e\u043b\u0435 <code>response<\/code>. \u0421\u0442\u0430\u0442\u0443\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u0430 \u0432 <code>state<\/code>. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f:  <\/p>\n<pre><code class=\"python\">STATE_CREATED = 0 STATE_FINISHED = 1 STATE_ERROR = 2 <\/code><\/pre>\n<p>  \u0417\u0430\u043f\u0440\u043e\u0441 \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0441 <code>curl<\/code>:  <\/p>\n<pre><code class=\"bash\">curl &quot;http:\/\/rdevic.es\/api\/v1\/device_method_call\/?username=nvbn&api_key=45932208bfb91d5ba8c9ab82137026c76ece69a8&quot; -H &quot;Accept: application\/json&quot; -H &quot;Content-type: application\/json&quot; -X POST -d &quot;{\\&quot;method\\&quot;:\\&quot;arduino_write\\&quot;,\\&quot;device\\&quot;:\\&quot;bcc97caa-a09b-11e2-a15d-009c02975edf\\&quot;,\\&quot;request\\&quot;:{\\&quot;data\\&quot;: \\&quot;clear\\nwrite:Hello habr\\!\\n\\&quot;}}&quot; <\/code><\/pre>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0435\u0433\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u043d\u0435 \u043f\u0435\u0440\u0432\u043e\u0439 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/65c\/a0a\/e5c\/65ca0ae5c3b0ea481a1ab5af474b1269.png\" align=\"right\"\/><\/p>\n<h4>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u0431\u043e\u0440\u043d\u043e\u0439 \u043f\u0430\u043d\u0435\u043b\u0438<\/h4>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u0430\u043c \u043d\u0443\u0436\u043d\u043e <a href=\"http:\/\/rdevic.es\/devices\/dashboard\/create\/\">\u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0435\u0451 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435<\/a> \u0438 \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u0434\u0430.<br \/>  \u0421\u043a\u0440\u0438\u043f\u0442\u044b \u043c\u043e\u0436\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430 JavaScript(<code>type=&quot;javascript&quot;<\/code>), CoffeeScript(<code>type=&quot;coffeescript&quot;<\/code>) \u0438 IcedCoffeeScript(<code>type=&quot;iced-coffeescript&quot;<\/code>).<br \/>  \u0412 \u043d\u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c dashboard api, \u043e\u043d\u043e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442:  <\/p>\n<ul>\n<li><code>dashboard.ready(callback)<\/code> \u2014 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u0440\u0438\u0431\u043e\u0440\u043d\u043e\u0439 \u043f\u0430\u043d\u0435\u043b\u0438;<\/li>\n<li><code>dashboard.getDevice(deviceId, callback)<\/code> \u2014 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0432 callback;<\/li>\n<li><code>device.method(args, [callback])<\/code> \u2014 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 callback. <code>args<\/code> \u2014 \u043e\u0431\u044a\u0435\u043a\u0442, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0439 <code>\u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442: \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430<\/code>.<\/li>\n<\/ul>\n<p>  \u041a\u0430\u043a \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0430\u043d\u0435\u043b\u0438 \u2014 \u043f\u0443\u043b\u044c\u0442 \u0434\u043b\u044f rhythmbox(\u043c\u0438\u043a\u0441\u0438\u043d <code>rdclient.mixins.RhythmboxMixin<\/code>):  <\/p>\n<pre><code class=\"html\">&lt;script type='text\/javascript'&gt;     dashboard.ready(function(){         dashboard.getDevice(DEVICE_ID, function(device){             $('#prev').click(function(){                 device.rhythmbox_previous({});             });                          $('#next').click(function(){                 device.rhythmbox_next({});             });                          $('#play-pause').click(function(){                 device.rhythmbox_play_pause({});             });         });     }); &lt;\/script&gt;  &lt;button class='btn' id='prev'&gt;Prev&lt;\/button&gt; &lt;button class='btn' id='play-pause'&gt;Play\/pause&lt;\/button&gt; &lt;button class='btn' id='next'&gt;Next&lt;\/button&gt; <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0438\u0437\u0431\u0435\u0436\u0430\u043d\u0438\u044f \u043b\u0435\u0441\u0435\u043d\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c IcedCoffeeScript. \u0421 \u043d\u0438\u043c \u0447\u0430\u0441\u0442\u044c \u0441\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"html\">&lt;script type='text\/iced-coffeescript'&gt;     await dashboard.ready     await dashboard.getDevice DEVICE_ID, defer device          $('#prev').click =&gt;         device.rhythmbox_previous {}          $('#next').click =&gt;         device.rhythmbox_next {}          $('#play-pause').click =&gt;         device.rhythmbox_play_pause {} &lt;\/script&gt; <\/code><\/pre>\n<h4>\u041f\u043b\u0430\u043d\u044b \u043d\u0430 \u0431\u0443\u0434\u0443\u0449\u0435\u0435<\/h4>\n<p>  \u0421\u0435\u0439\u0447\u0430\u0441 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438. \u0415\u0449\u0451 \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u044e\u0442\u0441\u044f:  <\/p>\n<ul>\n<li>event&#8217;\u044b \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430;<\/li>\n<li>git \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u043c\u0438 \u00ab\u043f\u0430\u043d\u0435\u043b\u044f\u043c\u0438\u00bb;<\/li>\n<li>\u043a\u043b\u044e\u0447\u0438 api \u0441 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u044b\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u043c \u043a \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u043c \u0438 \u043c\u0435\u0442\u043e\u0434\u043e\u043c.<\/li>\n<\/ul>\n<p>  P.S. \u0432\u0441\u0435 \u043a\u043b\u044e\u0447\u0438 \u0438 uuid \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043d\u0435\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435.    \t \t\t   \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/177755\/\"> http:\/\/habrahabr.ru\/post\/177755\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t<img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/47b\/87b\/ef5\/47b87bef5734b0b9499e0fa6abdb1361.jpg\" align=\"right\"\/>\u0427\u0442\u043e \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c:<\/p>\n<ul>\n<li>\u043f\u0440\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438 \u0437\u0430\u0434\u0430\u0447\u0438 \u0432 jenkins \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043d\u0430 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435 \u0438 \u043a\u0430\u043a \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u2014 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0435\u0433\u043e \u043d\u0430 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0434\u0438\u0441\u043f\u043b\u0435\u0439, \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0439 \u043a arduino;<\/li>\n<li>\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u043d\u0430 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u0435 \u0438\u043b\u0438 \u043f\u043b\u0430\u043d\u0448\u0435\u0442\u0435, \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u043c\u0443\u0437\u044b\u043a\u0438 \u043d\u0430 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0435 \u0438 \u0432\u0438\u0434\u0435\u043e\u043f\u043b\u0435\u0435\u0440\u043e\u043c \u043d\u0430 raspberry pi;<\/li>\n<li>\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0439 \u0441\u043d\u0430\u0440\u0443\u0436\u0438 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438, \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441 \u0434\u0430\u0442\u0447\u0438\u043a\u043e\u0432, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0445 \u043d\u0430 ardiono.<\/li>\n<\/ul>\n<p>  \u0427\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c:<\/p>\n<ul>\n<li>\u043a\u043b\u0438\u0435\u043d\u0442, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c\u044b\u0439 \u043d\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435, \u0441 \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0446\u0438\u0435\u0439 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u043d\u0430 python;<\/li>\n<li>RESTful api \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u00ab\u043c\u0435\u0442\u043e\u0434\u043e\u0432\u00bb(\u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u0441\u043f\u0440\u0430\u0432\u0430 \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u0430 \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0433\u043e);<\/li>\n<li>\u00ab\u043f\u0430\u043d\u0435\u043b\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u00bb \u0441 web-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u043e\u043c;<\/li>\n<li>\u0441\u0435\u0440\u0432\u0438\u0441 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u043c\u0438, \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u0438 \u043f\u0430\u043d\u0435\u043b\u044f\u043c\u0438.<\/li>\n<\/ul>\n<p>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-177755","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/177755","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=177755"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/177755\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=177755"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=177755"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=177755"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}