User Tools

Site Tools


mqttlamp

MqttLamp

This module is a part of the NetHomeServer. The MqttLamp behaves like a standard lamp, and controls a lamp/switch via MQTT. You configure the topic of the device you want to control and the messages used to turn the device on or off. The MqttLamp will also listen on that topic for those messages to update the state if it is changed from another source. Note that you need to have a MqttClient configured to connect to the MQTT broker you are using and that this MqttClient must subscribe for the lamps topic in order for the lamp to be able to update state.

Attributes

  • State [get] [set] Current state of the lamp, “On” or “Off”
  • Topic [get] [set] The topic the messages will be sent to, the topic of the device you want to control
  • OnMessage [get] [set] Message to send to turn the device on
  • OffMessage [get] [set] Message to send to turn the device off
  • QOS [get] [set] MQTT Quality of service level
  • Retain [get] [set] MQTT Retain flag
  • MqttClient [get] [set] Optional identity of MqttClient to use to send the messages. If this is left empty, the messages will be sent by all MqttClients in the OpenNetHome Server.

Actions

  • On Turn lamp on (send the on-message)
  • Off Turn lamp off (send the off-message)
  • Toggle Toggle state of the lamp

See also

mqttlamp.txt · Last modified: 2018/11/03 02:59 by 127.0.0.1