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
V

Vorace

@Vorace
About
Posts
1
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • 💬 Relay
    V Vorace

    Hi
    Using Home assistant, and Optimistic set to false in the mysensors config, the switch in homeassistant would turn the relay on, but in the view in homeassistant the flip switch jumped off straight after switching on. It was solved by adding the following line to the sketch, ensuring that hassio knows that the actuator actually have received the command. Not sure if this is a good way of doing it, but it seems to work for me.
    send(msg.set(state)); // Send new state and request ack back
    in:
    void receive(const MyMessage &message) {
    // We only expect one type of message from controller. But we better check anyway.
    if (message.isAck()) {
    Serial.println("This is an ack from gateway");
    }

    if (message.type == V_LIGHT) {
    // Change relay state
    state = message.getBool();
    digitalWrite(RELAY_PIN, state?RELAY_ON:RELAY_OFF);
    // Store state in eeprom
    saveState(CHILD_ID, state);

     // Write some debug info
     Serial.print("Incoming change for sensor:");
     Serial.print(message.sensor);
     Serial.print(", New status: ");
     Serial.println(message.getBool());
     send(msg.set(state)); // Send new state and request ack back
    

    }
    }

    Thanks

    Announcements
  • Login

  • Don't have an account? Register

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