mqtt-homeassistant 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 63f377ed2f680df05fcdd443d7827be88ad49630b6a2e046a1291f3ccbe1fe41
4
- data.tar.gz: 9f48fd3a21b57073ae31bc488c5f8fda3369a2e3d2ef37d41426e1865d1d307a
3
+ metadata.gz: e2701bd3fb3bde99e200213253949dbe73787ada219260463309ea1f27dcd9af
4
+ data.tar.gz: 3c58be7186fb3aa443e6d1ff33b5282549988422536daf34c430415effece799
5
5
  SHA512:
6
- metadata.gz: e378a1edd2a12093be108cb9b1685393422274fcc65b578dee2e73c0a429a06dc35f17889f113998ac03a3f4a936fb01028a07f201061dc5420b3557b204b0f2
7
- data.tar.gz: 82f86cf62752b56a357844149c2b51952a9fa448783a29e2396053a77648d73acae97921db149a7745a423b97edbd606bd53185f8431b865026383d7cb7d2227
6
+ metadata.gz: 2257944fc2298287e7c9cd6ffa8b2afd4edd7c22c7a47165817cd8b7ee32084e4e11b7fd30fc794805472cb06c9f608d4d4c587b7685ebdb2e4f1df20ca4777f
7
+ data.tar.gz: 60a670f138fe6378810cc5b86291a99d92084dfaf509769c67f515132f51ad336fb421cae45f8192113e5e1a01a48cc98fad110218a73071b4c78a3f59f553f8
@@ -2,6 +2,6 @@
2
2
 
3
3
  module MQTT
4
4
  module HomeAssistant
5
- VERSION = "0.0.1"
5
+ VERSION = "0.0.2"
6
6
  end
7
7
  end
@@ -159,8 +159,9 @@ module MQTT
159
159
  entity_category: entity_category,
160
160
  icon: icon)
161
161
  config[:unique_id] = "#{node.device.id}_#{id || node.id}"
162
+ read_only_props = %i[action current_temperature]
162
163
  properties.each do |prefix, property|
163
- add_property(config, property, prefix, templates)
164
+ add_property(config, property, prefix, templates, read_only: read_only_props.include?(prefix))
164
165
  end
165
166
  temp_properties = [
166
167
  temperature_property,
@@ -472,16 +473,17 @@ module MQTT
472
473
 
473
474
  private
474
475
 
475
- def add_property(config, property, prefix = nil, templates = {})
476
+ def add_property(config, property, prefix = nil, templates = {}, read_only: false)
476
477
  return unless property
477
478
 
478
479
  prefix = "#{prefix}_" if prefix
479
- config[:"#{prefix}state_topic"] = property.topic if property.retained?
480
- if property.settable?
480
+ state_prefix = "state_" unless read_only
481
+ config[:"#{prefix}#{state_prefix}topic"] = property.topic if property.retained?
482
+ if !read_only && property.settable?
481
483
  config[:"#{prefix}command_topic"] = "#{property.topic}/set"
482
484
  config[:"#{prefix}command_template"] = "{{ value | round(0) }}" if property.datatype == :integer
483
485
  end
484
- config.merge!(templates.slice(:"#{prefix}_template", :"#{prefix}_command_template"))
486
+ config.merge!(templates.slice(:"#{prefix}template", :"#{prefix}command_template"))
485
487
  end
486
488
 
487
489
  def add_enum(config, property, prefix = nil, valid_set = nil)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mqtt-homeassistant
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cody Cutrer