Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
A

adi32k

@adi32k
About
Posts
4
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • MQTT/OpenHab gw.request reply
    A adi32k

    Thanks for the suggestion. I found another solution.

    I have the item like this:

    Switch Incalzire_Releu_GF_Living1 "Incalzire Releu Living 1" <heating> (Incalzire) {mqtt=">[mysensor:MyMQTT/3/1/V_HEATER_SW:command:ON:1],>[mysensor:MyMQTT/3/1/V_HEATER_SW:command:OFF:0],<[mysensor:MyMQTT/3/1/V_HEATER_SW:command:MAP(1on0off.map)]"}

    and in 1onoff.map i have:

    **1=ON
    0=OFF
    1.4.1=REQUEST
    **

    And then I have a rule:

    rule "SW1 Persist"
    when
    Item Incalzire_Releu_GF_Living1 received command
    then
    if (receivedCommand == "REQUEST")
    {
    sendCommand(Incalzire_Releu_GF_Living1 , Incalzire_Releu_GF_Living1.state);
    }
    end

    In the arduino code for the relay I have in the setu() this code.

    **void setup()
    {

    gw.begin(incomingMessage, AUTO, true);

    gw.sendSketchInfo("Relay Control", "1.0");

    for (int sensor=1 ; sensor<=NUMBER_OF_RELAYS;sensor++)
    {
    gw.present(sensor, S_HEATER);
    gw.request(sensor, V_HEATER_SW,0);
    }
    }**

    So whenever gw.request is called the idem receives an update with 1.4.1 that is resolved by the rule to the actual state of the switch in openhab.

    Like this, when arduino starts, the relays will be swiched ON as per the actual state of the switch.

    OpenHAB mqtt openhab
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular