Class: EvokToMqtt::Mappers::Raw

Inherits:
Object
  • Object
show all
Defined in:
lib/evok-to-mqtt/mappers/raw.rb

Instance Method Summary collapse

Constructor Details

#initialize(mapping) ⇒ Raw

Returns a new instance of Raw.



4
5
6
# File 'lib/evok-to-mqtt/mappers/raw.rb', line 4

def initialize(mapping)
  @mapping_config  = mapping
end

Instance Method Details

#circuit_reverse_lookup(full_topic) ⇒ Object



17
18
19
# File 'lib/evok-to-mqtt/mappers/raw.rb', line 17

def circuit_reverse_lookup(full_topic)
  return full_topic.split("/").last
end

#process(mqtt, evok_event) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/evok-to-mqtt/mappers/raw.rb', line 8

def process(mqtt, evok_event)
  id = get_topic(evok_event["dev"], evok_event["circuit"])
  
  puts "Target topic: #{id}"
  mqtt.publish id, evok_event

  puts
end