Skip to content

Home Assistant

246 Topics 1.8k Posts
  • Node 0 unknown, error decoding message from gateway

    15
    0 Votes
    15 Posts
    3k Views
    martinhjelmareM
    Happy to help and great to hear about user stories and also any feedback, both when things are working and when things are not working or missing features.
  • Need a refresher on presentation and HA

    5
    0 Votes
    5 Posts
    2k Views
    D
    @martinhjelmare Thanks, i finally got it. I went to the example you have on home-assistant.io and removed the button and added a second actuator. Works like it should now. You are the king! Final code for anyone whom it may help/want it. /* * Documentation: http://www.mysensors.org * Support Forum: http://forum.mysensors.org * * http://www.mysensors.org/build/relay * * *Holiday LED Lights MySensors Module, for MySensors v2.0 * Nothing fancy, just a two actuator (on/off) virtual switch for small * low powred LED strings that normally run from a battery pack. * * */ #define MY_DEBUG #define MY_RADIO_NRF24 #define MY_REPEATER_FEATURE #define MY_NODE_ID 24 // or comment out for auto #include <SPI.h> #include <MySensors.h> #define MULTI_PIN 3 // Pin that Multi-Coloured LED string is connected to #define WHITE_PIN 5 // Pin that White LED string is connected to #define CHILD_ID_MULTI 1 // Child ID for Multi-Coloured LED String #define CHILD_ID_WHITE 2 // Child ID for White LED String #define MULTI_ON 1 #define MULTI_OFF 0 #define WHITE_ON 1 #define WHITE_OFF 0 bool stateMULTI = false; // Place holders for the loop function to register nodes in Home-Assistant bool initialValueSentMULTI = false; bool stateWHITE = false; bool initialValueSentWHITE = false; MyMessage msgMULTI(CHILD_ID_MULTI, V_STATUS); //Presentation of Switch for Multi-Coloured LEDS MyMessage msgWHITE(CHILD_ID_WHITE, V_STATUS); //Presentation of Switch for White LEDS void setup() { // Make sure relays are off when starting up digitalWrite(MULTI_PIN, MULTI_OFF); pinMode(MULTI_PIN, OUTPUT); digitalWrite(WHITE_PIN, WHITE_OFF); pinMode(WHITE_PIN, OUTPUT); } void presentation() { sendSketchInfo("HolidayDeskLights", "1.0"); present(CHILD_ID_MULTI, S_LIGHT); present(CHILD_ID_WHITE, S_LIGHT); } void loop() { if (!initialValueSentMULTI) { Serial.println("Sending initial value"); send(msgMULTI.set(stateMULTI?MULTI_ON:MULTI_OFF)); Serial.println("Requesting initial value from controller"); request(CHILD_ID_MULTI, V_STATUS); wait(2000, C_SET, V_STATUS); } if (!initialValueSentWHITE) { Serial.println("Sending initial value"); send(msgWHITE.set(stateWHITE?WHITE_ON:WHITE_OFF)); Serial.println("Requesting initial value from controller"); request(CHILD_ID_WHITE, V_STATUS); wait(2000, C_SET, V_STATUS); } } void receive(const MyMessage &message) { if (message.isAck()) { Serial.println("This is an ack from gateway"); } if (message.type == V_STATUS && message.sensor == CHILD_ID_MULTI) { if (!initialValueSentMULTI) { Serial.println("Receiving initial value from controller"); initialValueSentMULTI = true; } // Change relay state stateMULTI = (bool)message.getInt(); digitalWrite(MULTI_PIN, stateMULTI?MULTI_ON:MULTI_OFF); send(msgMULTI.set(stateMULTI?MULTI_ON:MULTI_OFF)); } if (message.type == V_STATUS && message.sensor == CHILD_ID_WHITE) { if (!initialValueSentWHITE) { Serial.println("Receiving initial value from controller"); initialValueSentWHITE = true; } // Change relay state stateWHITE = (bool)message.getInt(); digitalWrite(WHITE_PIN, stateWHITE?WHITE_ON:WHITE_OFF); send(msgWHITE.set(stateWHITE?WHITE_ON:WHITE_OFF)); } }
  • Presentation failing

    8
    0 Votes
    8 Posts
    2k Views
    martinhjelmareM
    There are two presentation messages in the output. One is from the gateway presenting itself as node 0. One is from node 3 presenting child 10 as sensor type 5. There is no presentation of node 3 itself. Until a node is registered at the gateway it can't send any set/req messages. Registration happens after presentation is finished. In mysensors 2.0 registration is done after setup is called. In mysensors development branch setup is done after registration.
  • [Solved] Auto reset motion sensor state

    3
    0 Votes
    3 Posts
    3k Views
    abmantisA
    @martinhjelmare great idea! Thank you.
  • [solved] Sensor missing after restart

    5
    0 Votes
    5 Posts
    2k Views
    abmantisA
    @martinhjelmare I just updated to the latest version and now they appear correctly after rebooting! Thank you very much.
  • Reversed Relay

    8
    0 Votes
    8 Posts
    2k Views
    martinhjelmareM
    In mysensors 2.0 setup is called before registering the sensors at the gateway, so values can't be sent during setup in 2.0. This is changed in 2.1.
  • Can't add nodes to HA

    9
    0 Votes
    9 Posts
    4k Views
    krz2348K
    Thanks man ... now it's working.... :beer:
  • MySensors Hvac device

    6
    0 Votes
    6 Posts
    2k Views
    dpressleD
    https://github.com/home-assistant/home-assistant.github.io/pull/1484
  • Enable serial debugs from the RS485 GW in the log

    17
    0 Votes
    17 Posts
    4k Views
    BartB
    @martinhjelmare thanks. I am still not really good at git kung-fu to do it quickly. will try to do the PR when I have some spare time :)
  • request() not working with HomeAssistant

    5
    0 Votes
    5 Posts
    2k Views
    blaceyB
    @ajlisy Here are a couple of ideas: Do you ever see Got a message in your log? If not, what if you turn on acks in the send()? If you are receiving messages, you might want to add logging of the message.type. wait() will return true if it receives the message and command specified in the arguments and false if it doesn't (timer expired) so you could change your wait(2000, C_SET,V_STATUS); to the following to see what is happening at this point in the sketch: bool resp = wait( 2000, C_SET,V_STATUS ); Serial.print( "wait( 2000, C_SET, V_STATUS ) return = " ); Serial.println(resp ? "true" : "false"); If wait() returns true above, then that confirms that the node is receiving a V_STATUS back from the gateway so the basic request response is functioning. If that is the case, then what happens if you change the wait(2000,C_SET,V_STATUS); in loop() to wait( 1000 );? Perhaps wait()'ing on a specific message consumes that message from the queue preventing the receive() callback from being called? It is not clear that the second wait() is even needed... I would think this simplified version would work: void loop() { send( msg.set( flip = flip ? 0 : 1 ), false ); request( CHILD_ID, V_STATUS ); wait( 1000 ); } If you want to synchronize the node state with the Home Assistant controller, you can send the request message in setup() [NOTE: Requires development branch] void setup() { // Make sure relays are off when starting up digitalWrite(RELAY_PIN, RELAY_OFF); // Then set relay pins in output mode pinMode(RELAY_PIN, OUTPUT); //Synchronize relay state with gateway - this will result in receive() being called. request( CHILD_ID, V_STATUS ); }
  • Reconnect sensors after restart HA

    4
    0 Votes
    4 Posts
    2k Views
    Ernst79E
    I've updated HomeAssistant to 31.1 and can conform that it works again, as it should. Pymysensors is being updated to 0.80 by updating HomeAssistant. After a restart of HomeAssistant it updates the values of my sensors. Thanks.
  • MQTT topics from HA contains trailing slash

    6
    0 Votes
    6 Posts
    2k Views
    frizzy3dF
    That's excellent, thanks! I'm using a Node-RED function to change the topic name. That works for me until the fix is released.
  • "Node 1 is unknown" requires a restart. 2nd child element never presents

    9
    0 Votes
    9 Posts
    4k Views
    CravecodeC
    I'll create a pull request to update the Air Humidity Sensor example (DhtTemperatureAndHumiditySensor.ino) and reference this post.
  • No lights shown in GUI

    10
    0 Votes
    10 Posts
    2k Views
    martinhjelmareM
    Do you mean profiles and transition? Those are hardware specific features and not supported by mysensors lights.
  • This topic is deleted!

    6
    0 Votes
    6 Posts
    662 Views
  • Force update sensor from HA

    2
    0 Votes
    2 Posts
    2k Views
    martinhjelmareM
    @Bart Mysensors devices push their updates to home assistant. You can push an update to home assistant at a regular interval. If the state is the same as before in home assistant, a state change won't happen, so it should be harmless. For sensors, ie not actuators or binary sensors, I will soon implement forced updates, which mean an update from a sensor device will always force a state change, even if new state is the same as old state. This will enhance recording of sensor values eg when the same value is reported consecutively. Regarding syncing state at home assistant start, I think this can be solved for non sleeping devices by using discovery, I_DISCOVER, messages. This is on my todo.
  • Use child description as sensor name

    2
    0 Votes
    2 Posts
    968 Views
    martinhjelmareM
    This will need a PR to home assistant. I like the idea, so I'll put it on my todo list. PR is also welcome.
  • pymysensors specific forum?

    2
    0 Votes
    2 Posts
    1k Views
    martinhjelmareM
    @afeno There's no specific forum for pymysensors that I know. Home Assistant uses pymysensors, so maybe that's the closest? Regarding sending an internal message: Create a Message instance and use the copy method to set the types and child, internal, I_VERSION, 255 etc. You can look at other places in the code for how that is done, eg: https://github.com/theolind/pymysensors/blob/master/mysensors/mysensors.py#L83-L85 Then you want to encode the message and add it to the Gateway queue, for subsequent sending to gateway. There's the Gateway.fill_queue method for this. But you actually have to add a function with optional arguments/keyword arguments, where the return value of the function is the encoded message, to the queue. So you can add a reference to the encode method of the Message instance. See for example: https://github.com/theolind/pymysensors/blob/master/mysensors/mysensors.py#L325
  • Reconnect MySensors Ethernet Gateway when it is back

    2
    0 Votes
    2 Posts
    1k Views
    afenoA
    If you want more information about this known issue, please follow this thread on the HA forum: https://community.home-assistant.io/t/reconnect-mysensors-ethernet-gateway-when-it-is-back/3724
  • another relay problem....

    22
    0 Votes
    22 Posts
    6k Views
    G
    You've got it. Your a chief. I have deleted all references of empty files in my config file. And it works perfectly.... Youhou.!!!!!!!!!!!!!!!! Many thanks to all..... And now, automation.. Yeah!!!

17

Online

11.7k

Users

11.2k

Topics

113.0k

Posts