neohub 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +47 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/pry +11 -0
- data/bin/setup +8 -0
- data/exe/neohub +127 -0
- data/lib/neohub.rb +6 -0
- data/lib/neohub/neohub.rb +218 -0
- data/lib/neohub/version.rb +3 -0
- data/neohub.gemspec +27 -0
- metadata +101 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e9df3508e7ce3a267a44e13ca6ec0983d3e73ff3
|
4
|
+
data.tar.gz: b3349a11fa48cffacbc7145e58f2828c6ae4fe85
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e47f11326a4edf4dc179d93ab0238930c6e27fb5a9dd15c92f9eb6f73ee4477fadaffbbeb59cd3e9526e80e55af168d7f34c1ae836474f78d33df574f8866c53
|
7
|
+
data.tar.gz: 50f41f6bb1bf10ae82a3ab54f7233dfdc290707efd0db5be5c50360e36644a36da5d9b00796bd9a22083f663fc748aed2d8df24d817af5155c2d7be99d6d3f34
|
data/.gitignore
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at vlatko.kosturjak@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Vlatko Kosturjak
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# Neohub
|
2
|
+
|
3
|
+
Interface to Neohub in the cloud. Control your thermostat by ruby script.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'neohub'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install neohub
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
require 'neohub'
|
25
|
+
|
26
|
+
nh=Neohub.new
|
27
|
+
nh.login('user@email.com','password')
|
28
|
+
|
29
|
+
```
|
30
|
+
|
31
|
+
run `bin/console` for an interactive prompt.
|
32
|
+
|
33
|
+
## Development
|
34
|
+
|
35
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
36
|
+
|
37
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
38
|
+
|
39
|
+
## Contributing
|
40
|
+
|
41
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/neohub. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
42
|
+
|
43
|
+
|
44
|
+
## License
|
45
|
+
|
46
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
47
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "neohub"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/pry
ADDED
data/bin/setup
ADDED
data/exe/neohub
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "neohub"
|
5
|
+
|
6
|
+
$PRGNAME='neohub'
|
7
|
+
|
8
|
+
# helpful class for logger
|
9
|
+
class MultiDelegator
|
10
|
+
def initialize(*targets)
|
11
|
+
@targets = targets
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.delegate(*methods)
|
15
|
+
methods.each do |m|
|
16
|
+
define_method(m) do |*args|
|
17
|
+
@targets.map { |t| t.send(m, *args) }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
self
|
21
|
+
end
|
22
|
+
|
23
|
+
class <<self
|
24
|
+
alias to new
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# default $options
|
29
|
+
$options = {}
|
30
|
+
$options[:loglevel] = 'WARN'
|
31
|
+
$options[:logname] = nil
|
32
|
+
$options[:autologin] = true
|
33
|
+
$options[:devkey] = nil
|
34
|
+
|
35
|
+
$confyaml=ENV['HOME']+'/.neohub'
|
36
|
+
|
37
|
+
begin
|
38
|
+
optyaml = YAML::load_file($confyaml)
|
39
|
+
rescue # Errno::ENOENT
|
40
|
+
end
|
41
|
+
|
42
|
+
if optyaml != nil then
|
43
|
+
$options.merge!(optyaml)
|
44
|
+
end
|
45
|
+
|
46
|
+
# initialize logger
|
47
|
+
if $options[:logname] != nil then
|
48
|
+
log_file = File.open($options['logname'], 'a')
|
49
|
+
@log = Logger.new MultiDelegator.delegate(:write, :close).to(STDERR, log_file)
|
50
|
+
else
|
51
|
+
@log = Logger.new MultiDelegator.delegate(:write, :close).to(STDERR)
|
52
|
+
end
|
53
|
+
loglevel = Logger.const_get $options[:loglevel] # Logger::INFO # default is ::WARN
|
54
|
+
@log.level = loglevel
|
55
|
+
|
56
|
+
# pp $options
|
57
|
+
|
58
|
+
OptionParser.new do |opts|
|
59
|
+
opts.banner = "Usage: #{$PRGNAME} [options]"
|
60
|
+
|
61
|
+
opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
|
62
|
+
$options['verbose'] = v
|
63
|
+
@log.level = Logger::INFO
|
64
|
+
end
|
65
|
+
|
66
|
+
opts.on("-d", "--[no-]debug", "Run in debug mode") do |v|
|
67
|
+
$options['debug'] = v
|
68
|
+
@log.level = Logger::DEBUG
|
69
|
+
end
|
70
|
+
|
71
|
+
opts.on("-h", "--help", "Prints this help") do
|
72
|
+
puts opts
|
73
|
+
exit
|
74
|
+
end
|
75
|
+
|
76
|
+
opts.on("-a", "--[no-]autologin", "auto login") do |v|
|
77
|
+
$options[:autologin] = v
|
78
|
+
end
|
79
|
+
|
80
|
+
opts.on("-k", "--devkey KEY", "specify DEVKEY") do |optarg|
|
81
|
+
$options[:devkey] = optarg
|
82
|
+
end
|
83
|
+
|
84
|
+
opts.on("-c", "--command COMMAND", "specify COMMAND") do |optarg|
|
85
|
+
$options[:command] = optarg
|
86
|
+
end
|
87
|
+
|
88
|
+
opts.on("-i", "--info", "specify DEVKEY") do |optarg|
|
89
|
+
$options[:info] = optarg
|
90
|
+
end
|
91
|
+
|
92
|
+
opts.on("-u", "--user USERNAME", "specify USERNAME") do |optarg|
|
93
|
+
$options[:user] = optarg
|
94
|
+
end
|
95
|
+
|
96
|
+
opts.on("-p", "--pass PASSWORD", "specify PASSWORD") do |optarg|
|
97
|
+
$options[:pass] = optarg
|
98
|
+
end
|
99
|
+
|
100
|
+
opts.on("-U", "--url URL", "use URL for connecting") do |optarg|
|
101
|
+
$options[:url] = optarg
|
102
|
+
end
|
103
|
+
|
104
|
+
opts.on("-l", "--log FILE", "log to FILE") do |optarg|
|
105
|
+
$options[:logname] = optarg
|
106
|
+
end
|
107
|
+
|
108
|
+
opts.separator ""
|
109
|
+
opts.separator "Example #1: #{$PRGNAME} -k 1 -u user -p password"
|
110
|
+
end.parse!
|
111
|
+
|
112
|
+
# pp $options
|
113
|
+
|
114
|
+
# for future use
|
115
|
+
if ARGV.empty?
|
116
|
+
else
|
117
|
+
end
|
118
|
+
|
119
|
+
$n=Neohub::Neohub.new($options)
|
120
|
+
|
121
|
+
if $options.has_key?(:pass) and $options[:autologin] then
|
122
|
+
|
123
|
+
if $options[:info] then
|
124
|
+
puts $n.getdevices()
|
125
|
+
end
|
126
|
+
|
127
|
+
|
data/lib/neohub.rb
ADDED
@@ -0,0 +1,218 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'net/http'
|
4
|
+
require 'json'
|
5
|
+
require 'logger'
|
6
|
+
|
7
|
+
module Neohub
|
8
|
+
|
9
|
+
class Neohub
|
10
|
+
attr_accessor :user,:url,:token,:devices,:pass,:devid,:max_tries,:devkey,:autologin,:vendorid,:devicetypeid
|
11
|
+
|
12
|
+
def initialize(params={})
|
13
|
+
@url=params.fetch(:url,'https://neohub.co.uk')
|
14
|
+
@uri=URI(@url)
|
15
|
+
@http = Net::HTTP.new(@uri.host, @uri.port)
|
16
|
+
@ssl=params.fetch(:ssl, true)
|
17
|
+
if @ssl then
|
18
|
+
@http.use_ssl = true
|
19
|
+
end
|
20
|
+
@debug=params.fetch(:debug, false)
|
21
|
+
setupdebug()
|
22
|
+
@devicetypeid=params.fetch(:devicetypeid,2)
|
23
|
+
@devkey=params.fetch(:devkey, nil) # holderid
|
24
|
+
@devid=params.fetch(:devid, nil)
|
25
|
+
@vendorid=params.fetch(:vendorid, 1)
|
26
|
+
@max_tries=params.fetch(:max_tries, 10)
|
27
|
+
@user=params.fetch(:user, nil)
|
28
|
+
@pass=params.fetch(:pass, nil)
|
29
|
+
@autologin=params.fetch(:autologin, true)
|
30
|
+
@token=nil
|
31
|
+
if not @pass.nil? and @autologin then
|
32
|
+
login(@user,@pass)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def setupdebug
|
37
|
+
if @debug then
|
38
|
+
@http.set_debug_output $stderr
|
39
|
+
@logger = Logger.new(STDERR)
|
40
|
+
@logger.level = Logger::DEBUG
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def httpreq(uri,params)
|
45
|
+
req = Net::HTTP::Post.new(uri, {})
|
46
|
+
req.delete("user-agent")
|
47
|
+
req.set_form_data(params)
|
48
|
+
response = @http.request(req)
|
49
|
+
return response
|
50
|
+
end
|
51
|
+
|
52
|
+
def httpauthreq(uri,params)
|
53
|
+
authparams={
|
54
|
+
'token'=>@token,
|
55
|
+
'devkey'=>@devkey,
|
56
|
+
'vendorid'=>@vendorid,
|
57
|
+
'devicetypeid' => @devicetypeid
|
58
|
+
}
|
59
|
+
merged=authparams.merge(params)
|
60
|
+
return httpreq(uri,merged)
|
61
|
+
end
|
62
|
+
|
63
|
+
def jsonreq(uri,params)
|
64
|
+
resp=httpauthreq(uri,params)
|
65
|
+
jresp=JSON.parse(resp.body)
|
66
|
+
if jresp['STATUS']==401 then
|
67
|
+
login(@user,@pass)
|
68
|
+
resp=httpauthreq(uri,params)
|
69
|
+
jresp=JSON.parse(resp.body)
|
70
|
+
end
|
71
|
+
return jresp
|
72
|
+
end
|
73
|
+
|
74
|
+
def login(user,pass)
|
75
|
+
@user=user
|
76
|
+
params={
|
77
|
+
'USERNAME'=>@user,
|
78
|
+
'PASSWORD'=>pass,
|
79
|
+
'devkey'=>@devkey,
|
80
|
+
'vendorid'=>@vendorid,
|
81
|
+
'devicetypeid' => @devicetypeid
|
82
|
+
}
|
83
|
+
resp=httpreq('/hm_user_login',params)
|
84
|
+
jresp=JSON.parse(resp.body)
|
85
|
+
if jresp.has_key?('STATUS')
|
86
|
+
if jresp['STATUS']==1 then
|
87
|
+
@token=jresp['TOKEN']
|
88
|
+
@devices=jresp['devices']
|
89
|
+
@pass=pass
|
90
|
+
return jresp
|
91
|
+
end
|
92
|
+
end
|
93
|
+
return nil
|
94
|
+
end
|
95
|
+
|
96
|
+
def getdevices()
|
97
|
+
params={
|
98
|
+
'USERNAME'=>@user,
|
99
|
+
}
|
100
|
+
return jsonreq('/hm_get_devices',params)
|
101
|
+
end
|
102
|
+
|
103
|
+
def device_status(device_id)
|
104
|
+
params={
|
105
|
+
'device_id'=>device_id,
|
106
|
+
}
|
107
|
+
jsonresp=jsonreq('/hm_device_status',params)
|
108
|
+
if jsonresp['devices'][0].has_key?('deviceid') then
|
109
|
+
@devid=jsonresp['devices'][0]['deviceid']
|
110
|
+
end
|
111
|
+
return jsonresp
|
112
|
+
end
|
113
|
+
|
114
|
+
def sendsscommand(device_id,command)
|
115
|
+
params={
|
116
|
+
# 'location_id'=>location_id,
|
117
|
+
'devices'=>device_id,
|
118
|
+
'command'=>command
|
119
|
+
}
|
120
|
+
return jsonreq('/hm_ss_multicommand',params)
|
121
|
+
end
|
122
|
+
|
123
|
+
def sendaddcommand(dev_id,command)
|
124
|
+
@logger.debug(command)
|
125
|
+
params={
|
126
|
+
'device_id'=>dev_id,
|
127
|
+
'command'=>command
|
128
|
+
}
|
129
|
+
return jsonreq('/hm_add_command',params)
|
130
|
+
end
|
131
|
+
|
132
|
+
def set_temp(dev_id,temp)
|
133
|
+
cmdstr="{'SET_TEMP':[#{temp},'#{dev_id}']}"
|
134
|
+
return sendaddcommand(dev_id,cmdstr)
|
135
|
+
end
|
136
|
+
|
137
|
+
def get_geo_state(device_id)
|
138
|
+
params={
|
139
|
+
'device_id'=>device_id,
|
140
|
+
'username'=>@user,
|
141
|
+
}
|
142
|
+
return jsonreq('/hm_geo_state',params)
|
143
|
+
end
|
144
|
+
|
145
|
+
def away_on(dev_id)
|
146
|
+
cmdstr="{'AWAY_ON': [#{dev_id}]}"
|
147
|
+
return sendaddcommand(dev_id,cmdstr)
|
148
|
+
end
|
149
|
+
|
150
|
+
def away_off(dev_id)
|
151
|
+
cmdstr="{'AWAY_OFF': [#{dev_id}]}"
|
152
|
+
return sendaddcommand(dev_id,cmdstr)
|
153
|
+
end
|
154
|
+
|
155
|
+
def frost_on(dev_id)
|
156
|
+
cmdstr="{'FROST_ON':[#{dev_id}]}"
|
157
|
+
return sendaddcommand(dev_id,cmdstr)
|
158
|
+
end
|
159
|
+
|
160
|
+
def frost_off(dev_id)
|
161
|
+
cmdstr="{'FROST_OFF':[#{dev_id}]}"
|
162
|
+
return sendaddcommand(dev_id,cmdstr)
|
163
|
+
end
|
164
|
+
|
165
|
+
def hold_temp(dev_id,temp,hour,min)
|
166
|
+
# {'HOLD': [{'temp' : 21,'id':'X','hours':0,'minutes':0},'X']}
|
167
|
+
cmdstr="{'HOLD': [{'temp' : #{temp},'id':'#{dev_id}','hours':#{hour},'minutes':#{min}},'#{dev_id}']}"
|
168
|
+
return sendaddcommand(dev_id,cmdstr)
|
169
|
+
end
|
170
|
+
|
171
|
+
def hold_cancel_all(dev_id)
|
172
|
+
cmdstr="{'CANCEL_HOLD_ALL':0}"
|
173
|
+
return sendaddcommand(dev_id,cmdstr)
|
174
|
+
end
|
175
|
+
|
176
|
+
def cmd_resp(dev_id, cmdstr)
|
177
|
+
@logger.debug(cmdstr)
|
178
|
+
params={
|
179
|
+
'device_id'=>dev_id,
|
180
|
+
'command'=>cmdstr
|
181
|
+
}
|
182
|
+
respadd=jsonreq('/hm_add_command',params)
|
183
|
+
@logger.debug(respadd)
|
184
|
+
command_id=respadd["COMMANDID"]
|
185
|
+
params={
|
186
|
+
'device_id'=>dev_id,
|
187
|
+
'command_id'=>command_id
|
188
|
+
}
|
189
|
+
respread='None'
|
190
|
+
try=0
|
191
|
+
while (respread=='None' and try<@max_tries) do
|
192
|
+
respresp=httpauthreq('/hm_get_response',params)
|
193
|
+
respread=respresp.body
|
194
|
+
sleep 5
|
195
|
+
try=try+1
|
196
|
+
end
|
197
|
+
@logger.debug(respread)
|
198
|
+
return respread
|
199
|
+
end
|
200
|
+
|
201
|
+
def read_comfort_levels(dev_id)
|
202
|
+
# {'READ_COMFORT_LEVELS':['X']}
|
203
|
+
cmdstr="{'READ_COMFORT_LEVELS':['#{dev_id}']}"
|
204
|
+
return cmd_resp(dev_id, cmdstr)
|
205
|
+
end
|
206
|
+
|
207
|
+
def read_dcb2(dev_id)
|
208
|
+
cmdstr="{'READ_DCB':['#{dev_id}']}"
|
209
|
+
return cmd_resp(dev_id, cmdstr)
|
210
|
+
end
|
211
|
+
|
212
|
+
def read_dcb(dev_id)
|
213
|
+
cmdstr="{'READ_DCB':100}"
|
214
|
+
return cmd_resp(dev_id, cmdstr)
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
end
|
data/neohub.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'neohub/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "neohub"
|
8
|
+
spec.version = Neohub::VERSION
|
9
|
+
spec.authors = ["Vlatko Kosturjak"]
|
10
|
+
spec.email = ["vlatko.kosturjak@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Interface to Neohub in the cloud.}
|
13
|
+
spec.description = %q{Interface to Neohub in the cloud. Control your thermostat by ruby script.}
|
14
|
+
spec.homepage = "https://github.com/kost/neohub-ruby"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
19
|
+
end
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.14"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
spec.add_development_dependency "pry", "> 0"
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: neohub
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Vlatko Kosturjak
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-10-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.14'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.14'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Interface to Neohub in the cloud. Control your thermostat by ruby script.
|
56
|
+
email:
|
57
|
+
- vlatko.kosturjak@gmail.com
|
58
|
+
executables:
|
59
|
+
- neohub
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- CODE_OF_CONDUCT.md
|
65
|
+
- Gemfile
|
66
|
+
- LICENSE.txt
|
67
|
+
- README.md
|
68
|
+
- Rakefile
|
69
|
+
- bin/console
|
70
|
+
- bin/pry
|
71
|
+
- bin/setup
|
72
|
+
- exe/neohub
|
73
|
+
- lib/neohub.rb
|
74
|
+
- lib/neohub/neohub.rb
|
75
|
+
- lib/neohub/version.rb
|
76
|
+
- neohub.gemspec
|
77
|
+
homepage: https://github.com/kost/neohub-ruby
|
78
|
+
licenses:
|
79
|
+
- MIT
|
80
|
+
metadata: {}
|
81
|
+
post_install_message:
|
82
|
+
rdoc_options: []
|
83
|
+
require_paths:
|
84
|
+
- lib
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
requirements: []
|
96
|
+
rubyforge_project:
|
97
|
+
rubygems_version: 2.6.10
|
98
|
+
signing_key:
|
99
|
+
specification_version: 4
|
100
|
+
summary: Interface to Neohub in the cloud.
|
101
|
+
test_files: []
|