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 v 0.11.1 with switch support

Home Assistant v 0.11.1 with switch support

Scheduled Pinned Locked Moved Home Assistant
switchserial gatewayhome assistant
53 Posts 5 Posters 22.0k Views 5 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.
  • M mirko314

    @martinhjelmare
    Got that worked out, changed the Name in the Persistence File that HA created! :+1:
    But it still does not show up.
    HA Log:

    INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:read: 1-1-0 s=3,c=1,t=16,pt=2,l=2,sg=0:1
    INFO:homeassistant.components.mysensors:update sensor_update: node 1
    INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:read: 1-1-0 s=3,c=1,t=16,pt=2,l=2,sg=0:0
    INFO:homeassistant.components.mysensors:update sensor_update: node 1
    INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:read: 1-1-0 s=3,c=1,t=16,pt=2,l=2,sg=0:1
    INFO:homeassistant.components.mysensors:update sensor_update: node 1
    INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:read: 1-1-0 s=3,c=1,t=16,pt=2,l=2,sg=0:0
    INFO:homeassistant.components.mysensors:update sensor_update: node 1
    

    Persistence File:

    {"1": {"sketch_version": null, "children": {"3": {"type": 0, "values": {"16": "0"}, "id": 3}}, "sketch_name": "testgateway", "battery_level": 0, "sensor_id": 1, "type": 17}}
    
    martinhjelmareM Offline
    martinhjelmareM Offline
    martinhjelmare
    Plugin Developer
    wrote on last edited by
    #10

    @mirko314

    I can't see anything obviously wrong with the persistence file, except for sketch version being null, although that is not used by HA. Try changing that to "1.0" and restart.

    1 Reply Last reply
    0
    • M mirko314

      @martinhjelmare
      Got that worked out, changed the Name in the Persistence File that HA created! :+1:
      But it still does not show up.
      HA Log:

      INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:read: 1-1-0 s=3,c=1,t=16,pt=2,l=2,sg=0:1
      INFO:homeassistant.components.mysensors:update sensor_update: node 1
      INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:read: 1-1-0 s=3,c=1,t=16,pt=2,l=2,sg=0:0
      INFO:homeassistant.components.mysensors:update sensor_update: node 1
      INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:read: 1-1-0 s=3,c=1,t=16,pt=2,l=2,sg=0:1
      INFO:homeassistant.components.mysensors:update sensor_update: node 1
      INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:read: 1-1-0 s=3,c=1,t=16,pt=2,l=2,sg=0:0
      INFO:homeassistant.components.mysensors:update sensor_update: node 1
      

      Persistence File:

      {"1": {"sketch_version": null, "children": {"3": {"type": 0, "values": {"16": "0"}, "id": 3}}, "sketch_name": "testgateway", "battery_level": 0, "sensor_id": 1, "type": 17}}
      
      martinhjelmareM Offline
      martinhjelmareM Offline
      martinhjelmare
      Plugin Developer
      wrote on last edited by
      #11

      @mirko314

      Btw, your values are setup for a door sensor and not a switch. Maybe that was your intention?

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mirko314
        wrote on last edited by
        #12

        @martinhjelmare
        I Changed the Version, yet there is nothing added to the dashboard.
        I used the sample BinarySwitch example sketch of MYS. The Sensor Arduino has a button connected to Pin 3.
        I'm relativly new here so maybe I missed something. And I don't know what Values you mean.

        martinhjelmareM 1 Reply Last reply
        0
        • M mirko314

          @martinhjelmare
          I Changed the Version, yet there is nothing added to the dashboard.
          I used the sample BinarySwitch example sketch of MYS. The Sensor Arduino has a button connected to Pin 3.
          I'm relativly new here so maybe I missed something. And I don't know what Values you mean.

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

          @mirko314

          Can you post your sketch and the complete log of HA after start? You can censor any sensitive info.

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

            @mirko314

            A clarification: In home assistant a switch is something you can turn on/off from home assistant, an actuator. The BinarySwitch example in mysensors examples is something you turn on/off by the node, a sensor.

            It should work anyhow, but I was a bit confused at first. :smiley:

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mirko314
              wrote on last edited by
              #15

              The Whole log is:
              screenlog.txt
              The Sketch is:
              BinarySwitchSensor.ino
              The Sketch was not modified and should be the same as the one of the MYS download Page.

              Do I maybe have to add anything to my config.yaml besides the plattform thing?

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

                Unfortunately, I've realized this is a bug caused by me. There will be a bugfix release soon, so I hope we can have a fix for this in there. Sorry for the inconvenience!

                Right now the binary sensors are missing in the sensor platform. I think it's due to me planning to do a binary sensor platform, but then changing my mind, and posponing that. Again sorry!
                :anguished:

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  mirko314
                  wrote on last edited by
                  #17

                  Alright then, I started to feel a bit dumb :D
                  If you need any help let me know!
                  Thank you for looking into the issue :+1:

                  martinhjelmareM 1 Reply Last reply
                  0
                  • M mirko314

                    Alright then, I started to feel a bit dumb :D
                    If you need any help let me know!
                    Thank you for looking into the issue :+1:

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

                    @mirko314

                    Thanks for testing and reporting the problem. All feedback is very welcome and important, cause even though I try to test most scenarios, it's easy to miss something. In this case, though, I feel a bit embarrassed. :flushed:

                    I've submitted a tested pull request which fixes this, and it has already been merged. Hopefully the bugfix release will be live very soon.

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

                      Update: Bugfix release 0.11.1 is now out.

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        mirko314
                        wrote on last edited by
                        #20

                        Nice!
                        Thank you, I installed it, works like a charm!
                        Going to try a HA switch tomorrow!
                        Are 1-Wire Components like AM2301 Temp-Sensor already supported?

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

                          I'm not sure that the library provided with mysensors supports DHT21 (AM2301). The readme for DHT library only mentions "DHT11 and DHT22, AM2302, RHT03".

                          But I found this post, where the adafruit library is used together with mysensors:
                          http://forum.mysensors.org/topic/841/solar-powered-mini-weather-station/53

                          As long as you get your temp/hum sensors going with the correct library there shouldn't be a problem of presenting them as mysensors sensors to home assistant.

                          1 Reply Last reply
                          0
                          • M Offline
                            M Offline
                            mirko314
                            wrote on last edited by mirko314
                            #22

                            Well I will look into, thank you!

                            I do not know if this is the right place for further problems, if not tell me.

                            I tried to remote control a relay today
                            I used the official sketch of MYS at https://github.com/mysensors/Arduino/blob/master/libraries/MySensors/examples/RelayActuator/RelayActuator.ino

                            Even though it Looks like they are properly connected, there is no switch appearing on HA-Dashboard.
                            Log of the Sensor-Arduino Running RelayActuator.ino:

                            send: 1-1-0-0 s=255,c=0,t=18,pt=0,l=5,sg=0,st=ok:1.5.1
                            send: 1-1-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=ok:0
                            read: 0-0-1 s=255,c=3,t=6,pt=0,l=1,sg=0:M
                            repeater started, id=1, parent=0, distance=1
                            send: 1-1-0-0 s=255,c=3,t=11,pt=0,l=5,sg=0,st=ok:Relay
                            send: 1-1-0-0 s=255,c=3,t=12,pt=0,l=3,sg=0,st=ok:1.0
                            send: 1-1-0-0 s=1,c=0,t=3,pt=0,l=0,sg=0,st=ok:
                            

                            Log of HA:

                            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
                            INFO:homeassistant.components.sensor:Updating sensor entities
                            INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:read: 1-1-0 s=255,c=0,t=18,pt=0,l=5,sg=0:1.5.1
                            INFO:homeassistant.components.mysensors:update sensor_update: node 1
                            INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:read: 1-1-0 s=255,c=3,t=6,pt=1,l=1,sg=0:0
                            INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:send: 0-0-1-1 s=255,c=3,t=6,pt=0,l=1,sg=0,st=ok:M
                            INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:read: 1-1-0 s=255,c=3,t=11,pt=0,l=5,sg=0:Relay
                            INFO:homeassistant.components.mysensors:update sensor_update: node 1
                            INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:read: 1-1-0 s=255,c=3,t=12,pt=0,l=3,sg=0:1.0
                            INFO:homeassistant.components.mysensors:update sensor_update: node 1
                            INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:read: 1-1-0 s=1,c=0,t=3,pt=0,l=0,sg=0:
                            INFO:homeassistant.components.mysensors:update sensor_update: node 1
                            INFO:homeassistant.components.device_tracker.nmap_tracker:Scanning
                            INFO:homeassistant.components.device_tracker.nmap_tracker:No MAC address found for 192.168.2.111
                            INFO:homeassistant.components.device_tracker.nmap_tracker:nmap scan successful
                            INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:read: 1-1-0 s=255,c=0,t=18,pt=0,l=5,sg=0:1.5.1
                            INFO:homeassistant.components.mysensors:update sensor_update: node 1
                            INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:read: 1-1-0 s=255,c=3,t=6,pt=1,l=1,sg=0:0
                            INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:send: 0-0-1-1 s=255,c=3,t=6,pt=0,l=1,sg=0,st=ok:M
                            INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:read: 1-1-0 s=255,c=3,t=11,pt=0,l=5,sg=0:Relay
                            INFO:homeassistant.components.mysensors:update sensor_update: node 1
                            INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:read: 1-1-0 s=255,c=3,t=12,pt=0,l=3,sg=0:1.0
                            INFO:homeassistant.components.mysensors:update sensor_update: node 1
                            INFO:mysensors.mysensors:n:0 c:0 t:3 s:9 p:read: 1-1-0 s=1,c=0,t=3,pt=0,l=0,sg=0:
                            INFO:homeassistant.components.mysensors:update sensor_update: node 1```
                            1 Reply Last reply
                            0
                            • M Offline
                              M Offline
                              mirko314
                              wrote on last edited by mirko314
                              #23

                              Sorry, I forgot to ask, is it implemented yet? :D
                              I just scrambled through the code at HA
                              https://github.com/balloob/home-assistant/blob/dev/homeassistant/components/switch/mysensors.py
                              and I could not detect the RELAY type. But than again I do not know alot of both of the systems, just guessing.

                              martinhjelmareM 1 Reply Last reply
                              0
                              • M mirko314

                                Sorry, I forgot to ask, is it implemented yet? :D
                                I just scrambled through the code at HA
                                https://github.com/balloob/home-assistant/blob/dev/homeassistant/components/switch/mysensors.py
                                and I could not detect the RELAY type. But than again I do not know alot of both of the systems, just guessing.

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

                                @mirko314

                                You should send a value from the node child to set initial state also. I think that's what's missing.

                                Read my post here:
                                http://forum.mysensors.org/topic/2388/home-assistant-how-to-recognize-mysensors-nodes/27

                                1 Reply Last reply
                                0
                                • M Offline
                                  M Offline
                                  mirko314
                                  wrote on last edited by mirko314
                                  #25

                                  @martinhjelmare
                                  Would you mind to elaborate a bit more?
                                  I am not sure how to alter the script.

                                  martinhjelmareM 1 Reply Last reply
                                  0
                                  • M mirko314

                                    @martinhjelmare
                                    Would you mind to elaborate a bit more?
                                    I am not sure how to alter the script.

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

                                    @mirko314

                                    For example:

                                    ...
                                    MySensor gw;
                                    MyMessage msgArray[NUMBER_OF_RELAYS];
                                    for (int sensor=1; sensor<=NUMBER_OF_RELAYS;sensor++) {
                                        msgArray[sensor-1] = msg(sensor, V_STATUS);
                                    }
                                    
                                    void setup() {
                                        ...
                                        gw.begin();
                                        for (int sensor=1; sensor<=NUMBER_OF_RELAYS;sensor++) {
                                            gw.present(sensor, S_BINARY);
                                            gw.send(msgArray[sensor-1].set(0));
                                        }
                                        ...
                                    }
                                    

                                    If you don't need to send any more messages after the setup funtion, ie access the message variables in the array anywhere else, you can move the assigning of the array in the first for loop to the second for loop in the setup function, to avoid code duplication.

                                    You need to send at least one value per child to populate all data structures in home assistant.

                                    Edit: You can actually move the assigning of the array and only have one for loop, inside the setup funtion, anyhow, since the array is initialized separately outside the functions.

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

                                      Hi @martinhjelmare

                                      I have installed 0.11.1 and added the lines to configuration.yaml, but my sensors are bit showing in ha itself. The ID of the nodes is being passed to ha in the log, but nothing else. Trying to set to a pir, temp/humid, and relay switches.

                                      My Projects
                                      2 Door Chime Sensor
                                      Washing Machine Monitor

                                      martinhjelmareM 1 Reply Last reply
                                      0
                                      • D drock1985

                                        Hi @martinhjelmare

                                        I have installed 0.11.1 and added the lines to configuration.yaml, but my sensors are bit showing in ha itself. The ID of the nodes is being passed to ha in the log, but nothing else. Trying to set to a pir, temp/humid, and relay switches.

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

                                        @drock1985

                                        Please show me the home assistant log. I can't really say anything useful without it.

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

                                          Hi @martinhjelmare

                                          here is the output from /home/pi/.homeassistant/home-assistant.log:

                                          6-01-24 15:08:16 netdisco.ssdp: Found malformed XML at http://192.168.86.142:9080: status=ok
                                          

                                          This is my configuration.yaml

                                          homeassistant:
                                            # Name of the location where Home Assistant is running
                                            name: Home
                                            # Location required to calculate the time the sun rises and sets
                                            latitude: 
                                            longitude: 
                                            # C for Celcius, F for Fahrenheit
                                            temperature_unit: C
                                            # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
                                            time_zone: America/Halifax
                                          
                                          # Enables the frontend
                                          frontend:
                                          
                                          # Checks for available updates
                                          updater:
                                          
                                          # View all events in a logbook
                                          logbook:
                                          # Track the sun
                                          sun:
                                          
                                          # Enables support for tracking state changes over time.
                                          history:
                                          
                                          # Show links to resources in log and frontend
                                          #introduction:
                                          
                                          # Allows you to issue voice commands from the frontend
                                          conversation:
                                          
                                          # Discover some devices automatically
                                          discovery:
                                          
                                          # Webcams
                                          camera 1:
                                            platform: mjpeg
                                            mjpeg_url: http://192.168.86.117:10012/videofeed
                                            name: LivingRoom Camera
                                            username: root
                                            password: groot
                                          
                                          # Squeezebox Server
                                          media_player 1:
                                            platform: squeezebox
                                            host: 192.168.86.113
                                            port: 9090
                                          
                                          # MySensors Serial Gateway
                                          
                                          mysensors:
                                            gateways:
                                              - port: '/dev/ttyUSB0'
                                                persistence_file: '/home/pi/.homeassistant/mysensors.json'
                                          #  debug: true
                                            persistence: true
                                            version: '1.5'
                                          

                                          Would it be because my nodes are set for manual ID and not auto?

                                          My Projects
                                          2 Door Chime Sensor
                                          Washing Machine Monitor

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


                                          17

                                          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