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
  1. Home
  2. Controllers
  3. Home Assistant
  4. Home Assistant - How to recognize MySensors nodes

Home Assistant - How to recognize MySensors nodes

Scheduled Pinned Locked Moved Home Assistant
home assistant
64 Posts 7 Posters 46.1k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    humblehacker
    wrote on last edited by
    #22

    Sure enough-

    WARNING:mysensors.mysensors:Error decoding message from gateway, probably received bad byte.
    

    @martinhjelmare- How do I create a new gateway instance? Simply restart?

    martinhjelmareM 1 Reply Last reply
    0
    • H humblehacker

      Sure enough-

      WARNING:mysensors.mysensors:Error decoding message from gateway, probably received bad byte.
      

      @martinhjelmare- How do I create a new gateway instance? Simply restart?

      martinhjelmareM Offline
      martinhjelmareM Offline
      martinhjelmare
      Plugin Developer
      wrote on last edited by
      #23

      @humblehacker

      If using home assistant, it's enough to restart home assistant, to get a new gateway instance and reconnect.

      1 Reply Last reply
      0
      • H Offline
        H Offline
        humblehacker
        wrote on last edited by
        #24

        success!.png
        :smiley:
        Other than the fact that my log seems to think its yesterday... I just need to find out why I can't use MySensors with Any ATMega32u4 devices... Attiny85/Trinket support would be nice too but I dont need to push my luck...

        martinhjelmareM 1 Reply Last reply
        0
        • H humblehacker

          success!.png
          :smiley:
          Other than the fact that my log seems to think its yesterday... I just need to find out why I can't use MySensors with Any ATMega32u4 devices... Attiny85/Trinket support would be nice too but I dont need to push my luck...

          martinhjelmareM Offline
          martinhjelmareM Offline
          martinhjelmare
          Plugin Developer
          wrote on last edited by
          #25

          @humblehacker

          :thumbsup:

          1 Reply Last reply
          0
          • K Offline
            K Offline
            kielnino
            wrote on last edited by
            #26

            I'm still stuck with the import of sensors to home-assitant. Can someone please post his configuration.yaml? I Wonder if I made a stupid configuration error there.
            Do I need the "inclusion mode" of the Gateway or does home-assistant handle the detection of new sensors? In the serial monitor all the communication between the nodes and the Gateway is looking good, but in home-assistant they won't show up.

            martinhjelmareM 1 Reply Last reply
            0
            • K kielnino

              I'm still stuck with the import of sensors to home-assitant. Can someone please post his configuration.yaml? I Wonder if I made a stupid configuration error there.
              Do I need the "inclusion mode" of the Gateway or does home-assistant handle the detection of new sensors? In the serial monitor all the communication between the nodes and the Gateway is looking good, but in home-assistant they won't show up.

              martinhjelmareM Offline
              martinhjelmareM Offline
              martinhjelmare
              Plugin Developer
              wrote on last edited by
              #27

              @kielnino

              Home assistant adds the new device after the sensor has presented itself to the gateway and sent at least one value. So proper presentation messages has to be sent by the node and received by the gateway. These include node id, sensor child id, sketch name and presentation "S_VALUE". Then one value should be sent using the correct "V_VALUE".

              See the mysensor API documentation for the S_VALUES and V_VALUES.

              See below for the sensors excerpt from my config. If you have multiple sensor platforms you need to increment the sensor name with a number: sensor, sensor 2, sensor 3, etc. All sensor platforms should be one continuing block in the config. Note that this is not my config for my github fork of home assistant. For that one, you need to add a separate domain in the config for mysensors.

              ###########################################################
              # SENSORS
              ###########################################################
              
              # Mysensors
              sensor:
                platform: mysensors
                port: "/dev/ttyUSB0"
              #  debug:
              
              # forecast.io
              sensor 2:
                platform: forecast
                api_key: ***censored***
                monitored_conditions:
                  - summary
                  - precip_type
                  - precip_intensity
                  - temperature
                  - dew_point
                  - wind_speed
                  - wind_bearing
                  - cloud_cover
                  - humidity
                  - pressure
                  - visibility
                  - ozone
              
              # time_date
              sensor 3:
                platform: time_date
                display_options:
                  - 'time'
                  - 'date'
                  - 'date_time'
                  - 'time_date'
                  - 'time_utc'
                  - 'beat'
              
              1 Reply Last reply
              0
              • D Offline
                D Offline
                drock1985
                wrote on last edited by
                #28

                Hi @martinhjelmare

                Just wanted to first say thank you for the port of MySensors to Home-Assistant. I'm currently in the process of switching from Domoticz to Home-Assistant, and have a quick question about getting my node recognized.

                I have a Doorbell/Chome monitor, and it gets the ID from the gateway no problem. It shows up in HA after pressing the doorbell button (as a motion sensor, since that is the trigger) but I can't control the chime itself (aka, whether the bell rings if the door is pressed or not) which is set as a light switch.

                I know from reading this thread that in order for a device to first appear in HA, it must send a command to the gateway. Is there any way for me through HA to force a command to the childid light switch, so that it will show up on its own?

                Thanks!

                My Projects
                2 Door Chime Sensor
                Washing Machine Monitor

                martinhjelmareM 1 Reply Last reply
                0
                • D drock1985

                  Hi @martinhjelmare

                  Just wanted to first say thank you for the port of MySensors to Home-Assistant. I'm currently in the process of switching from Domoticz to Home-Assistant, and have a quick question about getting my node recognized.

                  I have a Doorbell/Chome monitor, and it gets the ID from the gateway no problem. It shows up in HA after pressing the doorbell button (as a motion sensor, since that is the trigger) but I can't control the chime itself (aka, whether the bell rings if the door is pressed or not) which is set as a light switch.

                  I know from reading this thread that in order for a device to first appear in HA, it must send a command to the gateway. Is there any way for me through HA to force a command to the childid light switch, so that it will show up on its own?

                  Thanks!

                  martinhjelmareM Offline
                  martinhjelmareM Offline
                  martinhjelmare
                  Plugin Developer
                  wrote on last edited by martinhjelmare
                  #29

                  @drock1985

                  Hi!

                  First I'd just want to make clear that I'm not the original author or maintainer of pymysensors, which is the mysensors API that home assistant uses. I have just made some pull requests to pymysensors and I'd like to improve the functionality, if possible.

                  To answer your question, mysensors switches are not yet supported in home assistant. That's what one of my pull requests want to solve, but it has yet to be merged. There is currently no way of forcing a node to resend it's presentation, if that info is lacking on the gateway side. This could be solved after version 1.6 of mysensors gets released but it will take more development, both on pymysensors and home assistant sides.

                  If you want to make sure that the doorbell shows up in the GUI, before the first press of the button, just send the sensor value to the gateway, in the end of the setup function in your node sketch.

                  For example, if you have defined a msgMotion for the doorbell:

                  gw.send(msgMotion.set("0"));
                  
                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    drock1985
                    wrote on last edited by
                    #30

                    Hi @martinhjelmare

                    I decided to try this on a simplier sketch that I have, but still no luck. I added this line gw.send(lightMsgW.set("1")); to the end of void setup(). The sensor shows up at the top of the States screen in HA, but doesn't let me actually control it, and it doesn't show up in Switches or Lights.

                    Here is the sketch that I am using.

                    /**
                     * The MySensors Arduino library handles the wireless radio link and protocol
                     * between your home built sensors/actuators and HA controller of choice.
                     * The sensors forms a self healing radio network with optional repeaters. Each
                     * repeater and gateway builds a routing tables in EEPROM which keeps track of the
                     * network topology allowing messages to be routed to nodes.
                     *
                     * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
                     * Copyright (C) 2013-2015 Sensnology AB
                     * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
                     *
                     * Documentation: http://www.mysensors.org
                     * Support Forum: http://forum.mysensors.org
                     *
                     * This program is free software; you can redistribute it and/or
                     * modify it under the terms of the GNU General Public License
                     * version 2 as published by the Free Software Foundation.
                     *
                     *******************************
                     *
                     * REVISION HISTORY
                     * Version 1.0 - 6-December-2015, Derrick Rockwell
                     *
                     * DESCRIPTION
                     *This sketch uses two 30 bulb, 3mm LED holiday light strings. These
                     *can usually be found in most dollar stores/hardware stores and are 
                     *battery powered. This sketch uses digital pins 3 and 4 to power two 
                     *a string of lights each. Ex, one can control white lights the other
                     *could control multi-colour lights. 
                     */
                    
                    #define SN "HolidayLEDDeskLights"
                    #define SV "1.0"
                    
                    #include <MySensor.h> 
                    #include <SPI.h>
                    
                    #define MLED_PIN 3      // Pin Multi-Coloured LED's will attached to
                    #define WLED_PIN 5      // Pin White-Coloured LED's will attached to
                    #define FADE_DELAY 10  // Delay in ms for each percentage fade up/down (10ms = 1s full-range dim)
                    #define CHILD_ID0 3
                    #define CHILD_ID1 5
                    
                    MySensor gw;
                    
                    static int currentLevelM = 0;  // Current dim level...
                    static int currentLevelW = 0;  // Current dim level...
                    
                    MyMessage dimmerMsgM(MLED_PIN, V_DIMMER);
                    MyMessage lightMsgM(MLED_PIN, V_LIGHT);
                    MyMessage dimmerMsgW(WLED_PIN, V_DIMMER);
                    MyMessage lightMsgW(WLED_PIN, V_LIGHT);
                    
                    /***
                     * Dimmable LED initialization method
                     */
                    void setup()  
                    { 
                      Serial.println( SN ); 
                      Serial.println( SV );
                      gw.begin( incomingMessage );
                      
                      // Register the LED Dimmable Light with the gateway
                      gw.present( MLED_PIN, S_DIMMER );
                      gw.present( WLED_PIN, S_DIMMER );
                      
                      gw.sendSketchInfo(SN, SV);
                      // Pull the gateway's current dim level - restore light level upon sendor node power-up
                      gw.request( MLED_PIN, V_DIMMER );
                      gw.request( WLED_PIN, V_DIMMER );
                      gw.send(lightMsgW.set("1"));
                    }
                    
                    /***
                     *  Dimmable LED main processing loop 
                     */
                    void loop() 
                    {
                      gw.process();
                    }
                    
                    //For Multi Coloured Lights
                    void incomingMessage(const MyMessage &message) {
                    if (message.type == V_LIGHT || message.type == V_DIMMER) {
                          // if (message.sensor <= 2)
                          {
                              //0: All Dimmers
                              //1: LED 1
                              //2: LED 2
                              //  Retrieve the power or dim level from the incoming request message
                              int requestedLevel = atoi( message.data );
                              
                              // Adjust incoming level if this is a V_LIGHT variable update [0 == off, 1 == on]
                              requestedLevel *= ( message.type == V_LIGHT ? 100 : 1 );
                              
                              if ((message.sensor == CHILD_ID0) || (message.sensor == 0)){
                                fadeToLevel ( requestedLevel, MLED_PIN, &currentLevelM );
                                // Inform the gateway of the current DimmableLED's SwitchPower1 and LoadLevelStatus value...
                                gw.send(lightMsgM.set(requestedLevel > 0 ? 1 : 0));
                                gw.send(dimmerMsgM.set(requestedLevel) );
                              }
                              if ((message.sensor == CHILD_ID1) || (message.sensor == 0)){
                                fadeToLevel( requestedLevel, WLED_PIN, &currentLevelW );
                                // Inform the gateway of the current DimmableLED's SwitchPower1 and LoadLevelStatus value...
                                gw.send(lightMsgW.set(requestedLevel > 0 ? 1 : 0));
                                gw.send(dimmerMsgW.set(requestedLevel) );
                              }
                            }
                    }
                    }
                    
                    /***
                     *  This method provides a graceful fade up/down effect
                     */
                     // For Multi Coloured Lights
                    void fadeToLevel( int toLevel, int pin, int *currentLevel ) {
                      int delta = ( toLevel - (*currentLevel) ) < 0 ? -1 : 1;
                      while ( (*currentLevel) != toLevel ) {
                        (*currentLevel) += delta;
                        analogWrite( pin, (int)((*currentLevel) / 100. * 255) );
                        delay( FADE_DELAY );
                      }
                    }
                    

                    My Projects
                    2 Door Chime Sensor
                    Washing Machine Monitor

                    martinhjelmareM H 2 Replies Last reply
                    0
                    • D drock1985

                      Hi @martinhjelmare

                      I decided to try this on a simplier sketch that I have, but still no luck. I added this line gw.send(lightMsgW.set("1")); to the end of void setup(). The sensor shows up at the top of the States screen in HA, but doesn't let me actually control it, and it doesn't show up in Switches or Lights.

                      Here is the sketch that I am using.

                      /**
                       * The MySensors Arduino library handles the wireless radio link and protocol
                       * between your home built sensors/actuators and HA controller of choice.
                       * The sensors forms a self healing radio network with optional repeaters. Each
                       * repeater and gateway builds a routing tables in EEPROM which keeps track of the
                       * network topology allowing messages to be routed to nodes.
                       *
                       * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
                       * Copyright (C) 2013-2015 Sensnology AB
                       * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
                       *
                       * Documentation: http://www.mysensors.org
                       * Support Forum: http://forum.mysensors.org
                       *
                       * This program is free software; you can redistribute it and/or
                       * modify it under the terms of the GNU General Public License
                       * version 2 as published by the Free Software Foundation.
                       *
                       *******************************
                       *
                       * REVISION HISTORY
                       * Version 1.0 - 6-December-2015, Derrick Rockwell
                       *
                       * DESCRIPTION
                       *This sketch uses two 30 bulb, 3mm LED holiday light strings. These
                       *can usually be found in most dollar stores/hardware stores and are 
                       *battery powered. This sketch uses digital pins 3 and 4 to power two 
                       *a string of lights each. Ex, one can control white lights the other
                       *could control multi-colour lights. 
                       */
                      
                      #define SN "HolidayLEDDeskLights"
                      #define SV "1.0"
                      
                      #include <MySensor.h> 
                      #include <SPI.h>
                      
                      #define MLED_PIN 3      // Pin Multi-Coloured LED's will attached to
                      #define WLED_PIN 5      // Pin White-Coloured LED's will attached to
                      #define FADE_DELAY 10  // Delay in ms for each percentage fade up/down (10ms = 1s full-range dim)
                      #define CHILD_ID0 3
                      #define CHILD_ID1 5
                      
                      MySensor gw;
                      
                      static int currentLevelM = 0;  // Current dim level...
                      static int currentLevelW = 0;  // Current dim level...
                      
                      MyMessage dimmerMsgM(MLED_PIN, V_DIMMER);
                      MyMessage lightMsgM(MLED_PIN, V_LIGHT);
                      MyMessage dimmerMsgW(WLED_PIN, V_DIMMER);
                      MyMessage lightMsgW(WLED_PIN, V_LIGHT);
                      
                      /***
                       * Dimmable LED initialization method
                       */
                      void setup()  
                      { 
                        Serial.println( SN ); 
                        Serial.println( SV );
                        gw.begin( incomingMessage );
                        
                        // Register the LED Dimmable Light with the gateway
                        gw.present( MLED_PIN, S_DIMMER );
                        gw.present( WLED_PIN, S_DIMMER );
                        
                        gw.sendSketchInfo(SN, SV);
                        // Pull the gateway's current dim level - restore light level upon sendor node power-up
                        gw.request( MLED_PIN, V_DIMMER );
                        gw.request( WLED_PIN, V_DIMMER );
                        gw.send(lightMsgW.set("1"));
                      }
                      
                      /***
                       *  Dimmable LED main processing loop 
                       */
                      void loop() 
                      {
                        gw.process();
                      }
                      
                      //For Multi Coloured Lights
                      void incomingMessage(const MyMessage &message) {
                      if (message.type == V_LIGHT || message.type == V_DIMMER) {
                            // if (message.sensor <= 2)
                            {
                                //0: All Dimmers
                                //1: LED 1
                                //2: LED 2
                                //  Retrieve the power or dim level from the incoming request message
                                int requestedLevel = atoi( message.data );
                                
                                // Adjust incoming level if this is a V_LIGHT variable update [0 == off, 1 == on]
                                requestedLevel *= ( message.type == V_LIGHT ? 100 : 1 );
                                
                                if ((message.sensor == CHILD_ID0) || (message.sensor == 0)){
                                  fadeToLevel ( requestedLevel, MLED_PIN, &currentLevelM );
                                  // Inform the gateway of the current DimmableLED's SwitchPower1 and LoadLevelStatus value...
                                  gw.send(lightMsgM.set(requestedLevel > 0 ? 1 : 0));
                                  gw.send(dimmerMsgM.set(requestedLevel) );
                                }
                                if ((message.sensor == CHILD_ID1) || (message.sensor == 0)){
                                  fadeToLevel( requestedLevel, WLED_PIN, &currentLevelW );
                                  // Inform the gateway of the current DimmableLED's SwitchPower1 and LoadLevelStatus value...
                                  gw.send(lightMsgW.set(requestedLevel > 0 ? 1 : 0));
                                  gw.send(dimmerMsgW.set(requestedLevel) );
                                }
                              }
                      }
                      }
                      
                      /***
                       *  This method provides a graceful fade up/down effect
                       */
                       // For Multi Coloured Lights
                      void fadeToLevel( int toLevel, int pin, int *currentLevel ) {
                        int delta = ( toLevel - (*currentLevel) ) < 0 ? -1 : 1;
                        while ( (*currentLevel) != toLevel ) {
                          (*currentLevel) += delta;
                          analogWrite( pin, (int)((*currentLevel) / 100. * 255) );
                          delay( FADE_DELAY );
                        }
                      }
                      
                      martinhjelmareM Offline
                      martinhjelmareM Offline
                      martinhjelmare
                      Plugin Developer
                      wrote on last edited by
                      #31

                      @drock1985

                      As I wrote above, switches are not supported yet, in the default releases of home assistant. That support only exists in my personal branches at github.

                      1 Reply Last reply
                      0
                      • D Offline
                        D Offline
                        drock1985
                        wrote on last edited by
                        #32

                        @martinhjelmare

                        And how would I install your branch of home-assistant then so that I can use it?

                        My Projects
                        2 Door Chime Sensor
                        Washing Machine Monitor

                        1 Reply Last reply
                        0
                        • martinhjelmareM Offline
                          martinhjelmareM Offline
                          martinhjelmare
                          Plugin Developer
                          wrote on last edited by martinhjelmare
                          #33

                          You can test it by cloning my fork of home-assistant (https://github.com/MartinHjelmare/home-assistant), then checkout my branch "mysensors-component-switch". Then install it with pip. See my console log below. BIG DISCLAIMER: This is work in progress and under development. You are cloning my branch, which is based off the home assistant dev branch, which is not a stable release.

                          martin@martin-htpc:~$ mkvirtualenv -p python3 testhomeass
                          Running virtualenv with interpreter /usr/bin/python3
                          Using base prefix '/usr'
                          New python executable in testhomeass/bin/python3
                          Also creating executable in testhomeass/bin/python
                          Installing setuptools, pip, wheel...done.
                          virtualenvwrapper.user_scripts creating /home/martin/.virtualenvs/testhomeass/bin/predeactivate
                          virtualenvwrapper.user_scripts creating /home/martin/.virtualenvs/testhomeass/bin/postdeactivate
                          virtualenvwrapper.user_scripts creating /home/martin/.virtualenvs/testhomeass/bin/preactivate
                          virtualenvwrapper.user_scripts creating /home/martin/.virtualenvs/testhomeass/bin/postactivate
                          virtualenvwrapper.user_scripts creating /home/martin/.virtualenvs/testhomeass/bin/get_env_details
                          (testhomeass)martin@martin-htpc:~$ cd Dev/
                          (testhomeass)martin@martin-htpc:~/Dev$ mkdir testhomeass
                          (testhomeass)martin@martin-htpc:~/Dev$ cd testhomeass/
                          (testhomeass)martin@martin-htpc:~/Dev/testhomeass$ git clone git@github.com:MartinHjelmare/home-assistant.git
                          Klonar till "home-assistant"...
                          remote: Counting objects: 28876, done.
                          remote: Total 28876 (delta 0), reused 0 (delta 0), pack-reused 28876
                          Tar emot objekt: 100% (28876/28876), 25.45 MiB | 1.59 MiB/s, done.
                          Analyserar delta: 100% (19679/19679), done.
                          Kontrollerar anslutning... klart.
                          (testhomeass)martin@martin-htpc:~/Dev/testhomeass$ cd home-assistant/
                          (testhomeass)martin@martin-htpc:~/Dev/testhomeass/home-assistant$ git status 
                          På grenen dev
                          Din gren är à jour med "origin/dev".
                          
                          inget att checka in, arbetskatalogen ren
                          (testhomeass)martin@martin-htpc:~/Dev/testhomeass/home-assistant$ git checkout mysensors-component-switch
                          Grenen mysensors-component-switch ställdes in att spåra fjärrgrenen mysensors-component-switch från origin.
                          Växlade till en ny gren "mysensors-component-switch"
                          (testhomeass)martin@martin-htpc:~/Dev/testhomeass/home-assistant$ pip install .
                          Processing /home/martin/Dev/testhomeass/home-assistant
                          Collecting requests<3,>=2 (from homeassistant==0.9.0.dev0)
                            Using cached requests-2.8.1-py2.py3-none-any.whl
                          Collecting pyyaml<4,>=3.11 (from homeassistant==0.9.0.dev0)
                          Collecting pytz>=2015.4 (from homeassistant==0.9.0.dev0)
                            Using cached pytz-2015.7-py2.py3-none-any.whl
                          Requirement already satisfied (use --upgrade to upgrade): pip>=7.0.0 in /home/martin/.virtualenvs/testhomeass/lib/python3.4/site-packages (from homeassistant==0.9.0.dev0)
                          Collecting vincenty==0.1.3 (from homeassistant==0.9.0.dev0)
                          Building wheels for collected packages: homeassistant
                            Running setup.py bdist_wheel for homeassistant
                            Stored in directory: /home/martin/.cache/pip/wheels/0d/98/ff/ecb5c632258e50fbc91b535762865e4a132eb966f5c28f00d7
                          Successfully built homeassistant
                          Installing collected packages: requests, pyyaml, pytz, vincenty, homeassistant
                          Successfully installed homeassistant-0.9.0.dev0 pytz-2015.7 pyyaml-3.11 requests-2.8.1 vincenty-0.1.3
                          (testhomeass)martin@martin-htpc:~/Dev/testhomeass/home-assistant$ hass
                          Config directory: /home/martin/.homeassistant
                          WARNING:homeassistant.bootstrap:Colorlog package not found, console coloring disabled
                          INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: service=turn_off, domain=homeassistant>
                          INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: service=turn_on, domain=homeassistant>
                          INFO:homeassistant.bootstrap:Home Assistant core initialized
                          INFO:homeassistant.loader:Loaded introduction from homeassistant.components.introduction
                          INFO:homeassistant.loader:Loaded history from homeassistant.components.history
                          INFO:homeassistant.loader:Loaded recorder from homeassistant.components.recorder
                          INFO:homeassistant.loader:Loaded http from homeassistant.components.http
                          INFO:homeassistant.loader:Loaded notify from homeassistant.components.notify
                          INFO:homeassistant.loader:Loaded logbook from homeassistant.components.logbook
                          INFO:homeassistant.loader:Loaded sensor from homeassistant.components.sensor
                          INFO:homeassistant.loader:Loaded mysensors from homeassistant.components.mysensors
                          INFO:homeassistant.loader:Loaded switch from homeassistant.components.switch
                          INFO:homeassistant.loader:Loaded frontend from homeassistant.components.frontend
                          INFO:homeassistant.loader:Loaded api from homeassistant.components.api
                          INFO:homeassistant.loader:Loaded logger from homeassistant.components.logger
                          INFO:homeassistant.loader:Loaded conversation from homeassistant.components.conversation
                          INFO:homeassistant.loader:Loaded automation from homeassistant.components.automation
                          INFO:homeassistant.loader:Loaded group from homeassistant.components.group
                          INFO:homeassistant.components.introduction:
                          
                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                          
                                  Hello, and welcome to Home Assistant!
                          
                                  We'll hope that we can make all your dreams come true.
                          
                                  Here are some resources to get started:
                          
                                   - Configuring Home Assistant:
                                     https://home-assistant.io/getting-started/configuration/
                          
                                   - Available components:
                                     https://home-assistant.io/components/
                          
                                   - Troubleshooting your configuration:
                                     https://home-assistant.io/getting-started/troubleshooting-configuration/
                          
                                   - Getting help:
                                     https://home-assistant.io/help/
                          
                                  This message is generated by the introduction component. You can
                                  disable it in configuration.yaml.
                          
                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                              
                          INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=introduction>
                          INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=recorder>
                          INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=logger>
                          INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=http>
                          INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=history>
                          INFO:homeassistant.loader:Loaded notify.telegram from homeassistant.components.notify.telegram
                          INFO:homeassistant.util.package:Attempting install of python-telegram-bot==2.8.7
                          INFO:homeassistant.components.notify.telegram:Telegram bot is '***censored***'.
                          INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: service=telegram, domain=notify>
                          INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=notify>
                          INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=logbook>
                          INFO:homeassistant.loader:Loaded sensor.mysensors from homeassistant.components.sensor.mysensors
                          INFO:homeassistant.util.package:Attempting install of https://github.com/MartinHjelmare/pymysensors/archive/fifo_queue.zip#pymysensors==0.3
                          INFO:mysensors.mysensors:Trying to connect to /dev/ttyUSB0
                          INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=mysensors>
                          INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=sensor>
                          INFO:homeassistant.loader:Loaded switch.mysensors from homeassistant.components.switch.mysensors
                          INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: service=turn_off, domain=switch>
                          INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: service=turn_on, domain=switch>
                          INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=switch>
                          INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=api>
                          INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=frontend>
                          INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: service=process, domain=conversation>
                          INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=conversation>
                          INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=group>
                          INFO:homeassistant.loader:Loaded automation.state from homeassistant.components.automation.state
                          INFO:homeassistant.components.automation:Initialized rule Rule 1 - Door bell pressed
                          INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=automation>
                          INFO:homeassistant.core:Starting Home Assistant (16 threads)
                          INFO:homeassistant.core:Bus:Handling <Event homeassistant_start[L]>
                          INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: service=stop, domain=homeassistant>
                          INFO:homeassistant.components.mysensors:update persistence: node 1
                          INFO:homeassistant.core:Bus:Handling <Event MYSENSORS_NODE_UPDATE[L]: port=/dev/ttyUSB0, devices=, update_type=persistence, node_id=1>
                          INFO:homeassistant.components.mysensors:update persistence: node 1
                          INFO:homeassistant.components.mysensors:update persistence: node 1
                          INFO:homeassistant.components.mysensors:adding new devices: [<Entity Sensebender Micro Bell 1.1: >, <Entity Sensebender Micro Bell 1.2: >, <Entity Sensebender Micro Bell 1.199: >]
                          INFO:homeassistant.components.http:Starting web interface at http://0.0.0.0:8123
                          INFO:homeassistant.core:Timer:starting
                          INFO:homeassistant.core:Bus:Handling <Event MYSENSORS_NODE_UPDATE[L]: port=/dev/ttyUSB0, devices=1=1=0=<Entity Sensebender Micro Bell 1.1: >, 2=1=<Entity Sensebender Micro Bell 1.2: >, 3=, 199=38=<Entity Sensebender Micro Bell 1.199: >, update_type=persistence, node_id=1>
                          INFO:homeassistant.components.mysensors:update persistence: node 1
                          INFO:homeassistant.components.mysensors:update persistence: node 1
                          INFO:homeassistant.components.mysensors:update persistence: node 1
                          INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: entity_id=sensor.sensebender_micro_bell_11, new_state=<state sensor.sensebender_micro_bell_11=; battery_level=0, unit_of_measurement=°C, child_id=1, node_id=1, friendly_name=Sensebender Micro Bell 1.1 @ 01:26:30 13-12-2015>>
                          INFO:homeassistant.components.sensor.mysensors:Sensebender Micro Bell 1.1: value_type 0, value = 21.0
                          INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: entity_id=sensor.sensebender_micro_bell_12, new_state=<state sensor.sensebender_micro_bell_12=; battery_level=0, unit_of_measurement=%, child_id=2, node_id=1, friendly_name=Sensebender Micro Bell 1.2 @ 01:26:30 13-12-2015>>
                          INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: entity_id=sensor.sensebender_micro_bell_11, old_state=<state sensor.sensebender_micro_bell_11=; battery_level=0, unit_of_measurement=°C, child_id=1, node_id=1, friendly_name=Sensebender Micro Bell 1.1 @ 01:26:30 13-12-2015>, new_state=<state sensor.sensebender_micro_bell_11=21.0; battery_level=100, unit_of_measurement=°C, child_id=1, node_id=1, friendly_name=Sensebender Micro Bell 1.1 @ 01:26:30 13-12-2015>>
                          INFO:homeassistant.components.sensor.mysensors:Sensebender Micro Bell 1.2: value_type 1, value = 34
                          INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: entity_id=sensor.sensebender_micro_bell_12, old_state=<state sensor.sensebender_micro_bell_12=; battery_level=0, unit_of_measurement=%, child_id=2, node_id=1, friendly_name=Sensebender Micro Bell 1.2 @ 01:26:30 13-12-2015>, new_state=<state sensor.sensebender_micro_bell_12=34; battery_level=100, unit_of_measurement=%, child_id=2, node_id=1, friendly_name=Sensebender Micro Bell 1.2 @ 01:26:30 13-12-2015>>
                          INFO:homeassistant.components.sensor.mysensors:Sensebender Micro Bell 1.199: value_type 38, value = 3160
                          INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: entity_id=sensor.sensebender_micro_bell_1199, new_state=<state sensor.sensebender_micro_bell_1199=; battery_level=0, unit_of_measurement=V, child_id=199, node_id=1, friendly_name=Sensebender Micro Bell 1.199 @ 01:26:30 13-12-2015>>
                          INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: entity_id=sensor.sensebender_micro_bell_1199, old_state=<state sensor.sensebender_micro_bell_1199=; battery_level=0, unit_of_measurement=V, child_id=199, node_id=1, friendly_name=Sensebender Micro Bell 1.199 @ 01:26:30 13-12-2015>, new_state=<state sensor.sensebender_micro_bell_1199=3160; battery_level=100, unit_of_measurement=V, child_id=199, node_id=1, friendly_name=Sensebender Micro Bell 1.199 @ 01:26:30 13-12-2015>>
                          INFO:mysensors.mysensors:/dev/ttyUSB0 is open...
                          INFO:mysensors.mysensors:Connected to /dev/ttyUSB0
                          WARNING:mysensors.mysensors:Error decoding message from gateway, probably received bad byte.
                          ^CINFO:homeassistant.core:Stopping
                          INFO:homeassistant.core:Bus:Handling <Event homeassistant_stop[L]>
                          INFO:mysensors.mysensors:Disconnecting from /dev/ttyUSB0
                          INFO:mysensors.mysensors:Stopping thread
                          INFO:homeassistant.components.recorder:Closing database
                          (testhomeass)martin@martin-htpc:~/Dev/testhomeass/home-assistant$ hass
                          Config directory: /home/martin/.homeassistant
                          WARNING:homeassistant.bootstrap:Colorlog package not found, console coloring disabled
                          INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: domain=homeassistant, service=turn_off>
                          INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: domain=homeassistant, service=turn_on>
                          INFO:homeassistant.bootstrap:Home Assistant core initialized
                          INFO:homeassistant.loader:Loaded history from homeassistant.components.history
                          INFO:homeassistant.loader:Loaded recorder from homeassistant.components.recorder
                          INFO:homeassistant.loader:Loaded http from homeassistant.components.http
                          INFO:homeassistant.loader:Loaded mysensors from homeassistant.components.mysensors
                          INFO:homeassistant.loader:Loaded conversation from homeassistant.components.conversation
                          INFO:homeassistant.loader:Loaded frontend from homeassistant.components.frontend
                          INFO:homeassistant.loader:Loaded api from homeassistant.components.api
                          INFO:homeassistant.loader:Loaded notify from homeassistant.components.notify
                          INFO:homeassistant.loader:Loaded introduction from homeassistant.components.introduction
                          INFO:homeassistant.loader:Loaded logbook from homeassistant.components.logbook
                          INFO:homeassistant.loader:Loaded switch from homeassistant.components.switch
                          INFO:homeassistant.loader:Loaded sensor from homeassistant.components.sensor
                          INFO:homeassistant.loader:Loaded logger from homeassistant.components.logger
                          INFO:homeassistant.loader:Loaded automation from homeassistant.components.automation
                          INFO:homeassistant.loader:Loaded group from homeassistant.components.group
                          INFO:homeassistant.components.introduction:
                          
                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                          
                                  Hello, and welcome to Home Assistant!
                          
                                  We'll hope that we can make all your dreams come true.
                          
                                  Here are some resources to get started:
                          
                                   - Configuring Home Assistant:
                                     https://home-assistant.io/getting-started/configuration/
                          
                                   - Available components:
                                     https://home-assistant.io/components/
                          
                                   - Troubleshooting your configuration:
                                     https://home-assistant.io/getting-started/troubleshooting-configuration/
                          
                                   - Getting help:
                                     https://home-assistant.io/help/
                          
                                  This message is generated by the introduction component. You can
                                  disable it in configuration.yaml.
                          
                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                              
                          INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=introduction>
                          INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=recorder>
                          INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=logger>
                          INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=http>
                          INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=history>
                          INFO:mysensors.mysensors:Trying to connect to /dev/ttyUSB0
                          INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=mysensors>
                          INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: domain=conversation, service=process>
                          INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=conversation>
                          INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=api>
                          INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=frontend>
                          INFO:homeassistant.loader:Loaded notify.telegram from homeassistant.components.notify.telegram
                          INFO:homeassistant.components.notify.telegram:Telegram bot is '***censored***'.
                          INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: domain=notify, service=telegram>
                          INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=notify>
                          INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=logbook>
                          INFO:homeassistant.loader:Loaded switch.mysensors from homeassistant.components.switch.mysensors
                          INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: domain=switch, service=turn_off>
                          INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: domain=switch, service=turn_on>
                          INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=switch>
                          INFO:homeassistant.loader:Loaded sensor.mysensors from homeassistant.components.sensor.mysensors
                          INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=sensor>
                          INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=group>
                          INFO:homeassistant.loader:Loaded automation.state from homeassistant.components.automation.state
                          INFO:homeassistant.components.automation:Initialized rule Rule 1 - Door bell pressed
                          INFO:homeassistant.core:Bus:Handling <Event component_loaded[L]: component=automation>
                          INFO:homeassistant.core:Starting Home Assistant (16 threads)
                          INFO:homeassistant.core:Bus:Handling <Event homeassistant_start[L]>
                          INFO:homeassistant.core:Bus:Handling <Event service_registered[L]: domain=homeassistant, service=stop>
                          INFO:homeassistant.components.mysensors:update persistence: node 1
                          INFO:homeassistant.components.http:Starting web interface at http://0.0.0.0:8123
                          INFO:homeassistant.core:Timer:starting
                          INFO:homeassistant.core:Bus:Handling <Event MYSENSORS_NODE_UPDATE[L]: update_type=persistence, devices=, port=/dev/ttyUSB0, node_id=1>
                          INFO:homeassistant.components.mysensors:update persistence: node 1
                          INFO:homeassistant.components.mysensors:update persistence: node 1
                          INFO:homeassistant.components.mysensors:update persistence: node 1
                          INFO:homeassistant.components.mysensors:adding new devices: [<Entity Sensebender Micro Bell 1.1: >, <Entity Sensebender Micro Bell 1.2: >, <Entity Sensebender Micro Bell 1.199: >]
                          INFO:homeassistant.core:Bus:Handling <Event MYSENSORS_NODE_UPDATE[L]: update_type=persistence, devices=1=1=0=<Entity Sensebender Micro Bell 1.1: >, 2=1=<Entity Sensebender Micro Bell 1.2: >, 3=, 199=38=<Entity Sensebender Micro Bell 1.199: >, port=/dev/ttyUSB0, node_id=1>
                          INFO:homeassistant.components.mysensors:update persistence: node 1
                          INFO:homeassistant.components.mysensors:update persistence: node 1
                          INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: new_state=<state sensor.sensebender_micro_bell_11=; child_id=1, unit_of_measurement=°C, battery_level=0, friendly_name=Sensebender Micro Bell 1.1, node_id=1 @ 01:26:49 13-12-2015>, entity_id=sensor.sensebender_micro_bell_11>
                          INFO:homeassistant.components.sensor.mysensors:Sensebender Micro Bell 1.1: value_type 0, value = 21.0
                          INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: new_state=<state sensor.sensebender_micro_bell_12=; child_id=2, unit_of_measurement=%, battery_level=0, friendly_name=Sensebender Micro Bell 1.2, node_id=1 @ 01:26:49 13-12-2015>, entity_id=sensor.sensebender_micro_bell_12>
                          INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: old_state=<state sensor.sensebender_micro_bell_11=; child_id=1, unit_of_measurement=°C, battery_level=0, friendly_name=Sensebender Micro Bell 1.1, node_id=1 @ 01:26:49 13-12-2015>, new_state=<state sensor.sensebender_micro_bell_11=21.0; child_id=1, unit_of_measurement=°C, battery_level=100, friendly_name=Sensebender Micro Bell 1.1, node_id=1 @ 01:26:49 13-12-2015>, entity_id=sensor.sensebender_micro_bell_11>
                          INFO:homeassistant.components.sensor.mysensors:Sensebender Micro Bell 1.2: value_type 1, value = 34
                          INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: old_state=<state sensor.sensebender_micro_bell_12=; child_id=2, unit_of_measurement=%, battery_level=0, friendly_name=Sensebender Micro Bell 1.2, node_id=1 @ 01:26:49 13-12-2015>, new_state=<state sensor.sensebender_micro_bell_12=34; child_id=2, unit_of_measurement=%, battery_level=100, friendly_name=Sensebender Micro Bell 1.2, node_id=1 @ 01:26:49 13-12-2015>, entity_id=sensor.sensebender_micro_bell_12>
                          INFO:homeassistant.components.sensor.mysensors:Sensebender Micro Bell 1.199: value_type 38, value = 3160
                          INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: new_state=<state sensor.sensebender_micro_bell_1199=3160; child_id=199, unit_of_measurement=V, battery_level=100, friendly_name=Sensebender Micro Bell 1.199, node_id=1 @ 01:26:49 13-12-2015>, entity_id=sensor.sensebender_micro_bell_1199>
                          INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: old_state=<state sensor.sensebender_micro_bell_1199=3160; child_id=199, unit_of_measurement=V, battery_level=100, friendly_name=Sensebender Micro Bell 1.199, node_id=1 @ 01:26:49 13-12-2015>, new_state=<state sensor.sensebender_micro_bell_1199=; child_id=199, unit_of_measurement=V, battery_level=0, friendly_name=Sensebender Micro Bell 1.199, node_id=1 @ 01:26:49 13-12-2015>, entity_id=sensor.sensebender_micro_bell_1199>
                          INFO:mysensors.mysensors:/dev/ttyUSB0 is open...
                          INFO:mysensors.mysensors:Connected to /dev/ttyUSB0
                          INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:gateway started, id=0, parent=0, distance=0
                          

                          You can see that I get a warning about bad byte, after first start. I solve this by restarting hass.

                          Your home assistant config for mysensors should now be structured like this:

                          mysensors:
                            port:
                              - '/dev/ttyUSB0'
                            #  - '/dev/ttyACM0'
                            debug: true
                            persistence: true
                            persistence_file:
                              - '/home/martin/.homeassistant/mysensors.json'
                            #  - '/home/martin/.homeassistant/mysensors2.json'
                            version: '1.5'
                          
                          sensor:
                            platform: mysensors
                          
                          switch:
                            platform: mysensors
                          
                          1 Reply Last reply
                          0
                          • D drock1985

                            Hi @martinhjelmare

                            I decided to try this on a simplier sketch that I have, but still no luck. I added this line gw.send(lightMsgW.set("1")); to the end of void setup(). The sensor shows up at the top of the States screen in HA, but doesn't let me actually control it, and it doesn't show up in Switches or Lights.

                            Here is the sketch that I am using.

                            /**
                             * The MySensors Arduino library handles the wireless radio link and protocol
                             * between your home built sensors/actuators and HA controller of choice.
                             * The sensors forms a self healing radio network with optional repeaters. Each
                             * repeater and gateway builds a routing tables in EEPROM which keeps track of the
                             * network topology allowing messages to be routed to nodes.
                             *
                             * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
                             * Copyright (C) 2013-2015 Sensnology AB
                             * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
                             *
                             * Documentation: http://www.mysensors.org
                             * Support Forum: http://forum.mysensors.org
                             *
                             * This program is free software; you can redistribute it and/or
                             * modify it under the terms of the GNU General Public License
                             * version 2 as published by the Free Software Foundation.
                             *
                             *******************************
                             *
                             * REVISION HISTORY
                             * Version 1.0 - 6-December-2015, Derrick Rockwell
                             *
                             * DESCRIPTION
                             *This sketch uses two 30 bulb, 3mm LED holiday light strings. These
                             *can usually be found in most dollar stores/hardware stores and are 
                             *battery powered. This sketch uses digital pins 3 and 4 to power two 
                             *a string of lights each. Ex, one can control white lights the other
                             *could control multi-colour lights. 
                             */
                            
                            #define SN "HolidayLEDDeskLights"
                            #define SV "1.0"
                            
                            #include <MySensor.h> 
                            #include <SPI.h>
                            
                            #define MLED_PIN 3      // Pin Multi-Coloured LED's will attached to
                            #define WLED_PIN 5      // Pin White-Coloured LED's will attached to
                            #define FADE_DELAY 10  // Delay in ms for each percentage fade up/down (10ms = 1s full-range dim)
                            #define CHILD_ID0 3
                            #define CHILD_ID1 5
                            
                            MySensor gw;
                            
                            static int currentLevelM = 0;  // Current dim level...
                            static int currentLevelW = 0;  // Current dim level...
                            
                            MyMessage dimmerMsgM(MLED_PIN, V_DIMMER);
                            MyMessage lightMsgM(MLED_PIN, V_LIGHT);
                            MyMessage dimmerMsgW(WLED_PIN, V_DIMMER);
                            MyMessage lightMsgW(WLED_PIN, V_LIGHT);
                            
                            /***
                             * Dimmable LED initialization method
                             */
                            void setup()  
                            { 
                              Serial.println( SN ); 
                              Serial.println( SV );
                              gw.begin( incomingMessage );
                              
                              // Register the LED Dimmable Light with the gateway
                              gw.present( MLED_PIN, S_DIMMER );
                              gw.present( WLED_PIN, S_DIMMER );
                              
                              gw.sendSketchInfo(SN, SV);
                              // Pull the gateway's current dim level - restore light level upon sendor node power-up
                              gw.request( MLED_PIN, V_DIMMER );
                              gw.request( WLED_PIN, V_DIMMER );
                              gw.send(lightMsgW.set("1"));
                            }
                            
                            /***
                             *  Dimmable LED main processing loop 
                             */
                            void loop() 
                            {
                              gw.process();
                            }
                            
                            //For Multi Coloured Lights
                            void incomingMessage(const MyMessage &message) {
                            if (message.type == V_LIGHT || message.type == V_DIMMER) {
                                  // if (message.sensor <= 2)
                                  {
                                      //0: All Dimmers
                                      //1: LED 1
                                      //2: LED 2
                                      //  Retrieve the power or dim level from the incoming request message
                                      int requestedLevel = atoi( message.data );
                                      
                                      // Adjust incoming level if this is a V_LIGHT variable update [0 == off, 1 == on]
                                      requestedLevel *= ( message.type == V_LIGHT ? 100 : 1 );
                                      
                                      if ((message.sensor == CHILD_ID0) || (message.sensor == 0)){
                                        fadeToLevel ( requestedLevel, MLED_PIN, &currentLevelM );
                                        // Inform the gateway of the current DimmableLED's SwitchPower1 and LoadLevelStatus value...
                                        gw.send(lightMsgM.set(requestedLevel > 0 ? 1 : 0));
                                        gw.send(dimmerMsgM.set(requestedLevel) );
                                      }
                                      if ((message.sensor == CHILD_ID1) || (message.sensor == 0)){
                                        fadeToLevel( requestedLevel, WLED_PIN, &currentLevelW );
                                        // Inform the gateway of the current DimmableLED's SwitchPower1 and LoadLevelStatus value...
                                        gw.send(lightMsgW.set(requestedLevel > 0 ? 1 : 0));
                                        gw.send(dimmerMsgW.set(requestedLevel) );
                                      }
                                    }
                            }
                            }
                            
                            /***
                             *  This method provides a graceful fade up/down effect
                             */
                             // For Multi Coloured Lights
                            void fadeToLevel( int toLevel, int pin, int *currentLevel ) {
                              int delta = ( toLevel - (*currentLevel) ) < 0 ? -1 : 1;
                              while ( (*currentLevel) != toLevel ) {
                                (*currentLevel) += delta;
                                analogWrite( pin, (int)((*currentLevel) / 100. * 255) );
                                delay( FADE_DELAY );
                              }
                            }
                            
                            H Offline
                            H Offline
                            humblehacker
                            wrote on last edited by
                            #34

                            @drock1985
                            It looks like we're trying to do similar things with HA and MYS... I've been working on a rotary encoder switch for colored lights (eg Limitlessled/HUE etc...) and had been trying to program it through MQTT. However, I just now noticed the LEDDIMMERwithROTARYENCODER sketch in the MySensors examples so I thought I might try using MYS instead of MQTT. Of course that leads right back to the lack of support for MYS Switches in HASS... Perhaps there's a solution for both of our problems if we use an MQTT Gateway instead? I've worked with MQTT and NodeRED before and it was pretty straight forward, but then again I've been having a much harder time understanding the way its implemented in HASS... So I might need to work with it some more before I can be of any help testing the MQTT MYS Gateway with HA...

                            martinhjelmareM 1 Reply Last reply
                            0
                            • H humblehacker

                              @drock1985
                              It looks like we're trying to do similar things with HA and MYS... I've been working on a rotary encoder switch for colored lights (eg Limitlessled/HUE etc...) and had been trying to program it through MQTT. However, I just now noticed the LEDDIMMERwithROTARYENCODER sketch in the MySensors examples so I thought I might try using MYS instead of MQTT. Of course that leads right back to the lack of support for MYS Switches in HASS... Perhaps there's a solution for both of our problems if we use an MQTT Gateway instead? I've worked with MQTT and NodeRED before and it was pretty straight forward, but then again I've been having a much harder time understanding the way its implemented in HASS... So I might need to work with it some more before I can be of any help testing the MQTT MYS Gateway with HA...

                              martinhjelmareM Offline
                              martinhjelmareM Offline
                              martinhjelmare
                              Plugin Developer
                              wrote on last edited by
                              #35

                              @humblehacker

                              Hi!

                              I also want to try the MQTT gateway together with HA. MQTT support is well supported in HA, and looking at the MQTT protocol in mysensors dev branch it looks promising. I have just got some ethernet modules and more nanos, so as soon as I find some time, I'll get started. We can post our progress somewhere here whoever gets it going first.

                              1 Reply Last reply
                              0
                              • D Offline
                                D Offline
                                drock1985
                                wrote on last edited by drock1985
                                #36

                                @humblehacker @martinhjelmare

                                Sounds like an interesting idea to me. I have never used a MQTT gateway before, so i'm going in a little blind. I think I have the server so far (mosquitto) running on the same RPI as my HA install; so now looking into the next step.

                                One thing though, would this replace my current serial gateway, or be an addition to it?

                                My Projects
                                2 Door Chime Sensor
                                Washing Machine Monitor

                                1 Reply Last reply
                                0
                                • D Offline
                                  D Offline
                                  drock1985
                                  wrote on last edited by
                                  #37

                                  I've been trying to get MQTT working using the Dev branch here (http://forum.mysensors.org/topic/2352/guide-setting-up-and-testing-mqtt-client-gateway/) and have my configuration.yaml file looking like this for my W5100MQTT broker:

                                  #MySensors MQTT Test
                                  mqtt 1:
                                    broker: 192.168.86.198
                                    port: 1883
                                  #  client_id: home-assistant-1
                                    keepalive: 60
                                  #  username: USERNAME
                                  #  password: PASSWORD
                                  
                                  

                                  The Serial output from Arduino shows that I connected successfully

                                  0;0;3;0;9;Starting gateway (RNNGA-, 1.6.0-beta)
                                  0;0;3;0;9;Radio init successful.
                                  IP: 192.168.86.112
                                  0;0;3;0;9;Attempting MQTT connection...
                                  0;0;3;0;9;MQTT connected
                                  0;0;3;0;9;Init complete, id=0, parent=0, distance=0
                                  

                                  But, Home-Assistant isn't registering the broker, and I have this error in the Dev section:

                                  15-12-15 15:32:17 homeassistant.components.mqtt: Missing required configuration items in mqtt: broker
                                  15-12-15 15:32:17 homeassistant.bootstrap: component mqtt failed to initialize
                                  

                                  Does anyone have any ideas? @humblehacker @martinhjelmare @hek ?

                                  My Projects
                                  2 Door Chime Sensor
                                  Washing Machine Monitor

                                  martinhjelmareM H 2 Replies Last reply
                                  0
                                  • hekH Offline
                                    hekH Offline
                                    hek
                                    Admin
                                    wrote on last edited by
                                    #38

                                    Sorry, havent tried HomeAssistant myself.

                                    1 Reply Last reply
                                    0
                                    • D Offline
                                      D Offline
                                      drock1985
                                      wrote on last edited by
                                      #39

                                      Thanks @hek , had to ask :)

                                      Would it be possible to get a Home-Assistant dedicated sub-forum please?

                                      My Projects
                                      2 Door Chime Sensor
                                      Washing Machine Monitor

                                      1 Reply Last reply
                                      0
                                      • D drock1985

                                        I've been trying to get MQTT working using the Dev branch here (http://forum.mysensors.org/topic/2352/guide-setting-up-and-testing-mqtt-client-gateway/) and have my configuration.yaml file looking like this for my W5100MQTT broker:

                                        #MySensors MQTT Test
                                        mqtt 1:
                                          broker: 192.168.86.198
                                          port: 1883
                                        #  client_id: home-assistant-1
                                          keepalive: 60
                                        #  username: USERNAME
                                        #  password: PASSWORD
                                        
                                        

                                        The Serial output from Arduino shows that I connected successfully

                                        0;0;3;0;9;Starting gateway (RNNGA-, 1.6.0-beta)
                                        0;0;3;0;9;Radio init successful.
                                        IP: 192.168.86.112
                                        0;0;3;0;9;Attempting MQTT connection...
                                        0;0;3;0;9;MQTT connected
                                        0;0;3;0;9;Init complete, id=0, parent=0, distance=0
                                        

                                        But, Home-Assistant isn't registering the broker, and I have this error in the Dev section:

                                        15-12-15 15:32:17 homeassistant.components.mqtt: Missing required configuration items in mqtt: broker
                                        15-12-15 15:32:17 homeassistant.bootstrap: component mqtt failed to initialize
                                        

                                        Does anyone have any ideas? @humblehacker @martinhjelmare @hek ?

                                        martinhjelmareM Offline
                                        martinhjelmareM Offline
                                        martinhjelmare
                                        Plugin Developer
                                        wrote on last edited by
                                        #40

                                        @drock1985

                                        What do you set MY_IP_GATEWAY_ADDRESS to on the arduino side?

                                        1 Reply Last reply
                                        0
                                        • hekH Offline
                                          hekH Offline
                                          hek
                                          Admin
                                          wrote on last edited by
                                          #41

                                          @drock1985 said:

                                          Would it be possible to get a Home-Assistant dedicated sub-forum please?

                                          You got it.
                                          http://forum.mysensors.org/category/28/home-assistant

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          19

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.1k

                                          Posts


                                          Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

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