Navigation

    • Register
    • Login
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. martinhjelmare
    3. Best
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Best posts made by martinhjelmare

    • Box for in wall pcb

      I'd like to have a box for in wall PCBs with exposed AC circuitry, due to safety concerns. Since space is very restricted I've started on a custom box design for 3d printing. If you have seen commercial samples that fit the criteria, feel free to add links/images here. Also if you want to add your own custom designs, please contribute.

      My design goals:
      Should fit inside a Swedish standard wall box behind the (lamp) switch. Diameter < 65 mm, depth < 30 mm.
      Should hold pcb project by @sundberg84 : http://forum.mysensors.org/topic/2488/in-wall-pcb

      Other in-wall-pcb box projects:

      • UK slimline wall box, depth < 25 mm.
        http://forum.mysensors.org/topic/2511/in-wall-light-switch-node-custom-pcb

      My first WIP design attempt (I'm new to CAD design):

      pcb_wall_box.stl

      pcb_wall_box_cropped.png

      posted in Hardware
      martinhjelmare
      martinhjelmare
    • RE: OTA firmware updating is too slow..

      I implemented a check for firmware update message in my modified SenseBenderMicro sketch, and alternative behavior in the loop if FW update is ongoing. This doesn't solve the problem of dropped messages, but could be good to speed up the update and don't waste time on sensor updates.

      void loop() {
        if (fwUpdateOngoing) {
          fwUpdateOngoing = false;
          fwUpdateOngoing = wait(OTA_WAIT_PERIOD, C_STREAM, ST_FIRMWARE_RESPONSE);
        } else {
          normalFlow();
        }
      }
      
      void normalFlow() {
        // Short delay to allow buttons to properly settle
        sleep(5);
      
        int buttonValue = digitalRead(BUTTON_PIN);
      
        measureCount ++;
        sendBattery ++;
        bool forceTransmit = false;
        transmission_occured = false;
      #ifndef MY_OTA_FIRMWARE_FEATURE
        if ((measureCount == 5) && highfreq)
        {
          clock_prescale_set(clock_div_8); // Switch to 1Mhz for the reminder of the sketch, save power.
          highfreq = false;
        }
      #endif
      
        if (measureCount > FORCE_TRANSMIT_INTERVAL) { // force a transmission
          forceTransmit = true;
          measureCount = 0;
        }
      
        sendTempHumidityMeasurements(forceTransmit);
        if (buttonValue != oldValue) {
           // Send in the new buttonValue
           send(msg.set(buttonValue==HIGH ? 0 : 1));
           oldValue = buttonValue;
           transmission_occured = true;
        }
      
      #ifdef MY_OTA_FIRMWARE_FEATURE
        if (transmission_occured) {
          fwUpdateOngoing = wait(OTA_WAIT_PERIOD, C_STREAM, ST_FIRMWARE_RESPONSE);
        }
      #endif
      
        sleep(digitalPinToInterrupt(BUTTON_PIN), CHANGE, MEASURE_INTERVAL);
      }
      
      posted in Bug Reports
      martinhjelmare
      martinhjelmare
    • RE: πŸ’¬ Sensebender Micro

      I've tested to upload a sketch to the Sensebender Micro using platformio.

      Put the following JSON into a json file in a folder named boards either in the MySensors library folder (your project in platformio), or somewhere else on the search path. Use the name of the json file in platformio.ini in the board setting. See for more info:
      http://docs.platformio.org/en/latest/platforms/creating_board.html

      • Create a folder named boards in MySensors project folder.
      • Create a file in boards named sensebendermicro8MHz.json.
      {
        "build": {
          "core": "arduino",
          "extra_flags": "-DARDUINO_ARCH_AVR -DARDUINO_AVR_PRO",
          "f_cpu": "8000000L",
          "mcu": "atmega328p",
          "variant": "standard"
        },
        "frameworks": [
          "arduino"
        ],
        "fuses": {
          "efuse": "0x06",
          "hfuse": "0xD2",
          "lfuse": "0xE2",
          "lock": "0x3F"
        },
        "name": "Sensebender Micro (3.3V, 8 MHz)",
        "upload": {
          "maximum_ram_size": 2048,
          "maximum_size": 30720,
          "protocol": "arduino",
          "require_upload_port": true,
          "speed": 57600
        },
        "url": "https://github.com/mysensors/SensebenderMicro",
        "vendor": "MySensors"
      }
      
      • Add an env in platformio.ini.
      [env:sensebendermicro8MHz]
      platform = atmelavr
      framework = arduino
      board = sensebendermicro8MHz
      lib_deps = MySensors
      
      • Compile sketch.
      • Upload sketch.

      I think I've got the settings correct, but it was the first time I did this. But it's tested and works as far as I can see.

      Should we add a JSON file to one of the mysensors repos on github?

      posted in OpenHardware.io
      martinhjelmare
      martinhjelmare
    • RE: Method to OTA a sleeping node

      Home assistant also supports smartsleep.

      posted in Development
      martinhjelmare
      martinhjelmare
    • Home Assistant v 0.12

      Version 0.12 of home assistant is now released. The mysensors component has seen three bugfixes and two refactors. This includes:

      • Fix error in unit_of_measurement, by adding version check. Both version 1.4 and 1.5 should now work.
      • Fix adding devices on the fly, without restart and without persistence enabled.

      I've also added information to the documentation at https://home-assistant.io/components/mysensors/. There's now a step by step instruction how to present your sensors and actuators to home assistant. You can also see exactly which S_TYPES and V_TYPES are supported by the sensor and switch platforms.

      All feedback, problem reports and suggestions are very welcome and appreciated. For example, the two mentioned bugs above were found by the community.

      Looking ahead, I'm working on making the serial connection more stable, an ethernet gateway, a light platform, and adding feedback state to the actuator platforms. I'm also planning to add support for value requests and acknowledgements.

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: Pooling battery relay

      Yes, smartsleep is supported. I explained how that is implemented in this post:
      https://forum.mysensors.org/topic/5440/heartbeats/3

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: Pooling battery relay

      @abmantis

      I didn't make the initial mysensors implementation in home assistant that only supported sensors, but I made the refactor that laid the groundwork for multiple mysensors platforms in home assistant. About 5-10 people has been contributing to the mysensors component in home assistant over time.

      There's also the pymysensors package (not my creation either) that interfaces mysensors and home assistant. It's actually this package that holds most of the mysensors specific logic, like smartSleep. Here there's also about 5-10 people that has contributed.

      All help and feedback is welcome!

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: Request for contribution - controller selection matrix

      @AWI

      I've added Home Assistant in google drive sheet.

      posted in Controllers
      martinhjelmare
      martinhjelmare
    • RE: Interrupt, Perform a specific function, not the loop

      @vickey

      The sleep function with single interrupt returns true if woken by the interrupt and false if woken by the timer. Sleeping with two interrupts returns the number of the interrupt pin that wakes it or negative if timer wakes. See the API.

      I would check the return value of the sleep function and divide the loop into at least two functions. One is run if interrupt wakes it, the other is run after timer wake up.

      edit

      Note that it's the interrupt number and not the pin number of the interrupt, that is returned for the two pin interrupt sleep function, according to the API.
      http://www.mysensors.org/download/sensor_api_15#the-full-api

      posted in General Discussion
      martinhjelmare
      martinhjelmare
    • Home Assistant v 0.11.1 with switch support

      Hi!

      Version 0.11 of home assisstant is now released with included mysensors switch support for serial gateway. Right now switches will change state optimistically, without waiting for reply from actuator. I'll add support for feedback state soon. Let me know of any problems.

      I've also refactored the component so it will be easy to add new platforms, light, binary sensor, lock etc. I'm hoping to have time to do so soon. Another new feature is multiple serial gateways connected at the same time.

      Edit:

      You have to update your config if already using mysensors in home assistant. It should now look like this, for two gateways:

      mysensors:
        gateways:
          - port: '/dev/ttyUSB0'
            persistence_file: 'path/mysensors.json'
          - port: '/dev/ttyACM1'
            persistence_file: 'path/mysensors2.json'
        debug: true
        persistence: true
        version: '1.5'
      

      You can see that it's not a sensor platform config anymore. The available platforms will be setup automatically from the component.

      Update: Bugfix release 0.11.1 is now released. Version 0.11 was missing the binary sensors. That has now been fixed in 0.11.1.

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: Node with Interrupt, sleep and batteries

      I think the problem might be that you try to combine the attachInterrupt function that should call an ISR and the mysensors sleep function. The mysensors sleep function handles alot of the required interrupt function logic for you. If you use the attachInterrupt function you have to do that yourself. I might be wrong though, I haven't tried this myself. Maybe @hek can comment?

      For example the following link says that you have to detach the interrupt inside the ISR to not have it trigger again.
      http://playground.arduino.cc/Learning/ArduinoSleepCode

      According to this page, all external interrupt types wake the processor. That's also one of the main points with an interrupt; to be able to wake the processor from sleep.
      http://gammon.com.au/interrupts

      posted in Troubleshooting
      martinhjelmare
      martinhjelmare
    • RE: Correct presentation of Sensebender temperature and humidity?

      @Madhias

      Just call sendTempHumidityMeasurements, with force argument set to true, from inside the if block in the loop. Then you don't need to duplicate code so much.

      You also need to change the last argument in the call to wait inside the if block in the loop. V_STATUS is not the correct type for temperature and humidity that you are waiting for. I think you can leave the last argument out in the call to wait. Let me double check that.

      Edit:
      No, you either have to call wait with all three arguments or only call it with one argument for time to wait. I guess you can put either V_HUM or V_TEMP as the last argument and just make sure you request that value last. BTW, you're missing a call to request as well. Put it after you send in the values ie after the call to sendTempHumidityMeasurements.

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: About Serial API 1.5

      @emre-ΓΌnsal

      Hi!

      From the source code in the dev branch: link

      s = sensor id
      c = message type 0-4: presentation, set, req, internal or stream
      t = value type: S_VALUE during presentation or V_VALUE during set/req
      pt = payload type: string, byte int, etc see link
      l = message length
      sg = signed or unsigned message: 0 or 1 for false or true

      0;0;3;0;9 means node 0 , sensor 0, internal message (3), not an ack message (0), log message (9). This means that it's the gateway that prints this info as a log after already having received the message from a node.

      At the end you have the payload: 27

      Similarly for a sent message: link

      posted in Troubleshooting
      martinhjelmare
      martinhjelmare
    • RE: New nodes, new problems :/ Motion sensor [Solved]

      @xydix

      I also think it's the radio transmissions that causes the sensor to trigger. One thing that happens every 20 min by default is the gateway sends a discover request broadcast. This will force all repeaters to resend that broadcast. You can test to change the interval of this broadcast at the gateway and see if the false triggers timing follows.

      The setting is called MY_TRANSPORT_DISCOVERY_INTERVAL_MS. You can define this in the gateway sketch to override the default setting.

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: How to build raspberry gw 2.0.0

      @pansen

      This is more a guess, but I think the real one (GPIO) is only for the interface between radio and serial gateway program. The virtual is for the interface between serial gateway program and controller. Serial interfaces are exclusive to one program at a time. Someone should verify what I just said though.

      posted in Troubleshooting
      martinhjelmare
      martinhjelmare
    • RE: Multiple sensors home assistant

      @sjofel

      In the temperature class, when you send in the new temperature, you set the sensor to 1. That means you connect the message with child 1, which is the door child. Remove that part of that line, and you should be good.

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: Cannot connect mysensors to Home Assistant

      @SquareKinematics

      Your mysensors home assistant config is missing the value for the device key. In your case it should be mqtt.

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: Invalid Message, Sensor not being added

      What version of mysensors are you using? Your sketch is using a pre 2.0 library api. I suggest you use the latest mysensors library version and update your sketch to use the current api.

      Read the api documentation on the mysensors site for more info.

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: Sensor naming problem

      This is on my todo list. I hope to get to it soon.

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: Interrupt, Perform a specific function, not the loop

      @n3ro

      It's untested, but here you go. It's a modified version of the sketch by @Anticimex for a binary switch with two interrupts.

      https://codebender.cc/sketch:171302

      posted in General Discussion
      martinhjelmare
      martinhjelmare
    • RE: πŸ’¬ Sensebender Gateway

      This is on my most wanted purchase list now. πŸ˜„

      FYI, I noticed the spelling of "Sensebender" is "Sensbender" for this gateway on openhardware.io, so you're breaking your brand name. πŸ˜‰ Would it be possible to amend it? If you try to search for it with the original spelling you only find the two sensor Sensebenders.

      posted in OpenHardware.io
      martinhjelmare
      martinhjelmare
    • RE: Step-by-step procedure to connect the NRF24L01+ to the GPIO pins and use the Raspberry as a Serial Gateway (MySensors 1.x)

      Very nice writeup.

      One thing that comes to mind is, the latest rasbian Jessie uses systemd instead of init. It would be good if we could add a systemd unit file to the library and a description here how to use it.

      posted in Hardware
      martinhjelmare
      martinhjelmare
    • RE: Home Assistant - How to recognize MySensors nodes

      @Mufasa

      The error is in your sketch. When you declare your message you should use child sensor id as first argument. Now you're using the pin number. So then you're sending the value from a child which hasn't been presented to home assistant.

      MyMessage msg(child-sensor-id, variable-type);
      
      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: Help work out correct MQTT message to activate relay

      Be aware though, that the mqtt broker gateway sketch will me removed in the next release, so if you want the best support I would think about changing to the mqtt client gateway. This is currently only available in the dev branch at github, but there is a sticky guide in the forum, on how to set it up.

      posted in General Discussion
      martinhjelmare
      martinhjelmare
    • RE: Converting a sketch from 1.5.x to 2.0.x

      @Maurizio-Collu

      2.0 should work with home assistant, but all new features of 2.0 are not supported yet. WIP.

      posted in Announcements
      martinhjelmare
      martinhjelmare
    • RE: Step-by-step procedure to connect the NRF24L01+ to the GPIO pins and use the Raspberry as a Serial Gateway (MySensors 1.x)

      @Myna said:

      This is a very good work !

      Is there anything in place for RFM69 ? Would it be difficult to port the code from arduino to rpi ? (I have never coded on RPI).

      Also, do you think any performance difference is involved in managing the radio directly from the RPI, compared to having a dedicated atmega/arduino ? Especially if a controller solution is already running on it?

      I've got no experience myself with rfm69 yet, but I've been thinking about it and searching the web says it should work, connecting the rfm69 to the raspberry pi, for example here:
      https://github.com/abouillot/HomeAutomation/tree/master/piGateway

      There are also custom pcbs for simplicity, don't know if it's tested though:
      https://oshpark.com/profiles/thinkpeace

      posted in Hardware
      martinhjelmare
      martinhjelmare
    • RE: Home Assistant - How to recognize MySensors nodes

      @Mufasa

      Btw, you can remove sensor/switch platform mysensors in your config, if using the latest version of my branch.

      Everything else looks good in the config and the log, what I can tell.

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: Array Relay Button Actuator

      @niccodemi

      Hi!

      I think the problem is you're not initializing oldValue to anything. It will then always be different than value in the loop, and state will change.

      You should set oldValue to the same "state" as the loaded relayState in setup. Even better, only use relayState, and make it an int. You can do the same boolean evaluations anyway. 1 is true and 0 is false.

      Edit:
      Sorry, I forgot that this is a pushbutton, right? Then you should just make sure that oldValue and value are the same after setup is complete, ie HIGH.

      posted in General Discussion
      martinhjelmare
      martinhjelmare
    • RE: πŸ’¬ Home Assistant

      Home Assistant also supports the MQTT client gateway.

      posted in Announcements
      martinhjelmare
      martinhjelmare
    • RE: Step-by-step procedure to connect the NRF24L01+ to the GPIO pins and use the Raspberry as a Serial Gateway (MySensors 1.x)

      @den2k

      Hi!

      Have you added the user that runs homeassistant to the dialout group? This group is usually owner of serial ports.

      Check default group of serial port (change for your port below) after connecting it:

      pi@martin-pi:~ $ ls -l /dev/ttyUSB0 
      crw-rw---- 1 root dialout 188, 0 dec 18 03:21 /dev/ttyUSB0
      

      Check groups that user pi is in:

      pi@martin-pi:~ $ groups pi
      pi : pi adm dialout cdrom sudo audio video plugdev games users input netdev spi i2c gpio
      

      If pi runs homeassistant, which should be the case, and is not in dialout, add pi to dialout:

      sudo adduser pi dialout
      

      Changing owner of a port will only work until you disconnect it. Default owner will be restored upon reconnect, if you haven't written a special udev rule.

      Edit:
      According to the readme in the mysensors raspberry repo (https://github.com/mysensors/Raspberry), the group of the device is tty. So you should probably use that, and not dialout. But you will know, when you check with ls -l.

      posted in Hardware
      martinhjelmare
      martinhjelmare
    • RE: Home Assistant v 0.11.1 with switch support

      @mirko314

      Hi!

      You should only have one mysensors domain, so remove the "1" after "mysensors" in your config:

      mysensors:
        gateways:
          - port: '/dev/ttyUSB0'
            persistence_file: 'hass_log/mysensors.json'
        debug: true
        persistence: true
        version: '1.5'
      
      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: MQTT dimmer message

      gw.process is called in the loop, so messages should be processed even with repeater mode turned off.

      I suggest upgrading the library to 1.5.4 for the nodes, as the bug regarding payloads was solved with that version.

      posted in General Discussion
      martinhjelmare
      martinhjelmare
    • RE: πŸ’¬ MySensors Library - v2.x

      @user2684

      void request(uint8_t childSensorId, uint8_t variableType, uint8_t destination);
      

      See "Requesting data" here:
      https://www.mysensors.org/download/sensor_api_20

      posted in Announcements
      martinhjelmare
      martinhjelmare
    • RE: Gateway

      @Jason-Brunk

      Hi!

      If you setup the development branch of the mysensors library, you can use the mqtt client gateway. This will connect to a mqtt broker. There's a sticky post in the development category with a tutorial for setting up that gateway.

      You can find the dev branch at the mysensors github repo.

      The dev branch will break some functionality compared to version 1.5, so you might need to update your nodes as well. The sketch layout is also a bit different. Search the forum for more info.

      The next release, containing these features, is planned for this summer.

      posted in Hardware
      martinhjelmare
      martinhjelmare
    • RE: Home Assistant v 0.11.1 with switch support

      @mirko314

      INFO:homeassistant.components.mysensors:No sketch_name: node 1
      

      This indicates that the gateway hasn't received all presentation messages from node 1. It's missing sketch name for this node.

      If you disable persistence you have to restart your nodes each time you restart home assistant, to resend the presentation messages.

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: Trying to figure out the message packets [SOLVED]

      The controller can use the debug serial output from the gateway of type internal message subtype 9, I_LOG_MESSAGE, and report it in a log.

      posted in General Discussion
      martinhjelmare
      martinhjelmare
    • RE: SmartSleep compatible controller?

      It's at the top of my todo for home assistant / pymysensors, but I can't promise a timeplan. PR is welcome too.

      posted in Controllers
      martinhjelmare
      martinhjelmare
    • RE: MySensors Gatway dimmers & Home assistant

      @Richard-van-der-Plas

      Hi!

      If the light is not already on when you request a brightness change from home assistant, it will send a V_LIGHT message to turn the light on, to the device. The device will process that message in receive and this is an important line:

      requestedLevel *= ( message.type == V_LIGHT ? 100 : 1 );
      

      It means that it will set requestedLevel to 100 if receiving a V_LIGHT message type. So it will reply home assistant with two messages. First a message of V_LIGHT to turn the light on, and then a message of V_DIMMER with payload 100.

      send(lightMsgWhite.set(currentWhiteLevel > 0));
      send(dimmerMsgWhite.set(currentWhiteLevel) );
      

      This is why the brightness always goes to 100 before being set to your requested value. It's only on the second message from home assistant that the light will actually turn to the requested brightness. This should not be the case if the light is already on, when requesting a new brightness. Then the brightness should change to the correct level directly.

      If you want to avoid the former behavior, you should decouple the replies to home assistant. Only answer a V_LIGHT message with a V_LIGHT message and only answer a V_DIMMER message with a V_DIMMER message.

      Edit:
      Caveat is that if not setting dimmer level and sending a V_DIMMER message when receiving the V_LIGHT message, the device will have the previous brightness setting until receiving the message with V_DIMMER and new level.

      It's not really about decoupling the replies but about decoupling the logic that handles the incoming values and what actions to take for changing the dimmer. Sorry for being unclear above.

      posted in Hardware
      martinhjelmare
      martinhjelmare
    • RE: Error using Home Assistant with a serial gateway

      @dels

      Nice catch! Yes, the serial port is exclusive. Only one device/user at a time per port per end, is allowed.

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: Some beginner questions

      There's a bug in 2.0.0 where a gateway with no radio feature defined does not present itself or local sensors. This has been fixed in the dev branch of mysensors at github.

      posted in Domoticz
      martinhjelmare
      martinhjelmare
    • RE: Automated garage door

      @dbemowsk

      If state is binary ie open or closed, you should add a Message variable in the sketch scope, before setup, of type V_STATUS. Then handle a request/message of type V_STATUS in the incoming message function and send a message with the current state. Look at the relay example sketch.

      The request message will lack a payload.

      Since you have four internal states in the sketch, I would convert them to either open or closed when reporting to the gateway. I would think the gateway is only interested in that binary state. The device should handle logic regarding the state for opening and closing.

      When you present the sensor, you probably don't always want to use the same id for the child as for the node. Now you're using getNodeId to assign child id. I would put a static integer value for the child id. You can define this before setup.

      I haven't looked in detail at all the state logic for the door. I think you know best how that should behave.

      posted in My Project
      martinhjelmare
      martinhjelmare
    • RE: Where do i get the my-board.json and other related script files to add a MYSBootloader board in Platformio

      This is how I did it for the Sensebender Micro:
      https://forum.mysensors.org/topic/2725/sensebender-micro/29

      posted in Hardware
      martinhjelmare
      martinhjelmare
    • RE: Home Assistant v 0.11.1 with switch support

      Ok, I've found the bug. I'll make the fix and pull request to home assistant. It should make the next release.

      Until then the workaround above should be usable, at least.

      Make sure you present the sensors and send at least one value per sensor, and the persistence file will be populated. Then after the restart of home assistant your sensors should show in the gui.

      Sorry for the inconvenience, and thanks for helping me troubleshoot this! I really appreciate all feedback and also any criticism, which in the end will make the controller and plugin better.

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: only one arduino to domoticz without radio

      @nico57100

      Hi!

      You can use the dev branch of mysensors at github. See this post:

      http://forum.mysensors.org/topic/1978/power-usage-sensor-multi-channel-local-display/27

      posted in Development
      martinhjelmare
      martinhjelmare
    • RE: API documentation not up to date

      @mfalkvidd

      I think the mysensors site is manually updated.

      I suggest looking into converting the site source to github pages, which would enable the whole community helping keeping the site docs up to date.

      posted in Bug Reports
      martinhjelmare
      martinhjelmare
    • RE: Any plan to implement Ethernet GW?

      @Dave-Dan

      Hi!

      Yes, I'm working on that. It's not quite finished but the main building blocks are ready. Needs some testing and polishing.

      It's on the top of my priority list of features, so I hope to release it very soon.

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: Can't get motion interrupt to work in my (combined temp, battery and motion) sketch

      @BastienVH

      Hi! It looks as if you might possible get a conflict of child ids, between temp sensors and motion. You're presenting the temp sensors in the loop, and if they are more than 2, one temp sensor and the motion sensor will be presented as child id 2. Don't know what would happen in that case, if it's allowed to overwrite the id at presentation in that way, or not.

      posted in Troubleshooting
      martinhjelmare
      martinhjelmare
    • RE: Requesting variables from Domoticz

      @mfalkvidd

      I think adding headers to different sections in the post, will make it easier to read:

      Header 1

      Header 1
      ========
      

      Header 2

      Header 2
      --------
      

      http://kramdown.gettalong.org/syntax.html#headers
      Don't know if all this markdown is supported.

      Good to update the links to be futureproof. πŸ‘

      posted in Development
      martinhjelmare
      martinhjelmare
    • Home Assistant v 0.13.1

      A new release of home assistant is out! 0.13 was released last night and a bugfix release, 0.13.1, was pushed after some hours.

      For mysensors this release includes the following highlights:

      • Add light platform, which supports S_LIGHT, S_DIMMER, S_RGB.
      • Handle message-type req, @Erik-Forsberg.
      • Expose baud rate in configuration, to allow setting other than 115200 bps, @Riccardo-Massari.
      • Fix add_child_sensor to not add child_ids already in children.
      • Fix decode partial data.

      Breaking changes:
      S_LIGHT has been moved from the switch platform to the light platform. If you have automations etc in your configuration.yaml accessing those devices that are presented as S_LIGHT, you should now access them from the light platform, eg light.entity_id.

      Problem reports or success reports, πŸ˜„, are very welcome.

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: Can't get motion interrupt to work in my (combined temp, battery and motion) sketch

      @BastienVH

      You have two calls to sleep function. You're checking the return value of the first call but not the second. So when waking after the second sleep, it will just go back to sleep again. If it wakes again, now it will check the return value and takeaction. Then it repeats in this way, every other wake doing nothing but sleeping again.

      Just remove the last call to sleep, if you're fine with going to sleep immediately in the loop.

      posted in Troubleshooting
      martinhjelmare
      martinhjelmare
    • RE: Interruption Vector

      @flylowgofast

      Hi!

      Use attachInterrupt instead.
      http://gammon.com.au/interrupts

      And don't use delay inside the ISR. Variables should be volatile.

      posted in Development
      martinhjelmare
      martinhjelmare
    • RE: Home Assistant v 0.13.1

      I've updated the docs at home-assistant.io with sketch examples. Look at the light example.
      https://home-assistant.io/components/light.mysensors/#example-sketch

      It's what I used for testing during development. It adds an RGB sensor/actuator also besides a dimmer, but you can just remove any references to rgb in the sketch.

      The dimmer slider will only be visible after turning on the light and clicking the entity in the gui to bring up the more info card.

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: Problem with dallastemperature sensor, node id.

      @heggrik

      Sorry for blabbering on, without reading the code properly. I can blame my cell phone, maybe. πŸ˜„

      So, all in all, the only thing I can see wrong with the sketch is, you need to send the initial values, one per sensor, in the end of the setup function.

      void setup()  
      { 
      ...
        // Present all sensors to controller
        for (int i=0; i<numSensors && i<MAX_ATTACHED_DS18B20; i++) {   
          gw.present(i, S_TEMP);
          gw.send(msg.setSensor(i).set(0.0,1));
        }
      }
      

      Regarding setting node id. This is the full default call of gw.begin():
      gw.begin(NULL, AUTO, false)

      The first argument (NULL) is for a callback function for incoming messages. Since this is a pure sensor sketch, you probably don't expect incoming messages. NULL means you don't declare a callback. The second arg (AUTO) is for node id. AUTO requests a node id from controller. You can set a manual node id, by changing AUTO to an integer digit, for example: gw.begin(NULL, 1, false). The third arg (false) is to enable or disable repeater mode on the node. To enable repeater mode, change false for true.

      Make sure you see the gateway started message, then power up your node, and keep watching the log output from home assistant. It should look like your first post, but after that you should also see the presentation messages and the set value messages, one per sensor.

      Edit
      There's actually a fourth argument to gw.begin(): parentNodeId
      You can set a static parent node id, that your node will always try to communicate through, instead of trying to find the shortest route to the gateway automatically. I would say this is for advance use, when you are sure of what you are doing.

      posted in Troubleshooting
      martinhjelmare
      martinhjelmare
    • RE: RFM69HW serial output no data

      @Sweebee

      The serial output you've received is an internal message about signing nonce.

      You don't present the sensors in setup, which is why you don't see any more output, about sensors tripping.

      See:
      http://www.mysensors.org/download/sensor_api_15

      and
      http://www.mysensors.org/download/serial_api_15

      and
      http://forum.mysensors.org/topic/666/debug-faq-and-how-ask-for-help/3

      posted in Development
      martinhjelmare
      martinhjelmare
    • RE: Any plan to implement Ethernet GW?

      @drock1985

      Yeah, finally! I've been a bit disappointed with myself, that it took a long time and for not finishing this earlier, but now it feels good to have it merged. We still have to polish some things, like checking that the connection is still ok, so all feedback is very welcome and valuable.

      I need to update the docs at home-assistant.io, and then I might make a new post about the release.

      BIG THANKS to everyone that tested this:
      @drock1985
      @Dave-Dan
      @Andrew-Sanjanwala
      @subutux

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: Serial Gateway error (printing)

      Yes, I agree with @mfalkvidd, and I also think we need a section in the API for what the s, c , t, pt etc means. Right now you can only figure that out by reading the source, or by asking in the forum. I wrote a post explaining those, a while back, but posts get lost in the flood of posts.

      posted in Troubleshooting
      martinhjelmare
      martinhjelmare
    • RE: How is a message from the controller written to a digital pin?

      @SuperKris

      Hi!

      You should add an incoming message callback function and add an argument to the begin method referencing the callback.

      Look at the relay sketch example in the build section of the mysensors site. At the bottom of the sketch there is the incoming message callback.

      posted in Development
      martinhjelmare
      martinhjelmare
    • RE: Notification platform

      @kernald

      Hi!

      Home assistant uses pymysensors to interface with mysensors. S_INFO/V_TEXT should be added along side the other new types in a const_20 module. I have a branch for this already that I can push. We will need to bump version on pymysensors also and use this version in your branch for home assistant.

      Then you will be able to use those types to setup a mysensors notify platform. You can look at how the other mysensors platforms are setup.

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: Help troubleshoting sketch

      @Cliff-Karlsson

      I'm not sure exactly what you have done so far. Were you trying an old sketch with the dev branch library? If you update your library to dev branch you can't compile sketches from previous mysensors releases without updating them to the dev style.

      As far as I know one mysensored arduino gateway with dev branch should be able to talk to one mysensored arduino node with 1.5 release.

      If you're using the dev branch, why not start with one of the sketches from the dev branch examples, that should be working, and take it from there. First try it without changing anything. Then modify them one step at a time. Less chance of errors that way, until you feel more confident.

      posted in Troubleshooting
      martinhjelmare
      martinhjelmare
    • RE: How is a message from the controller written to a digital pin?

      @SuperKris

      Sorry for the lingo.

      From your reply I think you've understood very well so far.

      If you want to run on batteries you should sleep as much as possible. So then you should add a call to the sleep method, i.e. gw.sleep([TIME IN MILLISECONDS]). Read more about that in the API. But the problem is then, that you can't receive messages from the controller while sleeping. There are possible workarounds, like waking up every now and then to let the node check for messages from the controller. But in the 1.5 releases you have to write all code for that yourself, so I wouldn't recommend it for a beginner. In the dev branch version (2.0), which is under continuous development, there is support for smart sleep, which simplifies the process of sleeping, waking and checking for controller messages before sleeping again. The controller needs to support this though.

      Anyway, if you can, it's best to start with a non battery driven node, if you expect messages from the controller after setup. That way you don't need to sleep, and can call gw.process each lap in the loop, like you said.

      The arduino node knows all possible message types from the mysensors library that is imported in the beginning of the sketch. message.type is the type attribute of the message argument that gets passed into the function. Sorry for the lingo again. Each message that is received will have a message subtype. This is part of the mysensors message protocol. When the message comes in to the node, the incomingMessage function will be called, from the gw.process method, and the message object which holds different attributes of the message is passed into the incomingMessage function as an argument. The argument is the word inside the parenthesis after the function name, simply put, in this case message.

      In the end of the library API page on the site, you will find info about message manipulation. Among other things there are "getters" for getting the different attributes of the message object. For example message.getBool().

      You should add

      message.getBool()?HIGH:LOW
      

      instead of just HIGH to your modified incomingMessage function. The BOOL?HIGH:LOW part is a short form of making an IF statement. That way you can send a 1 as payload to switch the motor pin HIGH and a 0 to switch it to LOW.

      How have you tested this? Have you tried sending a message to the node of subtype V_LIGHT with a payload of either "1" or "0"? If you're using a controller it probably supports this if you present the correct sensor/actuator type. Hook up your node to a computer with USB / serial connection and start the serial monitor in the Arduino IDE. Then you can watch the messages from/to the node.

      Also test just switching the motor pin HIGH/LOW directly in the loop with a wait or sleep of some seconds in between, so you know the pin is acting properly. Of course you need a readout for the pin somehow. You can use a LED and a resistor if you don't want to connect anything larger while testing.

      Edit: Don't forget to add the name of the incoming message function as first argument to the begin method. Read about initializing the library in the API on the site, section "Starting up the library".

      posted in Development
      martinhjelmare
      martinhjelmare
    • RE: Basic question: Light sensors

      V_LIGHT_LEVEL should have the unit percent (%) according to the mysensors serial API. For lux use V_LEVEL and a custom unit of measurement, V_UNIT_PREFIX. Read more here:
      https://home-assistant.io/components/sensor.mysensors/#custom-unit-of-measurement

      See the example sketch here:
      https://home-assistant.io/components/sensor.mysensors/#example-sketch

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: Help troubleshoting sketch

      @Cliff-Karlsson

      I would first test the standard binary switch example sketch from github:
      https://github.com/mysensors/Arduino/blob/development/libraries/MySensors/examples/BinarySwitchSleepSensor/BinarySwitchSleepSensor.ino

      If that works, you know that your hardware is ok. Then you should be able to adjust that sketch slightly to get the extra functionality you need.

      posted in Troubleshooting
      martinhjelmare
      martinhjelmare
    • Smartsleep implementation

      I'm currently testing the smartSleep method from dev branch together with pin change interrupt. I think we should look at changing the order of calls, unless we care to miss events, button presses for example.

      The problem I've experienced is that after waking up from a pin change, reading the pin state is not done fast enough, because the node is waiting for the smartSleep duration after the heartbeat. So the pin might have gone back to the old state when the node gets to reading it.

      Right now the order of calls in smartSleep is like this:

      sleep
      send heartbeat
      wait for duration

      I suggest to change to:

      send heartbeat
      wait for duration
      sleep

      This way, the node won't miss events waking up. Care still has to be taken to not call smartSleep when you expect a pin change event. For a momentary push button, for example, you should not call smartSleep until the button is reset to its original position, ie pin==HIGH for mode INPUT_PULLUP. Until that has happened you can call regular sleep instead.

      I've tested my proposed change for the described scenario and it works better than the previous implementation.

      What do you think?

      posted in Development
      martinhjelmare
      martinhjelmare
    • RE: Remove duplicated mysensors in homeassistant front-end

      @John-Nguyen

      Deleting the persistence file and the backup file and restarting home assistant should have removed all sensors.

      I recommend using a json file as persistence file, as you can easily edit that file type and remove individual children etc. A pickle file is not easily editable. Make sure you have the correct path to the persistence file. The path in the example config is not a valid path.

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: Problems trying to compile Ethernet MQTT Gateway but samples OK

      @KiZD

      Hi!

      I'm not sure exactly what you have tried, but the mqtt client gateway sketch is only for development branch library while the old mqtt gateway sketch that you linked to, is for the 1.5 releases. You can't mix old style sketches with dev branch library and vice versa. It's sounds like you should try to reinstall the mysensors library from scratch. Remove everything first. Read the install instructions on the mysensors web carefully. Decide if you want to go for dev branch or a release. Then install either, and only use sketch examples from the correct source per library install.

      posted in Troubleshooting
      martinhjelmare
      martinhjelmare
    • RE: send message to sensor on GW

      There is a bug in 2.0.0 where receive isn't called on incoming message if destination is gateway. It's fixed in the dev branch.

      https://github.com/mysensors/MySensors/pull/522

      posted in Development
      martinhjelmare
      martinhjelmare
    • RE: Remove duplicated mysensors in homeassistant front-end

      Just specify a valid path to the file in a folder that exists. I usually use the .homeassistant folder. You should not create the file. The file will be created when one of your sensors is first presented.

      Remove all old pickle files if you want to switch to json files. I don't know why home assistant didn't want to start.

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: How to force static use of an repeater-node...?

      @idstone

      Hi!

      In the 1.5 releases you can set a static parent in the begin method. It's the fourth argument. See "Starting up the library" here:
      http://www.mysensors.org/download/sensor_api_15

      posted in Troubleshooting
      martinhjelmare
      martinhjelmare
    • RE: Ota progress checking

      @mtiutiu

      I made something like that here:
      https://forum.mysensors.org/topic/4923/ota-firmware-updating-is-too-slow/13

      posted in Development
      martinhjelmare
      martinhjelmare
    • RE: Call/Trigger custom functions/effects from Home Assistant

      @Emil-Besirevic

      Hi!

      You can present a "dummy" binary device, S_BINARY, in the same sketch as your RGB light. The dummy device will be shown as a switch in the HA gui, and you can turn it on/off. You add logic in the receive/incomingMessage function in the sketch to take appropriate action when a message for that device comes in. You'll basically add parts of this sketch:
      https://home-assistant.io/components/switch.mysensors/#switch-sketch

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: Help troubleshooting code

      @barduino

      The interrupt number is usually pin - 2 on our boards. But I would rather use the function provided by arduino to get the correct interrupt number for a pin, digitalPinToInterrupt.

      posted in Troubleshooting
      martinhjelmare
      martinhjelmare
    • RE: another relay problem....

      You said you're using mysensors 1.5.2, but the log indicates that atleast the node in question is 1.5.4. Is the gateway also on 1.5.4? There was a bug in 1.5.2-1.5.3 regarding payloads.

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: Help please ! total noob here !!

      The mqtt gateway sketch in the build section of the mysensors site will create an mqtt broker. If you want the gateway to act as an mqtt client you have to use the dev branch, ie not any 1.5 releases, mysensors library and mqtt gateway sketch at github.

      The pinned guide in the forum about mqtt client gateway is for the dev branch library. If you read the first post carefully you should be able to set that up. But first you need to have a copy of the dev branch mysensors library in your Arduino IDE, so that you can build the mqtt client sketch.

      posted in Troubleshooting
      martinhjelmare
      martinhjelmare
    • RE: another relay problem....

      @Gefkuz said:

      and switch file is empty.... I don't see anything about that in homeassistant website...

      What do you mean switch file is empty? Have you split your config into different yaml files? If so you can't point to an empty file in your main config file. Remove unused entries from your config. You seem to have problems with other platforms also besides switch.

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: Help please ! total noob here !!

      Are you sure you have the correct address? Have you changed the sketch and defined the ip address of the arduino or commented those lines? If you comment them, you should use the address that your router or similar assigns to the arduino.

      / Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
      #define MY_IP_ADDRESS 192,168,178,87
      
      // If using static ip you need to define Gateway and Subnet address as well
      #define MY_IP_GATEWAY_ADDRESS 192,168,178,1
      #define MY_IP_SUBNET_ADDRESS 255,255,255,0
      
      posted in Troubleshooting
      martinhjelmare
      martinhjelmare
    • RE: Enable serial debugs from the RS485 GW in the log

      Yes, you can set a filter on any child of the root logger in home assistant. The convention is that each module has it's own logger, which will be a child of the root logger. Yes, the first name in mysensors.mysensors is the package installed by pymysensors and the last name (mysensors.mysensors) is the module name.

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: MySensors API ver 1.6.1: MQTTClientGateway - RF69 - Arduino Uno - W5100 Shield

      @xefil

      Hi!

      NSS, MOSI and SCK on the RFM69 are not 5 V tolerant. Are you using a logic level converter?

      posted in Troubleshooting
      martinhjelmare
      martinhjelmare
    • RE: Help Debug st=fail

      I had a lot of fails on the Sensebender I've installed, and I noticed that I got better transmission when holding the pcb. I then tested to put some aluminium foil with plastic wrap for insulation between the backside of the pcb radio antenna and the Sensbender pcb. This was a winner.

      There's been a lot of discussion about possible interference from the FTDI 6 pin metal header. I haven't tested my setup without the header or with the header positioned differently, but that's one suspect on my list of culprits.

      posted in Troubleshooting
      martinhjelmare
      martinhjelmare
    • RE: "Node 1 is unknown" requires a restart. 2nd child element never presents

      It seems the gateway/controller doesn't receive the presentation of the second child, child 1. Try add a short wait between presenting child 0 and 1. Try with 50-100ms.

      Is your node sleeping? If so add a short wait, 300 ms, before going back to sleep. Then it will pickup the request for new presentation that the controller sends when it receives a message from an unknown node or child.

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: New Gateway - Can't get it to work

      @Norm-Dressler

      You need a controller that can provide ids connected to the gateway.

      posted in Troubleshooting
      martinhjelmare
      martinhjelmare
    • RE: Does HA ignore repeat sensor values?

      Yes this is normal behavior in HA. But it can be turned off, on a platform basis in HA. I have a PR incoming that will force state updates for mysensors sensors.

      https://github.com/home-assistant/home-assistant/pull/3648

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: How to disable default node registration to the GW?

      Don't define MY_REGISTRATION_FEATURE, then the node doesn't have to be registered.

      posted in Troubleshooting
      martinhjelmare
      martinhjelmare
    • RE: Heartbeats

      Hi!

      Home assistant supports the heartbeat response message type but not heartbeat requests. Smartsleep is supported.

      Sleep/awake state is not currently exposed.

      Please describe a detailed use case and I can see if it's possible to implement something.

      Home assistant shows the last known state of the device. If you have a sleeping actuator, using smartsleep, home assistant will send the last future state, that has been requested, to the device when the heartbeat comes in. Eg if a device has three states, and it's current state is 1, if the user first requests state 2 and then state 3, only state 3 will be sent to the device to actuate. Devices should always feedback any state updates to home assistant.

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: How to disable default node registration to the GW?

      @kskud

      Sorry I thought the question was how to disable node registration to gateway.

      It might be possible to have comms working without a gateway if you define the whole network with node ids and parents and make sure that all nodes can talk to their parents. But I'm more or less guessing here, since I don't know all of the transport machinery. @tekka would know best.

      For the uplink (UPL) check to return ok, the parent has to reply the PING from the node with a PONG. You have defined the node's parent to be 0, which is reserved for the gateway. So without a gateway, the UPL will fail. You could try assigning the neighbour node id, that you want your node to talk to, to the parent id of the node.

      Looking again, it seems the PING is hardcoded to the gateway address. So I don't think it's possible.

      posted in Troubleshooting
      martinhjelmare
      martinhjelmare
    • RE: Reversed Relay

      I suggest either inverting the high/low logic when writing to the relay, or checking and possibly changing the wiring of the relay. Some relays "default" to on (active low).

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: ESP-8266 gateway with sensor can't communicate with controller

      @Senne-Vande-Sompele

      Mysensors 2.0 has a bug that leads to gateways without radio to not present themselves, which is why node 0 (gateway) is unknown in your log. This is fixed in mysensors 2.1.

      posted in Troubleshooting
      martinhjelmare
      martinhjelmare
    • RE: Node 0 unknown, error decoding message from gateway

      There's a bug in mysensors 2.0 where a gateway without radio doesn't present itself. This has been fixed in the mysensors dev branch. See this issue for more info and a workaround:
      https://github.com/theolind/pymysensors/issues/51

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: [SOLVED] radio will connect to gateway with touch radio board with finger!!!

      I had a similar experience when trying the Sensebender Micro for the first time. I figured it might be interference from some part of the board beneath the radio, a topic that had been discussed in the forums at that time. I tried putting a small piece of aluminum foil under the antenna between the radio and the Sensebender board. This made a considerable improvement. I'm not sure of the actual cause of my symptoms but I was happy I had found a workaround.

      posted in Troubleshooting
      martinhjelmare
      martinhjelmare
    • RE: Node 0 unknown, error decoding message from gateway

      Put this after the gateway present call in setup:

      presentation();
      

      Also replace all sleep with wait. The gateway is not allowed to sleep.

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: Can't get my new mysensors LED-Dimmer to show up.

      @heggrik

      You don't send an initial value of the child to home assistant.

      https://home-assistant.io/components/mysensors/#presentation

      posted in Troubleshooting
      martinhjelmare
      martinhjelmare
    • RE: Need a refresher on presentation and HA
      • Add a short wait between presentations of child 1 and 2 in presentation. Presentation of second child failed to be received.
      • Send initial values for both children in loop.
      • Send feedback of state change to gateway/controller in receive.
      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: MQTT Gateway: Add a confirmation/acknowledgement to the publish topic upon setting via subscribe topic.

      @Brian-Morris

      Don't invert the state before you send it back to the controller . Ie this part:

      state?false:true
      

      should be:

      state?true:false
      

      in the receive function.

      posted in Troubleshooting
      martinhjelmare
      martinhjelmare
    • RE: Need a refresher on presentation and HA

      Send initial values in loop. No set/req messages are allowed until after the node is registered at the gateway. This happens after presentation in mysensors 2.0.

      See example sketch here:
      https://home-assistant.io/components/mysensors/#presentation

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: Node 0 unknown, error decoding message from gateway

      That's because you are printing debug to serial from the gateway and the controller doesn't expect serial messages from the gateway other than mysensors API messages. Either ignore the errors or remove those debug prints.

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: Node 0 unknown, error decoding message from gateway

      The entity_id always has the same structure, sketchname_nodeid_childid. You can customize the friendly_name in the config under customize to change what is shown in the gui as name of the sensor.

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: MQTT raspberry pi gateway with HA, can't seem to find sensors.

      I think I see a problem with your sensor value type that is used. You have presented a humidity sensor (7), but you report with a level type (37). You should use subtype 1 when setting the value of the humidity child sensor. Sorry for not noticing this from the beginning.

      Home assistant is picky about child/value combinations. You can see allowed types in the docs for mysensors at home-assistant.io.

      Specifically here:
      https://home-assistant.io/components/sensor.mysensors/

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: MQTT raspberry pi gateway with HA, can't seem to find sensors.

      See this:
      https://home-assistant.io/components/sensor.mysensors/

      And also this:
      https://www.mysensors.org/download/serial_api_20

      Usually you decide in the beginning of your sensor sketch what message type you will use when reporting values. Alternatively this can be done dynamically before sending the value. Look at the example sketch for humidity sensor here:
      https://www.mysensors.org/build/humidity

      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: My first relay. connected to GW 2.1.0

      No, it doesn't look like child 1 is in the posted JSON. If you can capture a debug log after start of hass I think it could help to resolve this. Use this logger config and activate debug for mysensors config:

      logger:
        default: info
        logs:
          mysensors: debug
          homeassistant.components.mysensors: debug
      
      mysensors:
        debug: true
      ...
      
      posted in Home Assistant
      martinhjelmare
      martinhjelmare
    • RE: Home Assistant does not recognise the switch

      @Efflon

      It can't be done during presentation cause the node isn't registered yet at the gateway at that time. Default settings in mysensors requires nodes to be registered before the gateway allows them to send in values. In mysensors 2.1.x setup is called after registration, so it is possible to use that for sending values, but I would still recommend to do it in the loop.

      Reason is, in some cases you want to resend the initial values, and then setup is not suitable as it's only called once. Eg if your're using the ethernet gateway and have local sensors on the gateway, when home assistant connects to the gateway, the gateway will re-run presentation and continue with the loop. But setup will not be called again, as it already has been called when the gateway was first started. So if you would send initial values of sensors in setup on a gateway, the sensors wouldn't show in home assistant, cause the initial values would already be sent by the time home assistant connects to the gateway.

      Best way, I think, is to use an if block in the loop where you send the values and then request them from home assistant. You use a boolean variable, that you can turn on/off, that decides if the if block should be entered. You have the boolean True by default, and then set it to False when you have received the initial values back from home assistant in receive. This is described in the example sketch here:
      https://home-assistant.io/components/mysensors/#presentation

      posted in Home Assistant
      martinhjelmare
      martinhjelmare