Navigation

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

    Posts made by Richard van der Plas

    • RE: 💬 Building a WiFi Gateway using ESP8266

      I have some strange issues with my ESP8266 Wifi gateway and NRF24L01 connection.
      All goes well for a day or so or sometimes 3, but than the WiFi communication stops, rebooting my WiFi access point solves the problem.
      It shouldn't be a DHCP issue, because that is handled through the firewall, so it must be something else. Problem is i cannot see what goes wrong, because i don't have a log anywhere on the device?
      What could be the best steps to solve or find the issue ?

      posted in Announcements
      Richard van der Plas
      Richard van der Plas
    • RE: 💬 Building a WiFi Gateway using ESP8266

      seems to work again indeed, had to flash something empty first.

      posted in Announcements
      Richard van der Plas
      Richard van der Plas
    • RE: 💬 Building a WiFi Gateway using ESP8266

      HI there, i have been using this code a while, but had to made some changes in my wifi connection info (because it seems that my Domotica controller couldnt command the gateway), but after a failed flash, i have managed to flash it again correctly, but it doesnt seem to connect to the gateway anymore, how can i check this? it wouldnt respond on a ping and i see no wifi connection in de serial log?

      posted in Announcements
      Richard van der Plas
      Richard van der Plas
    • RE: MySensor nodes powering on with Dusk / Dawn Garden lights issue

      @nca78 said in MySensor nodes powering on with Dusk / Dawn Garden lights issue:

      before()
      so i need to create like :

      void before();
      {
      delay(2500);
      }
      
      
      posted in Development
      Richard van der Plas
      Richard van der Plas
    • MySensor nodes powering on with Dusk / Dawn Garden lights issue

      I have converted some of my garden lights (not the pond lights because of the water 😉 ) to Mysensor lights with NeoPixels with different nice settings (color alarm etc). Thing is these are powerd by the 12V power lines running through the garden. This 12V system turns on @ dusk for a few hours (because they power the analog lights also). This results in 6-8 nodes booting at the same time, thus flooding the gatway with messages (presentation, getting the last state & color etc).
      The last i can fix by creating a few second wait different for all nodes, but i cannot find a option to delay the presentation and the whole bootup part of the nRF24L01 radio part.
      i found #define MY_TRANSPORT_WAIT_READY_MS but is this really working?
      i tested with the line:

      #define MY_TRANSPORT_WAIT_READY_MS 5000
      

      but didn't seem to delay / wait?

      posted in Development
      Richard van der Plas
      Richard van der Plas
    • RE: New Light is not shown in HASS

      issue seems the version number, which in 2.2 is a text string (Major releas bladiebla) that messes with the json file somehow

      posted in Home Assistant
      Richard van der Plas
      Richard van der Plas
    • New Light is not shown in HASS

      after uploading the code to a 5th node of the same code, the node is not seen in HASS,
      Debug log shows the first set section of the code is working:

      Mar 24 16:59:22 raspberrypi mysgw: GWT:RFC:C=1,MSG=14;255;3;0;6;M
      Mar 24 16:59:22 raspberrypi mysgw: TSF:MSG:SEND,0-0-14-14,s=255,c=3,t=6,pt=0,l=1,sg=0,ft=0,st=OK:M
      Mar 24 16:59:22 raspberrypi mysgw: TSF:MSG:READ,14-14-0,s=255,c=3,t=11,pt=0,l=8,sg=0:TuinLamp
      Mar 24 16:59:22 raspberrypi mysgw: TSF:MSG:READ,14-14-0,s=255,c=3,t=12,pt=0,l=3,sg=0:1.5
      Mar 24 16:59:23 raspberrypi mysgw: TSF:MSG:READ,14-14-0,s=1,c=0,t=27,pt=0,l=0,sg=0:
      Mar 24 16:59:24 raspberrypi mysgw: TSF:MSG:READ,14-14-0,s=2,c=0,t=4,pt=0,l=0,sg=0:
      Mar 24 16:59:26 raspberrypi mysgw: TSF:MSG:READ,14-14-0,s=3,c=0,t=3,pt=0,l=0,sg=0:
      Mar 24 16:59:28 raspberrypi mysgw: TSF:MSG:READ,14-14-0,s=255,c=3,t=26,pt=1,l=1,sg=0:2
      Mar 24 16:59:28 raspberrypi mysgw: TSF:MSG:SEND,0-0-14-14,s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=OK:1
      Mar 24 16:59:29 raspberrypi mysgw: TSF:MSG:READ,14-14-0,s=3,c=1,t=2,pt=2,l=2,sg=0:0
      Mar 24 16:59:30 raspberrypi mysgw: TSF:MSG:READ,14-14-0,s=2,c=1,t=2,pt=2,l=2,sg=0:0
      Mar 24 16:59:30 raspberrypi mysgw: TSF:MSG:READ,14-14-0,s=2,c=1,t=3,pt=2,l=2,sg=0:0
      Mar 24 16:59:30 raspberrypi mysgw: TSF:MSG:READ,14-14-0,s=1,c=1,t=41,pt=0,l=8,sg=0:00000000
      Mar 24 16:59:30 raspberrypi mysgw: TSF:MSG:READ,14-14-0,s=1,c=1,t=2,pt=2,l=2,sg=0:0
      Mar 24 16:59:30 raspberrypi mysgw: TSF:MSG:READ,14-14-0,s=1,c=1,t=3,pt=2,l=2,sg=0:0
      

      Home assistant log shows:

      Mar 24 17:07:22 raspberrypi hass[449]: #033[33m2018-03-24 17:07:22 WARNING (Thread-23) [mysensors] child_id 1 already exists in children of node 14, cannot add child#033[0m
      Mar 24 17:07:23 raspberrypi hass[449]: #033[33m2018-03-24 17:07:23 WARNING (Thread-23) [mysensors] child_id 2 already exists in children of node 14, cannot add child#033[0m
      Mar 24 17:07:24 raspberrypi hass[449]: #033[33m2018-03-24 17:07:24 WARNING (Thread-23) [mysensors] child_id 3 already exists in children of node 14, cannot add child#033[0m
      Mar 24 17:09:03 raspberrypi hass[449]: Exception in thread Thread-23:
      Mar 24 17:09:03 raspberrypi hass[449]: Traceback (most recent call last):
      Mar 24 17:09:03 raspberrypi hass[449]:   File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
      Mar 24 17:09:03 raspberrypi hass[449]:     self.run()
      Mar 24 17:09:03 raspberrypi hass[449]:   File "/srv/homeassistant/lib/python3.5/site-packages/mysensors/gateway_tcp.py", line 180, in run
      Mar 24 17:09:03 raspberrypi hass[449]:     response = self.handle_queue()
      Mar 24 17:09:03 raspberrypi hass[449]:   File "/srv/homeassistant/lib/python3.5/site-packages/mysensors/__init__.py", line 374, in handle_queue
      Mar 24 17:09:03 raspberrypi hass[449]:     reply = func(*args, **kwargs)
      Mar 24 17:09:03 raspberrypi hass[449]:   File "/srv/homeassistant/lib/python3.5/site-packages/mysensors/__init__.py", line 202, in logic
      Mar 24 17:09:03 raspberrypi hass[449]:     ret = self._handle_set(msg)
      Mar 24 17:09:03 raspberrypi hass[449]:   File "/srv/homeassistant/lib/python3.5/site-packages/mysensors/__init__.py", line 101, in _handle_set
      Mar 24 17:09:03 raspberrypi hass[449]:     msg.child_id, msg.sub_type, msg.payload)
      Mar 24 17:09:03 raspberrypi hass[449]:   File "/srv/homeassistant/lib/python3.5/site-packages/mysensors/__init__.py", line 519, in set_child_value
      Mar 24 17:09:03 raspberrypi hass[449]:     msg.validate(self.protocol_version)
      Mar 24 17:09:03 raspberrypi hass[449]:   File "/srv/homeassistant/lib/python3.5/site-packages/mysensors/__init__.py", line 634, in validate
      Mar 24 17:09:03 raspberrypi hass[449]:     const = get_const(protocol_version)
      Mar 24 17:09:03 raspberrypi hass[449]:   File "/srv/homeassistant/lib/python3.5/site-packages/mysensors/__init__.py", line 32, in get_const
      Mar 24 17:09:03 raspberrypi hass[449]:     if parse_ver('1.5') <= parse_ver(version) < parse_ver('2.0'):
      Mar 24 17:09:03 raspberrypi hass[449]:   File "/usr/lib/python3.5/distutils/version.py", line 52, in __lt__
      Mar 24 17:09:03 raspberrypi hass[449]:     c = self._cmp(other)
      Mar 24 17:09:03 raspberrypi hass[449]:   File "/usr/lib/python3.5/distutils/version.py", line 337, in _cmp
      Mar 24 17:09:03 raspberrypi hass[449]:     if self.version < other.version:
      Mar 24 17:09:03 raspberrypi hass[449]: TypeError: unorderable types: str() < int()
      

      and the mysensors.json file has node 14 in its list, but HASS wont show it in the states list or the made groups.yaml ?
      the other nodes didn't have that issue.

      posted in Home Assistant
      Richard van der Plas
      Richard van der Plas
    • RE: 💬 Building a Raspberry Pi Gateway

      Was pointed here from another post, having serious issues with high CPU utilization op the gateway, is there any workaround and the moment?

      top:

      asks: 157 total,   2 running, 155 sleeping,   0 stopped,   0 zombie
      %Cpu(s):  2.5 us, 23.0 sy,  0.0 ni, 74.3 id,  0.1 wa,  0.0 hi,  0.0 si,  0.0 st
      KiB Mem :   949580 total,   448732 free,   146912 used,   353936 buff/cache
      KiB Swap:   102396 total,   102396 free,        0 used.   737656 avail Mem 
      
        PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                                                                                                                                         
        337 root      20   0   20492   1060    932 R 100.0  0.1  28:54.55 mysgw                                                                                                                                           
       3947 pi        20   0    8248   3324   2736 R   1.6  0.4   0:00.82 top                                                                                                                                             
        447 homeass+  20   0  340112  63684   9916 S   1.0  6.7   3:28.71 hass                                                                                                                                            
          7 root      20   0       0      0      0 S   0.3  0.0   0:04.18 rcu_sched                                                                                                                                       
        767 root      20   0  126572   8628   6544 S   0.3  0.9   0:00.95 piplight-daemon                                                                                                                                      
      
      PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
      NAME="Raspbian GNU/Linux"
      VERSION_ID="9"
      VERSION="9 (stretch)"
      Linux raspberrypi 4.9.59-v7+ #1047 SMP Sun Oct 29 12:19:23 GMT 2017 armv7l GNU/Linux
      

      Rebooting the pi sometimes helps, sometimes freezes the pi
      seeing nothing strange in the mysensors log what so ever
      running MySensors Version 2.2.0
      and Home Assistant Version 0.64.0
      Anyone can point me in the direction where to troubleshoot this further ?
      its not a high traffic gateway (around 10 sensors connected of which 5 updating every 15 minutes)

      posted in Announcements
      Richard van der Plas
      Richard van der Plas
    • RE: latest version 2.2.0 shows strange version in presentation

      @nick-willis mine is turned around, 2.1.1 nodes give the version 2.2.x gives the text row messing up mysensors

      posted in Troubleshooting
      Richard van der Plas
      Richard van der Plas
    • RE: latest version 2.2.0 shows strange version in presentation

      @mfalkvidd the mysensors.json file

      posted in Troubleshooting
      Richard van der Plas
      Richard van der Plas
    • RE: Suddenly communication between gw & nodes stopped , rebooting pi sometimes solves it

      @gohan ty

      posted in Home Assistant
      Richard van der Plas
      Richard van der Plas
    • RE: Suddenly communication between gw & nodes stopped , rebooting pi sometimes solves it

      @gohan what i see is that the mysensors.json isnt updated with values of the different sensors on the node ?
      log shows:

      child_id 3 already exists in children of node 11, cannot add child
      3:26 PM /srv/homeassistant/lib/python3.5/site-packages/mysensors/__init__.py (WARNING)
      child_id 2 already exists in children of node 11, cannot add child
      3:26 PM /srv/homeassistant/lib/python3.5/site-packages/mysensors/__init__.py (WARNING)
      child_id 1 already exists in children of node 11, cannot add child
      3:26 PM /srv/homeassistant/lib/python3.5/site-packages/mysensors/__init__.py (WARNING)
      Node 11 is unknown
      3:25 PM /srv/homeassistant/lib/python3.5/site-packages/mysensors/__init__.py (WARNING)
      

      Small update, using the 2.1 library issues are not there so much

      posted in Home Assistant
      Richard van der Plas
      Richard van der Plas
    • RE: Suddenly communication between gw & nodes stopped , rebooting pi sometimes solves it

      @gohan said in Suddenly communication between gw & nodes stopped , rebooting pi sometimes solves it:

      myscontroller

      yes Mycontroller works as expected :), the issue lies in HA

      posted in Home Assistant
      Richard van der Plas
      Richard van der Plas
    • RE: Suddenly communication between gw & nodes stopped , rebooting pi sometimes solves it

      @gohan is there a light weigth application to test this? or do i have to install a complete suite ?
      wouldt be handy if there's just a way to do a SEND command on the gateway

      posted in Home Assistant
      Richard van der Plas
      Richard van der Plas
    • RE: Suddenly communication between gw & nodes stopped , rebooting pi sometimes solves it

      @gohan Small update, still weird things, everything works after a reboot, but after a short time, when toggling a switch in HA, nothing is send through the gateway?
      receives though work fine..

      snippet of the log, where the first sends are working, but then dead the send commands.

      Feb  6 22:01:53 raspberrypi mysgw: TSF:MSG:READ,3-3-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1
      Feb  6 22:01:53 raspberrypi mysgw: TSF:MSG:PINGED,ID=3,HP=1
      Feb  6 22:01:53 raspberrypi mysgw: TSF:MSG:SEND,0-0-3-3,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1
      Feb  6 22:01:55 raspberrypi mysgw: TSF:MSG:READ,5-3-0,s=255,c=3,t=24,pt=1,l=1,sg=0:2
      Feb  6 22:01:55 raspberrypi mysgw: TSF:MSG:PINGED,ID=5,HP=2
      Feb  6 22:01:55 raspberrypi mysgw: TSF:MSG:SEND,0-0-3-5,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1
      Feb  6 22:02:02 raspberrypi mysgw: GWT:RFC:C=0,MSG=0;255;3;0;2;
      Feb  6 22:02:02 raspberrypi mysgw: GWT:RFC:C=0,MSG=5;2;1;0;2;0
      Feb  6 22:02:02 raspberrypi mysgw: TSF:MSG:SEND,0-0-3-5,s=2,c=1,t=2,pt=0,l=1,sg=0,ft=0,st=OK:0
      Feb  6 22:02:02 raspberrypi mysgw: TSF:MSG:READ,5-3-0,s=2,c=1,t=2,pt=1,l=1,sg=0:0
      Feb  6 22:02:10 raspberrypi mysgw: TSF:MSG:READ,2-2-0,s=2,c=1,t=16,pt=0,l=1,sg=0:1
      Feb  6 22:02:12 raspberrypi mysgw: GWT:RFC:C=0,MSG=0;255;3;0;2;
      Feb  6 22:02:18 raspberrypi mysgw: TSF:MSG:READ,2-2-0,s=2,c=1,t=16,pt=0,l=1,sg=0:0
      Feb  6 22:02:22 raspberrypi mysgw: GWT:RFC:C=0,MSG=0;255;3;0;2;
      Feb  6 22:02:32 raspberrypi mysgw: GWT:RFC:C=0,MSG=0;255;3;0;2;
      Feb  6 22:02:35 raspberrypi mysgw: TSF:MSG:READ,2-2-0,s=2,c=1,t=16,pt=0,l=1,sg=0:1
      Feb  6 22:02:42 raspberrypi mysgw: GWT:RFC:C=0,MSG=0;255;3;0;2;
      Feb  6 22:02:46 raspberrypi mysgw: TSF:MSG:READ,2-2-0,s=2,c=1,t=16,pt=0,l=1,sg=0:0
      Feb  6 22:02:52 raspberrypi mysgw: GWT:RFC:C=0,MSG=0;255;3;0;2;
      Feb  6 22:02:54 raspberrypi mysgw: TSF:MSG:READ,2-2-0,s=2,c=1,t=16,pt=0,l=1,sg=0:1
      Feb  6 22:03:02 raspberrypi mysgw: GWT:RFC:C=0,MSG=0;255;3;0;2;
      Feb  6 22:03:03 raspberrypi mysgw: TSF:MSG:READ,2-2-0,s=2,c=1,t=16,pt=0,l=1,sg=0:0
      Feb  6 22:03:06 raspberrypi mysgw: TSF:MSG:READ,2-2-0,s=2,c=1,t=16,pt=0,l=1,sg=0:1
      Feb  6 22:03:12 raspberrypi mysgw: GWT:RFC:C=0,MSG=0;255;3;0;2;
      Feb  6 22:03:21 raspberrypi mysgw: TSF:MSG:READ,2-2-0,s=2,c=1,t=16,pt=0,l=1,sg=0:0
      Feb  6 22:03:22 raspberrypi mysgw: GWT:RFC:C=0,MSG=0;255;3;0;2;
      Feb  6 22:03:25 raspberrypi mysgw: TSF:MSG:READ,2-2-0,s=2,c=1,t=16,pt=0,l=1,sg=0:1
      Feb  6 22:03:32 raspberrypi mysgw: GWT:RFC:C=0,MSG=0;255;3;0;2;
      Feb  6 22:03:32 raspberrypi mysgw: TSF:MSG:READ,2-2-0,s=2,c=1,t=16,pt=0,l=1,sg=0:0
      Feb  6 22:03:38 raspberrypi mysgw: TSF:MSG:READ,2-2-0,s=2,c=1,t=16,pt=0,l=1,sg=0:1
      Feb  6 22:03:42 raspberrypi mysgw: GWT:RFC:C=0,MSG=0;255;3;0;2;
      Feb  6 22:03:45 raspberrypi mysgw: TSF:MSG:READ,5-3-0,s=1,c=1,t=0,pt=7,l=5,sg=0:-3.06
      Feb  6 22:03:45 raspberrypi mysgw: TSF:MSG:READ,5-3-0,s=0,c=1,t=16,pt=1,l=1,sg=0:0
      Feb  6 22:03:52 raspberrypi mysgw: GWT:RFC:C=0,MSG=0;255;3;0;2;
      Feb  6 22:03:53 raspberrypi mysgw: TSF:MSG:READ,2-2-0,s=2,c=1,t=16,pt=0,l=1,sg=0:0
      Feb  6 22:03:57 raspberrypi mysgw: TSF:MSG:READ,2-2-0,s=2,c=1,t=16,pt=0,l=1,sg=0:1
      Feb  6 22:03:58 raspberrypi mysgw: TSF:MSG:READ,3-3-0,s=3,c=1,t=0,pt=7,l=5,sg=0:1.0
      
      posted in Home Assistant
      Richard van der Plas
      Richard van der Plas
    • latest version 2.2.0 shows strange version in presentation

      Hi all, just updated my libary to 2.2.0, and seeing the following strange things in my presentation:

      "sketch_version":"1.6",
            "protocol_version":"2 /*!< Major release vers",
            "type":17,
            "sensor_id":11,
            "sketch_name":"TuinLamp_11",
      

      where as the previous library clearly shows the proto version:

      "10":{  
            "sketch_version":"1.5",
            "protocol_version":"2.1.1",
            "type":17,
            "sensor_id":10,
            "sketch_name":"TuinLamp",
      

      Is this normal, or not?

      posted in Troubleshooting
      Richard van der Plas
      Richard van der Plas
    • RE: Suddenly communication between gw & nodes stopped , rebooting pi sometimes solves it

      @gohan looks alot better indeed, powered the radio directly from the AAA batteries, and seems to work now, next step is why my voltage reading of the battery is way off 🙂

      posted in Home Assistant
      Richard van der Plas
      Richard van der Plas
    • RE: Suddenly communication between gw & nodes stopped , rebooting pi sometimes solves it

      @gohan weird distance is 3 meters in clear air , it was working 😞
      is has do do something with power and capacitors, connected a 3.3u one, and using a 2xaaa power supply with a DCDC stepup to 3.3 volt as in the manuals.
      what capacitors would you advice ?

      posted in Home Assistant
      Richard van der Plas
      Richard van der Plas
    • RE: Suddenly communication between gw & nodes stopped , rebooting pi sometimes solves it

      the arduino side:

      53 TSF:MSG:SEND,8-8-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      2062 !TSM:FPAR:NO REPLY
      2064 TSM:FPAR
      2101 TSF:MSG:SEND,8-8-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      4108 !TSM:FPAR:NO REPLY
      4110 TSM:FPAR
      4147 TSF:MSG:SEND,8-8-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      6154 !TSM:FPAR:NO REPLY
      6156 TSM:FPAR
      6193 TSF:MSG:SEND,8-8-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      8200 !TSM:FPAR:FAIL
      8202 TSM:FAIL:CNT=1
      8204 TSM:FAIL:PDT
      

      the gateway side:

      TSF:MSG:READ,8-8-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
      TSF:MSG:BC
      TSF:MSG:FPAR REQ,ID=8
      TSF:PNG:SEND,TO=0
      TSF:CKU:OK
      TSF:MSG:GWL OK
      !TSF:MSG:SEND,0-0-8-8,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
      TSF:MSG:READ,4-4-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1
      TSF:MSG:PINGED,ID=4,HP=1
      TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1
      TSF:MSG:READ,3-3-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1
      TSF:MSG:PINGED,ID=3,HP=1
      TSF:MSG:SEND,0-0-3-3,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1
      TSF:MSG:READ,8-8-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
      TSF:MSG:BC
      TSF:MSG:FPAR REQ,ID=8
      TSF:CKU:OK,FCTRL
      TSF:MSG:GWL OK
      
      posted in Home Assistant
      Richard van der Plas
      Richard van der Plas
    • RE: Suddenly communication between gw & nodes stopped , rebooting pi sometimes solves it

      yes, we had that discussion in another post already, seems to be running now, except 1 node gives me a headache (the newly created 3.3v arduino as discussed earlier)

      posted in Home Assistant
      Richard van der Plas
      Richard van der Plas
    • RE: Suddenly communication between gw & nodes stopped , rebooting pi sometimes solves it

      its a nrf24 PA, ill try to update to stable 2.2
      and maybey add another 4.7u, i saw in a previous post you have 2 on them

      posted in Home Assistant
      Richard van der Plas
      Richard van der Plas
    • Suddenly communication between gw & nodes stopped , rebooting pi sometimes solves it

      Hi there, the last few days suddenly all communication stopped between the GW and nodes.
      Only thing changed is the update of Home Assistant (should not interfere with the GW in my opinion)
      after a reboot it seems that receives work correctly, but sends fail suddenly.
      using a Pi3 as GW attached is the log file of what happens.
      what could be the problem suddenly?
      https://hastebin.com/osofixubog.swift
      running version: MySensors Library v2.2.0-beta

      posted in Home Assistant
      Richard van der Plas
      Richard van der Plas
    • RE: After changing IRQ pin in Mysensors setup everything falls apart

      @gohan said in After changing IRQ pin in Mysensors setup everything falls apart:

      Ams1117

      Did u user a higher power source maybe? im capped out on 2.1amps on my Pi3 power source.
      i use a LD117

      posted in Troubleshooting
      Richard van der Plas
      Richard van der Plas
    • RE: After changing IRQ pin in Mysensors setup everything falls apart

      Its a PA, used a regulator from 5volt Pi3 pin to 3.3 to the NRF24 and a capacitor on the VCC of the radio (47uF)

      posted in Troubleshooting
      Richard van der Plas
      Richard van der Plas
    • After changing IRQ pin in Mysensors setup everything falls apart

      Issue partially resolved (scroll down for info)

      Steps Taken:
      stopped the gateway,
      renamed the MySensors folder
      Followed the instalation steps for branch development.
      Problem i get now is that My Gatway receives all data as normally, but every send from the GW gets a NACK
      Small Snippet:

      an 20 13:17:44 raspberrypi mysgw: TSF:MSG:FPAR REQ,ID=4
      Jan 20 13:17:44 raspberrypi mysgw: TSF:CKU:OK,FCTRL
      Jan 20 13:17:44 raspberrypi mysgw: TSF:MSG:GWL OK
      Jan 20 13:17:44 raspberrypi mysgw: !TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
      Jan 20 13:17:44 raspberrypi mysgw: TSF:MSG:READ,3-3-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1
      Jan 20 13:17:44 raspberrypi mysgw: TSF:MSG:PINGED,ID=3,HP=1
      Jan 20 13:17:44 raspberrypi mysgw: !TSF:MSG:SEND,0-0-3-3,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=NACK:1
      Jan 20 13:17:46 raspberrypi mysgw: TSF:MSG:READ,4-4-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
      Jan 20 13:17:46 raspberrypi mysgw: TSF:MSG:BC
      Jan 20 13:17:46 raspberrypi mysgw: TSF:MSG:FPAR REQ,ID=4
      Jan 20 13:17:46 raspberrypi mysgw: TSF:CKU:OK,FCTRL
      Jan 20 13:17:46 raspberrypi mysgw: TSF:MSG:GWL OK
      Jan 20 13:17:46 raspberrypi mysgw: !TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=NACK:0
      Jan 20 13:17:48 raspberrypi mysgw: TSF:MSG:READ,4-4-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
      Jan 20 13:17:48 raspberrypi mysgw: TSF:MSG:BC
      Jan 20 13:17:48 raspberrypi mysgw: TSF:MSG:FPAR REQ,ID=4
      Jan 20 13:17:48 raspberrypi mysgw: TSF:CKU:OK,FCTRL
      Jan 20 13:17:48 raspberrypi mysgw: TSF:MSG:GWL OK
      

      more log:
      [https://hastebin.com/isedudoren.swift](link url)
      It seems to recieve stuff, but all sending gets a NACK back

      i went from
      MySensors Library v2.2.0-beta
      to
      MySensors Library v2.2.0-rc.2

      Going back to the stable to test, but that gave me:

      mysgw: Starting gateway...
      mysgw: Protocol version - 2.1.1
      mysgw: MCO:BGN:INIT GW,CP=RNNG--Q,VER=2.1.1
      mysgw: TSM:INIT
      mysgw: TSF:WUR:MS=0
      mysgw: !TSM:INIT:TSP FAIL
      mysgw: TSM:FAIL:CNT=1
      mysgw: TSM:FAIL:PDT
      mysgw: TSM:FAIL:RE-INIT
      

      As read in the manual the stable version hass issues with jessie.
      Also updated 1 node to the dev version of the arduino library. and cleared the eeprom of that one
      his debug shows:

              |___/                      2 /*!< Major release version*/.2 /*!< Minor release version*/.0 /*!< Patch version*/-rc.2
      
      23 MCO:BGN:INIT NODE,CP=RNNNA---,VER=2 /*!< Major release version*/.2 /*!< Minor release version*/.0 /*!< Patch version*/-39 TSM:INIT
      40 TSF:WUR:MS=0
      48 TSM:INIT:TSP OK
      49 TSM:INIT:STATID=8
      51 TSF:SID:OK,ID=8
      53 TSM:FPAR
      89 TSF:MSG:SEND,8-8-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      2097 !TSM:FPAR:NO REPLY
      2099 TSM:FPAR
      2135 TSF:MSG:SEND,8-8-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      4143 !TSM:FPAR:NO REPLY
      4145 TSM:FPAR
      4180 TSF:MSG:SEND,8-8-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      6189 !TSM:FPAR:NO REPLY
      6191 TSM:FPAR
      6226 TSF:MSG:SEND,8-8-255-255,s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=OK:
      8235 !TSM:FPAR:FAIL
      

      Seeing everything running for a while shows my sensor wich i updated to the beta lib, keeps being searched through a repeater node (which i nowhere near atm).

      What to do now ?
      Small update, reverted back to 2.2.0 beta without IRQ configured and now i still have the same strange thing:

      mysgw: Starting gateway...
      mysgw: Protocol version - 2.2.0-beta
      mysgw: MCO:BGN:INIT GW,CP=RNNGL---,VER=2.2.0-beta
      mysgw: TSF:LRT:OK
      mysgw: TSM:INIT
      mysgw: TSF:WUR:MS=0
      
      mysgw: TSF:MSG:SEND,0-0-255-255,s=255,c=3,t=20,pt=0,l=0,sg=0,ft=0,st=OK:
      
      mysgw: Client 0: 4;1;1;0;2;0
      mysgw: !TSF:MSG:SEND,0-0-4-4,s=1,c=1,t=2,pt=0,l=1,sg=0,ft=0,st=NACK:0
      

      Again a small update, added --my-rf24-pa-level=RF24_PA_LOW to the command.
      That fixed the issue 😞
      I thought a Pi3 could handle the power on the 5V rail with a regulator to 3.3 ....

      posted in Troubleshooting
      Richard van der Plas
      Richard van der Plas
    • RE: 💬 Building a Raspberry Pi Gateway

      Moved to normal troubleshooting forum

      posted in Announcements
      Richard van der Plas
      Richard van der Plas
    • RE: 💬 Building a Raspberry Pi Gateway

      @gohan ty

      posted in Announcements
      Richard van der Plas
      Richard van der Plas
    • RE: 💬 Building a Raspberry Pi Gateway

      but ill have to do it sometime , just ./configure with all the options, build , test and install ?

      posted in Announcements
      Richard van der Plas
      Richard van der Plas
    • RE: 💬 Building a Raspberry Pi Gateway

      @gohan make a copy of the makefile.inc and restart the ./configure command again you mean ?
      ill try it tomorrow, too afraid to break things late in the evening 😉

      posted in Announcements
      Richard van der Plas
      Richard van der Plas
    • RE: 💬 Building a Raspberry Pi Gateway

      @gohanm, as it seems not ?, can i rebuild it easily? ```

      SOC=BCM2837
      CPPFLAGS=-march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -DMY_RADIO_NRF24 -DMY_GATEWAY_LINUX -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_PORT=5003
      LDFLAGS=-pthread
      PREFIX=/usr/local
      CC=gcc
      CXX=g++
      BUILDDIR=build
      BINDIR=bin
      GATEWAY_DIR=/usr/local/bin
      INIT_SYSTEM=systemd
      SPI_DRIVER=BCM```

      posted in Announcements
      Richard van der Plas
      Richard van der Plas
    • RE: 💬 Building a Raspberry Pi Gateway

      Is there anyway where i can see if i have IRQ configured ?
      ive build it a long time ago, but now upgraded to a nrf24 PA/LNA and have more an more sensors.

      posted in Announcements
      Richard van der Plas
      Richard van der Plas
    • RE: Unknown battery drain

      @gohan thought of that to, but havent got any 3.3 laying around.
      The seem more expensive than the 5v though ;(
      the most are the atmega 168 with to little memory

      posted in Troubleshooting
      Richard van der Plas
      Richard van der Plas
    • RE: Unknown battery drain

      @boozz yeah but thats only drawing charge when the garden lights are on and charging the PowerBank, the powerbank itself runs the arduino @ 5 volt

      posted in Troubleshooting
      Richard van der Plas
      Richard van der Plas
    • RE: Unknown battery drain

      Gonna try something else first, got 12 V AC running through the garden wich turns on every night for a few hours, Gonna recitfy that and convert to 5 V, than use a NimH powerbank as a in between station to power the Arduino.
      That should give me enough juice for the day, as i can skip the l7805cv

      posted in Troubleshooting
      Richard van der Plas
      Richard van der Plas
    • RE: Unknown battery drain

      2XAA gives 2.9 volts with rechargable batteries, that is not enough to power the 5v pro mini ?

      posted in Troubleshooting
      Richard van der Plas
      Richard van der Plas
    • RE: Unknown battery drain

      Yes used that guide also, but how do i get the 9 volts down to 5 then ? should i just use the RAW input of the pro mini (havent removed that regulator)

      posted in Troubleshooting
      Richard van der Plas
      Richard van der Plas
    • Unknown battery drain

      Hey all,
      ive created a new mysensor node base on the arduino pro mini 5v.
      Removed both led's to preserver battery voltage.
      The arduino code wakes up every 1/2 hour to read 3 values from 2x Dallas sensor and one water sensor.
      all three sensors run on 5 volt, which is controlled by a transistor and only puts 5 volt on the sensors during the reading time.
      This should create a battery proof node, but it drains a 9 Volt battery in about 3 days.
      total hardware used:
      1 x bc547b to switch the 5 volt on/off to the sensors
      1x le33 to give 3.3 volts for the NRF24L01+
      1x l7805cv to give 5 volts to the arduino
      1x NRF24L01+
      1x Funduino analog water sensor
      2x Dallas temp sensor
      2x 1 M Ohm resistors for battery level
      1x resistor for Dallas sensor

      code:

      #define MY_RADIO_NRF24
      #define MY_NODE_ID 8
      
      #define CHILD_ID_TEMPWATER 0
      #define CHILD_ID_TEMPAIR 1
      
      #define ONE_WIRE_BUS 5
      
      
      #include <MyConfig.h>
      #include <MySensors.h>
      #include <OneWire.h> 
      #include <DallasTemperature.h>
      
      
      OneWire oneWire(5); 
      DallasTemperature sensors(&oneWire);
      
      
      MyMessage msgTEMPWATER(CHILD_ID_TEMPWATER, V_TEMP);
      MyMessage msgTEMPAIR(CHILD_ID_TEMPAIR, V_TEMP);
      // Gen Vars:
      static int powerPin = 2;
      static int batteryPin = A1;
      static int batteryVoltage = 8.78;
      double currentVoltage =0;
      
      // A1 read should be 5v 1024, so the  reading should be 4.39 so 1024 / 5v is 0.0048828125 v per step
      double voltageStep = (batteryVoltage/2.0)/1023;
      int batteryPcnt =0;
      
      // WaterHeight Vars:
      static int waterHeigthPin = A0; 
      int waterHeigthVal = 0;
      int prevWaterHeightVal =0;
      
      // Temp Vars:
      float waterTemp=0;
      float outsideTemp=0;
      int tempProbes =0;
      
      //voltage
      
      #define NUM_SAMPLES 10
      
      
      void setup() {
      Serial.println(" Welcome" );
      Serial.print("Voltage Step");
      Serial.println(voltageStep,8);
      }
      
      void presentation()
      {
      // Send the sketch version information to the gateway
      Serial.println("Presentation SensorNode Vijver");
       sendSketchInfo("vijver", "0.5");
       present(CHILD_ID_TEMPAIR, S_TEMP);
        delay(500);
       present(CHILD_ID_TEMPWATER, S_TEMP);  
       
       Serial.println("## Presentation Done # ");
       delay(1000);
      }
      void measurewater() {
       waterHeigthVal = analogRead(waterHeigthPin);     // read the input pin
       Serial.print("##WaterHeight Value: ");
       Serial.println(waterHeigthVal);      
      }
      
      void taketemp(){
      
           Serial.println( "## Talking to Dallas Sensor:, discarding first reading");
           sensors.requestTemperatures(); // Send the command to get temperature readings 
           delay(750);
           waterTemp=sensors.getTempCByIndex(1);
           outsideTemp=sensors.getTempCByIndex(0);
           
           tempProbes =tempProbes +1;   
           while (((waterTemp < -20 || waterTemp > 70) || (outsideTemp < -20 || outsideTemp > 70)) && tempProbes <5) {
             Serial.print( "## Error received water:");
             Serial.print( waterTemp);
             Serial.print(" outside:");
             Serial.println(outsideTemp);
             delay(1250);
             sensors.requestTemperatures(); // Send the command to get temperature readings 
             waterTemp=sensors.getTempCByIndex(0);
             outsideTemp=sensors.getTempCByIndex(1);
             tempProbes =tempProbes +1; 
           }
           Serial.print( "## WaterTemp:");
           Serial.print( waterTemp);
           Serial.print( "C, "); 
           Serial.print( "outside: ");
           Serial.print( outsideTemp);
           Serial.print( ",Probes needed:");
           Serial.println(tempProbes);     
           tempProbes = 0; 
      }
      void batterycheck() {
       
       currentVoltage = ((analogRead(batteryPin)*voltageStep))*2;     // read the input pin
       currentVoltage = ((analogRead(batteryPin)*voltageStep))*2; 
       Serial.print("##Battery Value: ");
       Serial.print(currentVoltage);
       Serial.println("Volt");
       batteryPcnt=((currentVoltage/batteryVoltage)*100);
       
      }
      void loop() {
      // power up the sensors:
      digitalWrite(powerPin, HIGH);
      delay (1000);
       measurewater();
       taketemp();
       batterycheck();
       delay (1000);
       // send values;
        send(msgTEMPWATER.set(waterTemp,2));
          delay(500);
        send(msgTEMPAIR.set(outsideTemp,2));
           delay(1000);
        sendBatteryLevel(batteryPcnt);
      digitalWrite(powerPin, LOW);
       
       sleep((30*60000));
      }
      
      
      posted in Troubleshooting
      Richard van der Plas
      Richard van der Plas
    • RE: New Sensor node doesn't show up in HA

      damn i think i found the issue, the presentation uses V_TRIPPED, that should be S_MOTION or S_DOOR, gonna try that tommorrow
      update 21-11, it indeed was the V_TRIPPED vs S_DOOR.

      posted in Home Assistant
      Richard van der Plas
      Richard van der Plas
    • New Sensor node doesn't show up in HA

      I just created a new sensornode with 4 sensors talking through NRF24
      snippet of the arduino code:

      // MySensors - Version: 2.0.0
      #define MY_REPEATER_FEATURE
      #define MY_DEBUG
      #define MY_RADIO_NRF24
      #define MY_RF24_PA_LEVEL RF24_PA_HIGH
      #define MY_NODE_ID 6
      #define CHILD_ID_DOORBELL 0
      #define CHILD_ID_POWER1 1
      #define CHILD_ID_POWER2 2
      #define CHILD_ID_DOOR1 3
      #include <MyConfig.h>
      #include <MySensors.h>
      #include <Bounce2.h>
      MyMessage msgDOORBELL(CHILD_ID_DOORBELL, V_TRIPPED);
      MyMessage msgDOOR1(CHILD_ID_DOOR1, V_TRIPPED);
      MyMessage msgPOWER1(CHILD_ID_POWER1, V_KWH);
      MyMessage msgPOWER2(CHILD_ID_POWER2, V_WATT);
      //cut unrelated code
      void presentation()
      {
        // Send the sketch version information to the gateway
        Serial.println("Presentation Meterkast 2.1");
        sendSketchInfo("Meterkast", "2.1");
        delay(500);
        present(CHILD_ID_DOORBELL, V_TRIPPED);
        delay(500);
        present(CHILD_ID_DOOR1, V_TRIPPED);
        delay(500);
        present(CHILD_ID_POWER1, S_POWER);
        delay(500);
        present(CHILD_ID_POWER2, S_POWER);
        delay(500);
        // present(CHILD_ID_DOOR1, S_DOOR);
        //  delay(500);
        Serial.println("## Presentation Done # ");
        delay(1000);
      }
      
      

      The serial debug shows all commands are received by the gateway, and the gateway responds correctly
      the mysensors gateway debug shows:

      TSF:MSG:SEND,0-0-4-6,s=255,c=3,t=6,pt=0,l=1,sg=0,ft=0,st=OK:M
      TSF:MSG:READ,6-4-0,s=255,c=3,t=11,pt=0,l=9,sg=0:Meterkast
      TSF:MSG:READ,6-4-0,s=255,c=3,t=12,pt=0,l=3,sg=0:2.1
      TSF:MSG:READ,6-4-0,s=0,c=0,t=16,pt=0,l=0,sg=0:
      TSF:MSG:READ,6-4-0,s=3,c=0,t=16,pt=0,l=0,sg=0:
      TSF:MSG:READ,6-4-0,s=1,c=0,t=13,pt=0,l=0,sg=0:
      TSF:MSG:READ,6-4-0,s=2,c=0,t=13,pt=0,l=0,sg=0:
      TSF:MSG:READ,6-4-0,s=255,c=3,t=26,pt=1,l=1,sg=0:2
      TSF:MSG:SEND,0-0-4-6,s=255,c=3,t=27,pt=1,l=1,sg=0,ft=0,st=OK:1
      TSF:MSG:READ,6-4-0,s=0,c=1,t=16,pt=2,l=2,sg=0:0
      TSF:MSG:READ,6-4-0,s=3,c=1,t=16,pt=2,l=2,sg=0:0
      TSF:MSG:READ,6-4-0,s=0,c=1,t=16,pt=2,l=2,sg=0:0
      

      and the home assistant behaves as expected in the log showing:

      child_id 0 already exists in children of node 6, cannot add child
      child_id 1 already exists in children of node 6, cannot add child
      child_id 2 already exists in children of node 6, cannot add child
      child_id 3 already exists in children of node 6, cannot add child
      

      But they don't show up in the main screen or the dev console ?

      posted in Home Assistant
      Richard van der Plas
      Richard van der Plas
    • RE: mysensors.json file structure

      @maghac problem is my limited editor / shell on chrome os makes it a tediuos job on selecting the line 😞
      can you paste the formatted data back to the file? (with enters etc?). i thought the first round mysensors edits the file its a flat file again ?.

      posted in Home Assistant
      Richard van der Plas
      Richard van der Plas
    • RE: mysensors.json file structure

      0_1510689870829_Screenshot 2017-11-14 at 21.04.08.png
      thats all i see, only the 1st node

      posted in Home Assistant
      Richard van der Plas
      Richard van der Plas
    • RE: mysensors.json file structure

      @archiijs yes, problem is im working on a chromebook, thus the commands to select and copy a file in nano doesn't work, so i have to shift cursor to the end of the line 🙂

      posted in Home Assistant
      Richard van der Plas
      Richard van der Plas
    • mysensors.json file structure

      When creating new nodes, the mysensos.json file is updated, but sometimes i need to edit the json file,
      the structure is clear but the file is one line with all the nodes, sensors in one line.
      I find it personally difficult to edit this file.
      Isn't it possible to structure the file with newlines idents etc ?
      You can do it manually, but i assume when a new node is added the structure is gone again.

      posted in Home Assistant
      Richard van der Plas
      Richard van der Plas
    • RE: Home assistant triggers a mysensor light, nothing happens

      @martinhjelmare changed the antennas again for another design, and send the level to max, and today it seems to be stable.
      Proof is in the pudding, he needs to control my aqarium lights twice a day. that's the one thats missing.
      al my sensors are power with power regulators, so that should be good.
      if the issue is persisent, i will try further.

      posted in Troubleshooting
      Richard van der Plas
      Richard van der Plas
    • RE: Home assistant triggers a mysensor light, nothing happens

      Ok checked everything, added capacitors to my radio's and even a small antenna as told in: https://hackaday.com/2015/08/15/hacking-a-nrf24l01-radio-for-longer-range/
      but the range seems to be the issue, the sensors who are 3-4 meters distance of the device work, but one 7 meters & 2 walls away have no connection.
      Looking up some info on the wireless modules they should work 30+ meters, so im completely confused
      It really seems to be a distance issue, moved the pi gateway to the same floor as the sensors are on, and the number of nacks reduces big time.
      But i still havent find a way to let MySensors gateway set a retry numer (as well as the sensors).

      posted in Troubleshooting
      Richard van der Plas
      Richard van der Plas
    • RE: Home assistant triggers a mysensor light, nothing happens

      some add-on
      finally able to split my log files this one keeps popping up every few seconds, could that be interfering with other messages ?

      Nov  3 14:48:07 raspberrypi mysgw: Client 0: 0;255;3;0;2;
      Nov  3 14:48:17 raspberrypi mysgw: Client 0: 0;255;3;0;2;
      Nov  3 14:48:27 raspberrypi mysgw: Client 0: 0;255;3;0;2;
      Nov  3 14:48:37 raspberrypi mysgw: Client 0: 0;255;3;0;2;
      Nov  3 14:48:47 raspberrypi mysgw: Client 0: 0;255;3;0;2;
      Nov  3 14:48:57 raspberrypi mysgw: Client 0: 0;255;3;0;2;
      Nov  3 14:49:07 raspberrypi mysgw: Client 0: 0;255;3;0;2;
      Nov  3 14:49:17 raspberrypi mysgw: Client 0: 0;255;3;0;2;
      Nov  3 14:49:27 raspberrypi mysgw: Client 0: 0;255;3;0;2;
      Nov  3 14:49:37 raspberrypi mysgw: Client 0: 0;255;3;0;2;
      Nov  3 14:49:47 raspberrypi mysgw: Client 0: 0;255;3;0;2;
      Nov  3 14:49:57 raspberrypi mysgw: Client 0: 0;255;3;0;2;
      
      posted in Troubleshooting
      Richard van der Plas
      Richard van der Plas
    • Home assistant triggers a mysensor light, nothing happens

      I have my aquarium lights connected through NRF24L01+ to my Ethernet Pi gateway which is also running Home assistant.
      Homeassistant starts an automation (which is shown in the log).
      the trigger starts @ 18:06
      This occasionally happens, also with other sensors (motion activated).
      How can i troubleshoot further ?
      Looks like something with the radio, but it's only with the automations, when i manually flick the switch it just goes
      Is there someway you can force the gateway to retry ?

      Mysensors log:

      mysgw: Client 0: 4;2;1;0;2;1
      mysgw: !TSF:MSG:SEND,0-0-4-4,s=2,c=1,t=2,pt=0,l=1,sg=0,ft=0,st=NACK:1
      mysgw: Client 0: 4;2;1;0;3;4
      mysgw: !TSF:MSG:SEND,0-0-4-4,s=2,c=1,t=3,pt=0,l=1,sg=0,ft=0,st=NACK:4
      mysgw: Client 0: 0;255;3;0;2;
      mysgw: Client 0: 4;1;1;0;2;0
      mysgw: !TSF:MSG:SEND,0-0-4-4,s=1,c=1,t=2,pt=0,l=1,sg=0,ft=0,st=NACK:0
      mysgw: Client 0: 0;255;3;0;2;
      mysgw: TSF:MSG:READ,4-4-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
      mysgw: TSF:MSG:BC
      mysgw: TSF:MSG:FPAR REQ,ID=4
      mysgw: TSF:PNG:SEND,TO=0
      mysgw: TSF:CKU:OK
      mysgw: TSF:MSG:GWL OK
      mysgw: TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
      mysgw: Client 0: 0;255;3;0;2;
      mysgw: Client 0: 0;255;3;0;2;
      mysgw: Client 0: 0;255;3;0;2;
      mysgw: TSF:MSG:READ,4-4-255,s=255,c=3,t=7,pt=0,l=0,sg=0:
      mysgw: TSF:MSG:BC
      mysgw: TSF:MSG:FPAR REQ,ID=4
      mysgw: TSF:PNG:SEND,TO=0
      mysgw: TSF:CKU:OK
      mysgw: TSF:MSG:GWL OK
      mysgw: TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=8,pt=1,l=1,sg=0,ft=0,st=OK:0
      mysgw: TSF:MSG:READ,4-4-0,s=255,c=3,t=24,pt=1,l=1,sg=0:1
      mysgw: TSF:MSG:PINGED,ID=4,HP=1
      mysgw: TSF:MSG:SEND,0-0-4-4,s=255,c=3,t=25,pt=1,l=1,sg=0,ft=0,st=OK:1
      mysgw: Client 0: 0;255;3;0;2;
      mysgw: Client 0: 0;255;3;0;2;
      mysgw: Client 0: 0;255;3;0;2;
      mysgw: Client 0: 0;255;3;0;2;
      mysgw: TSF:MSG:READ,4-4-0,s=0,c=1,t=0,pt=7,l=5,sg=0:24.25
      mysgw: Client 0: 0;255;3;0;2;
      mysgw: Client 0: 0;255;3;0;2;
      mysgw: Client 0: 0;255;3;0;2;
      mysgw: Client 0: 0;255;3;0;2;
      mysgw: Client 0: 0;255;3;0;2;
      mysgw: Client 0: 0;255;3;0;2;
      mysgw: Client 0: 0;255;3;0;2;
      mysgw: TSF:SRT:OK
      mysgw: TSF:SAN:OK
      mysgw: Client 0: 0;255;3;0;2;
      mysgw: Client 0: 0;255;3;0;2;
      mysgw: Client 0: 0;255;3;0;2;
      mysgw: TSF:MSG:READ,3-4-0,s=2,c=1,t=1,pt=7,l=5,sg=0:54.0
      
      

      Home assistant log of the trigger

      hass[1366]: #033[32m2017-11-02 17:08:42 INFO (MainThread) [homeassistant.helpers.script] Script aqua_to_night: Running script#033[0m
      hass[1366]: #033[32m2017-11-02 17:08:42 INFO (MainThread) [homeassistant.helpers.script] Script aqua_to_night: Executing step call service#033[0m
      hass[1366]: #033[32m2017-11-02 17:08:42 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: service_data=entity_id=light.aquarium_4_2, brightness=10, domain=light, service=turn_on, service_call_id=1970958224-421>#033[0m
      hass[1366]: #033[32m2017-11-02 17:08:42 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: new_state=<state automation.aquarium_night_light_on_auto=on; id=Aqua Verlichting nacht Auto, friendly_name=Aquarium Night Light On Auto, last_triggered=2017-11-02T18:08:42.394140+01:00 @ 2017-10-29T22:18:42.206057+01:00>, entity_id=automation.aquarium_night_light_on_auto, old_state=<state automation.aquarium_night_light_on_auto=on; id=Aqua Verlichting nacht Auto, friendly_name=Aquarium Night Light On Auto, last_triggered=2017-11-01T18:10:35.996885+01:00 @ 2017-10-29T22:18:42.206057+01:00>>#033[0m
      hass[1366]: #033[32m2017-11-02 17:08:42 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=1970958224-421>#033[0m
      hass[1366]: #033[32m2017-11-02 17:08:42 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=1970958224-420>#033[0m
      hass[1366]: #033[32m2017-11-02 17:08:42 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: new_state=<state script.aqua_to_night=on; can_cancel=True, friendly_name=aqua_to_night, last_triggered=2017-11-02T18:08:42.378463+01:00, last_action=call service @ 2017-11-02T18:08:42.436591+01:00>, entity_id=script.aqua_to_night, old_state=<state script.aqua_to_night=off; can_cancel=True, friendly_name=aqua_to_night, last_triggered=2017-11-01T18:10:42.955284+01:00 @ 2017-11-
      02T07:38:32.985038+01:00>>#033[0m
      hass[1366]: #033[32m2017-11-02 17:08:45 INFO (MainThread) [homeassistant.components.http] Serving /api/12345678901234567890/lights to 192.168.1.113 (auth: False)#033[0m
      hass[1366]: #033[32m2017-11-02 17:08:49 INFO (MainThread) [homeassistant.helpers.script] Script aqua_to_night: Executing step call service#033[0m
      hass[1366]: #033[32m2017-11-02 17:08:49 INFO (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: service_data=entity_id=light.aquarium_4_1, domain=light, service=turn_off, service_call_id=1970958224-422>#033[0m
      hass[1366]: #033[32m2017-11-02 17:08:49 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]: service_call_id=1970958224-422>#033[0m
      hass[1366]: #033[32m2017-11-02 17:08:49 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: new_state=<state script.aqua_to_night=off; can_cancel=True, friendly_name=aqua_to_night, last_triggered=2017-11-02T18:08:49.352941+01:00 @ 2017-11-02T18:08:49.370529+01:00>, entity_id=script.aqua_to_night, old_state=<state script.aqua_to_night=on; can_cancel=True, friendly_name=aqua_to_night, last_triggered=2017-11-02T18:08:42.378463+01:00, last_action=call service @ 2017-11-02T18:08:42.436591+01:00>>#033[0m
      hass[1366]: #033[32m2017-11-02 17:08:49 INFO (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: new_state=<state group.all_scripts=off; entity_id=('script.aqua_to_day', 'script.aqua_to_night', 'script.choose_tuner_slamfm', 'script.onkyo_off', 'script.onkyo_on', 'script.police_lights', 'script.tuner_slamfm', 'script.tuner_sublime'), friendly_name=all scripts, auto=True, hidden=True, assumed_state=False, order=6 @ 2017-11-02T18:08:42.443423+01:00>>#033[0m
      hass[1366]: #033[32m2017-11-02 17:08:55 INFO (MainThread) ```
      posted in Troubleshooting
      Richard van der Plas
      Richard van der Plas
    • RE: 💬 Building a Raspberry Pi Gateway

      @gohan Hi there updated to the latest dev, but i still have to restart the service after a few days, this is the message in the log:

      Sep 17 20:31:51 raspberrypi hass[17999]: #033[32m2017-09-17 20:31:51 INFO (Thread-13) [mysensors.gateway_tcp] Closing socket at ('192.168.1.115', 5003).#033[0m
      Sep 17 20:31:51 raspberrypi hass[17999]: #033[32m2017-09-17 20:31:51 INFO (Thread-13) [mysensors.gateway_tcp] Socket closed at ('192.168.1.115', 5003).#033[0m
      Sep 17 20:31:51 raspberrypi hass[17999]: #033[32m2017-09-17 20:31:51 INFO (Thread-13) [mysensors.gateway_tcp] No response. Disconnected.#033[0m
      Sep 17 20:31:51 raspberrypi hass[17999]: #033[32m2017-09-17 20:31:51 INFO (Thread-13) [mysensors.gateway_tcp] Trying to connect to ('192.168.1.115', 5003)#033[0m
      

      checking with top, i see high CPU utilization:

      20921 root      20   0   20036    872    784 R  CPU ->99,5  0,1 682:53.59 mysgw
      
      
      posted in Announcements
      Richard van der Plas
      Richard van der Plas
    • RE: 💬 Building a Raspberry Pi Gateway

      @gohan fatal: destination path 'MySensors' already exists and is not an empty directory. It goes wrong with the first command, could you please give me some pointers ?

      posted in Announcements
      Richard van der Plas
      Richard van der Plas
    • RE: 💬 Building a Raspberry Pi Gateway

      @gohan just checked it's 2.1.1, is it easy to upgrade?

      posted in Announcements
      Richard van der Plas
      Richard van der Plas
    • RE: 💬 Building a Raspberry Pi Gateway

      @gohan the latest stable version i guess. Where can i check?

      posted in Announcements
      Richard van der Plas
      Richard van der Plas
    • RE: 💬 Building a Raspberry Pi Gateway

      Looks as if it happened after updating Home Assistant, but that should be 2 different things right ?

      posted in Announcements
      Richard van der Plas
      Richard van der Plas
    • RE: 💬 Building a Raspberry Pi Gateway

      hi there, somehow my gateway seems to stop receiving data after a day or so from my sensors,
      restarting the service seems to solve it for a time, how can i troubleshoot this issue ?

      posted in Announcements
      Richard van der Plas
      Richard van der Plas
    • RE: Buy big amount of Arduino nano with FTDI

      ive good good experience with the BAITE online store, fast shipping and offering a price by 10

      posted in Hardware
      Richard van der Plas
      Richard van der Plas
    • RE: Sleep issue

      @Yveaux Ok went to 2.0 and that indeed works

      posted in Troubleshooting
      Richard van der Plas
      Richard van der Plas
    • RE: Sleep issue

      @Yveaux damn is there any other way to fix it besides the 2.2?

      posted in Troubleshooting
      Richard van der Plas
      Richard van der Plas
    • RE: Sleep issue

      @Yveaux i dont think i can do that in the online arduino create environment.....

      posted in Troubleshooting
      Richard van der Plas
      Richard van der Plas
    • Sleep issue

      Having code with a door sensor and a light.
      Because i want to save battery time, ive incoporated a sleep mode.
      the sleep mode is called after the door is closed, and will wake up again after a change or time ( to measure temperature).
      Sleep mode must not be called when the door is open because of the light which should go out after a radio message from the Gateway.

      snippet of code:, the 2,5 seconds delay is to make sure the door doesnt open again.

      if (gotoSleep == 1) {
           Serial.print("--==## Door closed, Going to Sleep ");
           Serial.println(SLEEP_TIME);
           delay(2500);
           sleep(digitalPinToInterrupt(DOOR_SWITCH), FALLING, SLEEP_TIME);
           gotoSleep =0;
         }
      

      log file shows this:

      --==##Door Trigger1
      14061 TSF:MSG:SEND,5-5-0-0,s=0,c=1,t=16,pt=1,l=1,sg=0,ft=0,st=OK:1
      --## Running  Loop
      --==##Door Trigger0
      16822 TSF:MSG:SEND,5-5-0-0,s=0,c=1,t=16,pt=1,l=1,sg=0,ft=0,st=OK:0
      --==## Door closed, Going to Sleep 
      19329 MCO:SLP:MS=300000,SMS=0,I1=0,M1=2,I2=255,M2=255
      19333 MCO:SLP:TPD
      19385 MCO:SLP:WUP=0
      

      That is so weird, why does it wake again on interrupt (as told by log parser)
      CHANGE or FALLING doesn t matter

      posted in Troubleshooting
      Richard van der Plas
      Richard van der Plas
    • RE: New CHILD ID after reprogramming

      @gohan said in New CHILD ID after reprogramming:

      #define MY_NODE_ID 5

      aha MY_NODE_ID, instead of CHILD_ID 👍

      posted in Troubleshooting
      Richard van der Plas
      Richard van der Plas
    • RE: New CHILD ID after reprogramming

      No i did not :

      //define MY_DEBUG
      #define MY_RADIO_NRF24
      #include <MySensors.h>
      #include <OneWire.h> 
      #include <DallasTemperature.h>
      #define ONE_WIRE_BUS 8
      
      OneWire oneWire(ONE_WIRE_BUS); 
      DallasTemperature sensors(&oneWire);
      #define CHILD_ID 5
      #define CHILD_ID_PIR1 0
      #define CHILD_ID_DOOR1 1
      #define CHILD_ID_TEMP1 2
      
      #define DOOR_SWITCH 3
      #define PIR_INSIDE 2
      
      MyMessage msgPIR1(CHILD_ID_PIR1, V_TRIPPED);
      MyMessage msgDOOR1(CHILD_ID_DOOR1, V_TRIPPED);
      MyMessage msgTEMP1(CHILD_ID_TEMP1, V_TEMP);
      // temp ```
      posted in Troubleshooting
      Richard van der Plas
      Richard van der Plas
    • New CHILD ID after reprogramming

      How can i keep from mixing the CHILD id every time of my sensor node?
      i defined

      #define CHILD_ID 5
      #define CHILD_ID_PIR1 0
      #define CHILD_ID_DOOR1 1
      #define CHILD_ID_TEMP1 2
      

      But the Serial debug shows:

      4 TSF:WUR:MS=0
      11 TSM:INIT:TSP OK
      13 TSF:SID:OK,ID=7
      14 TSM:FPAR
      

      Thus having a sensor node where i tell them to be 5 and it is 7 ?

      posted in Troubleshooting
      Richard van der Plas
      Richard van der Plas
    • RE: 💬 Building a Raspberry Pi Gateway

      NM, used GPIO numbers instead of Pin numbers RTFM 🙂

      posted in Announcements
      Richard van der Plas
      Richard van der Plas
    • RE: 💬 Building a Raspberry Pi Gateway

      Damn, just connected as in manual, but gives an error : mysgw: !TSM:INIT:TSP FAIL
      Double checked the GPIO pins (except 15 cannot find that one) but seems ok

      posted in Announcements
      Richard van der Plas
      Richard van der Plas
    • RE: 💬 Building a Raspberry Pi Gateway

      Ok, i am standig on a crossroad it seems, i have to build a new gateway but i am also interested in the MQTT option, this is between mysensors & HomeASSistant i presume? i have some ESP's lying around unused, but i have 0 knowledge of mqtt (i dont think my hass has it running by default)

      posted in Announcements
      Richard van der Plas
      Richard van der Plas
    • RE: 💬 Building a Raspberry Pi Gateway

      excellent, will the cpu utilisation be much higher that with a usb connected gw ?

      posted in Announcements
      Richard van der Plas
      Richard van der Plas
    • RE: 💬 Building a Raspberry Pi Gateway

      so i can attach the NRF24L01+ to the pi running HA, make it a Ethernet Gateway and point to his own ip adress ?, will this be a long job with converting from a USB connected GW (Arduino with local sensors ? )

      posted in Announcements
      Richard van der Plas
      Richard van der Plas
    • RE: 💬 Building a Raspberry Pi Gateway

      How will this work with HASS running on the same pi ?

      posted in Announcements
      Richard van der Plas
      Richard van der Plas
    • RE: MySensors Gatway dimmers & Home assistant

      @martinhjelmare Thanks for the input, when i arrive home ill update my code 🙂

      posted in Hardware
      Richard van der Plas
      Richard van der Plas
    • RE: MySensors Gatway dimmers & Home assistant

      I understand your statement, but that's where it went wrong,
      The hass also sends lights on when changing the dim value so it first goes to 100 ?
      other question
      Any idea how i can change the delta of 1 & -1 of 100% to 1 & -1 of 255 steps the arduino can cope ?

      posted in Hardware
      Richard van der Plas
      Richard van der Plas
    • RE: MySensors Gatway dimmers & Home assistant

      @martinhjelmare indeed that doesn't work anymore, i have to turn on the light with the slider.
      But because its alwas an automation that turns on the light, that isnt such a big problem. i m trying to keep the code as small ass possible, because i have to add a dallas temperature controller to it, and its already complaining about low storage 😞

      Sketch uses 10020 bytes (69%) of program storage space. Maximum is 14336 bytes.
      Global variables use 850 bytes (83%) of dynamic memory, leaving 174 bytes for local variables. Maximum is 1024 bytes.
      

      In your code i also see this line:

      if (( lightState == 1 ) && ( currentWhiteLevel == 0 )) {
           requestedLevel = 100;
         } else {
           requestedLevel = lightState > 0 ? currentWhiteLevel : 0;
         }
      

      what does that do when light is on & level is 0 turn it to 100% else ???

      posted in Hardware
      Richard van der Plas
      Richard van der Plas
    • RE: MySensors Gatway dimmers & Home assistant

      i have fixed it like this :

      void receive(const MyMessage &message)
      {
          if ((message.type == V_LIGHT)) {
      
              // V_LIGHT command received, only do something when 0
              
              int requestedLevel = atoi( message.data );
      
      
              if (requestedLevel ==0 && message.sensor == 1) {fadeWhiteToLevel( requestedLevel );}
              if (requestedLevel ==0 && message.sensor == 2) {fadeBlueToLevel( requestedLevel );}
      
      
          }
          
      if ((message.type == V_DIMMER) ) {
      
              //  Retrieve the dim level from the incoming request message
              int requestedLevel = atoi( message.data );
      
              // Clip incoming level to valid range of 0 to 100
              requestedLevel = requestedLevel > 100 ? 100 : requestedLevel;
              requestedLevel = requestedLevel < 0   ? 0   : requestedLevel;
              if (message.sensor == 1) {fadeWhiteToLevel( requestedLevel );}
              if (message.sensor == 2) {fadeBlueToLevel( requestedLevel );}
      
              fadeBlueToLevel( requestedLevel );
      
          }
      
      posted in Hardware
      Richard van der Plas
      Richard van der Plas
    • RE: MySensors Gatway dimmers & Home assistant

      @martinhjelmare ok ill wait,
      meanwhile splitted the Message.type== V_LIGHT & == V_DIMMER into 2 different ifs.
      created a quick serial.println on the vlight, and see in my HASS that indeed changing the dim level on the led when off , triggers a v_light and turns it to 100%
      -Update indeed when removing the V_LIGHT message type behaviour is okay, but im unable to turn off the light

      • Following code is now testing:
      if ((message.type == V_LIGHT) && message.sensor==1) {
              int requestedLevel = atoi( message.data );
             Serial.print("message:"); 
             Serial.println(requestedLevel);
             Serial.print("VLIGHT DETECTET set to:"); 
             requestedLevel *= ( message.type == V_LIGHT ? 100 : 1 );
             Serial.println(requestedLevel);
             if (requestedLevel <1) {fadeWhiteToLevel( requestedLevel );}
          }
      

      Behaviour is better now
      only issue i now have is the 255 values of arduino to the 100 of HASS ,

      posted in Hardware
      Richard van der Plas
      Richard van der Plas
    • RE: MySensors Gatway dimmers & Home assistant

      @martinhjelmare How can i fix that, read your story twice, know what you mean, but don know the solution 🙂
      i think i need to split
      ((message.type == V_LIGHT || message.type == V_DIMMER) && message.sensor==2)
      is that correct ?

      posted in Hardware
      Richard van der Plas
      Richard van der Plas
    • RE: MySensors Gatway dimmers & Home assistant

      @enlo i wil try that.

      posted in Hardware
      Richard van der Plas
      Richard van der Plas
    • RE: MySensors Gatway dimmers & Home assistant

      @pansen yes the USB is connectec to my Raspberry pi which is running Home Assistant.
      over the USB connection the Mysensors messages are done .
      So when the Home assistant is running i have no access to the serial console.
      I Can serial print some things which will show up in the HASS log files as incorrect messages but thats not instant feedback

      posted in Hardware
      Richard van der Plas
      Richard van der Plas
    • RE: MySensors Gatway dimmers & Home assistant

      @pansen cannot use that because hass communicates over the serial port 😞

      posted in Hardware
      Richard van der Plas
      Richard van der Plas
    • RE: MySensors Gatway dimmers & Home assistant

      the whiteLed is used in my button part
      full code

        #include <MySensors.h>
      // Set blinking period
      //?#define MY_DEFAULT_LED_BLINK_PERIOD 300
      
      // Inverses the behavior of leds
      //#define MY_WITH_LEDS_BLINKING_INVERSE
      
      #define CHILD_ID_TEMP 0
      #define CHILD_ID_LIGHT_WHITE 1
      #define CHILD_ID_LIGHT_BLUE 2
      #define CHILD_ID_SWITCH_WHITE 3
      #define CHILD_ID_SWITCH_BLUE 4
      
      MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP); // 0
      MyMessage dimmerMsgWhite(CHILD_ID_LIGHT_WHITE, V_DIMMER);
      MyMessage lightMsgWhite(CHILD_ID_LIGHT_WHITE, V_LIGHT);
      MyMessage dimmerMsgBlue(CHILD_ID_LIGHT_BLUE, V_DIMMER);
      MyMessage lightMsgBlue(CHILD_ID_LIGHT_BLUE, V_LIGHT);
      MyMessage switchMsgWhite(CHILD_ID_SWITCH_WHITE, S_BINARY);
      MyMessage switchMsgBlue(CHILD_ID_SWITCH_BLUE, S_BINARY);
      // Dimmer variables
      static int16_t currentWhiteLevel = 0;
      static int16_t currentBlueLevel =0;
      #define LED_WHITE 6
      #define LED_BLUE 5
      #define FADE_DELAY 70
      #define BUZZER 9
      #define whiteButton 7
      #define blueButton 8
      
      //Aqua Temp variables
      int tempPin = A5;    
      int samples = 100; 
      int sampletime = 25;
      int tempReading;
      float allSamples=0;
      unsigned long probeTime = 0;
      const long aqua_interval = (5 * 60000);
      // Button variables
      boolean blueButtonState =0;
      boolean whiteButtonState=0;
      boolean lastBlueButtonState=0;
      boolean lastWhiteButtonState=0;
      int whiteLed=0;
      int blueLed=0;
      void setup()
      {
          // Setup locally attached sensors
           #define aref_voltage 3.3; 
          // If you want to set the aref to something other than 5v
          analogReference(INTERNAL);
          // read to stabalize aref thingy
           float voltage = analogRead(tempPin) * 1.1;
           delay(500);
          // request( CHILD_ID_LIGHT_WHITE, V_DIMMER );
          // send(lightMsgWhite.set(currentLevel > 0 ? 1 : 0));
          // send(dimmerMsgWhite.set(currentLevel));
          // request( CHILD_ID_LIGHT_BLUE, V_DIMMER );
          // send(lightMsgBlue.set(currentLevel > 0 ? 1 : 0));
          // send(dimmerMsgBlue.set(currentLevel));
           pinMode(whiteButton, INPUT);
           pinMode(blueButton, INPUT);
      
           // tell HASS that everything is off after reset:
           send(lightMsgBlue.set(0) );
      
           send(lightMsgWhite.set(0));
      }
      
      void presentation()
      {
        sendSketchInfo("Aquarium", "1.4");
        present(CHILD_ID_TEMP, S_TEMP); 
        present(CHILD_ID_LIGHT_WHITE, S_DIMMER );
        present(CHILD_ID_LIGHT_BLUE, S_DIMMER );
      
      
          // Present locally attached sensors
      }
      
      
      
      
      
      void loop()
      {
        delay(50);
        // check Button Press
        checkButtonClick();
          // Send locally attached sensor data here
      }
      
      void receive(const MyMessage &message)
      {
          if ((message.type == V_LIGHT || message.type == V_DIMMER) && message.sensor==1) {
              int requestedLevel = atoi( message.data );
              requestedLevel *= ( message.type == V_LIGHT ? 100 : 1 );
              requestedLevel = requestedLevel > 100 ? 100 : requestedLevel;
              requestedLevel = requestedLevel < 0   ? 0   : requestedLevel;
              whiteLed = requestedLevel;
              fadeWhiteToLevel( requestedLevel );
          }
      if ((message.type == V_LIGHT || message.type == V_DIMMER) && message.sensor==2) {
              int requestedLevel = atoi( message.data );
              requestedLevel *= ( message.type == V_LIGHT ? 100 : 1 );
              requestedLevel = requestedLevel > 100 ? 100 : requestedLevel;
              requestedLevel = requestedLevel < 0   ? 0   : requestedLevel;
              fadeBlueToLevel( requestedLevel );
          }
      
          
      }
      void fadeWhiteToLevel( int toLevel )
      {
          int delta = ( toLevel - currentWhiteLevel ) < 0 ? -1 : 1;
          while ( currentWhiteLevel != toLevel ) {
              currentWhiteLevel += delta;
              analogWrite( LED_WHITE, (int)(currentWhiteLevel / 100. * 255) );
              delay( FADE_DELAY );
          }
         send(lightMsgWhite.set(currentWhiteLevel > 0));
         send(dimmerMsgWhite.set(currentWhiteLevel) );
         whiteLed= currentWhiteLevel;
      }
      
      void fadeBlueToLevel( int toLevel )
      {
          int delta = ( toLevel - currentBlueLevel ) < 0 ? -1 : 1;
          while ( currentBlueLevel != toLevel ) {
              currentBlueLevel += delta;
              analogWrite( LED_BLUE, (int)(currentBlueLevel / 100. * 255) );
              delay( FADE_DELAY );
          }
          send(lightMsgBlue.set(currentBlueLevel > 0));
          send(dimmerMsgBlue.set(currentBlueLevel) );
          blueLed= currentBlueLevel;
      }
      
      
      
      void checkButtonClick()
      {
        // read buttons
        blueButtonState = digitalRead(whiteButton);
        whiteButtonState = digitalRead(blueButton);
       
        delay(25);
        
        if (blueButtonState != lastBlueButtonState && blueButtonState==true) {
       // toggle light
        lastBlueButtonState=true;
        if (blueLed > 1) { 
           fadeBlueToLevel( 0 );
          } else  {
            fadeBlueToLevel(100);
            }
        }
      
       
        if (whiteButtonState != lastWhiteButtonState && whiteButtonState==true) {
       // toggle light
        lastWhiteButtonState=true;
            
        if (whiteLed > 1 ) {
              fadeWhiteToLevel( 0 );     
        } else {
            fadeWhiteToLevel(100);
            whiteLed = 100;
        }
        }
       if (blueButtonState != lastBlueButtonState && blueButtonState==false) {
        lastBlueButtonState=false;
        }
       if (whiteButtonState != lastWhiteButtonState && whiteButtonState==false) {
        lastWhiteButtonState=false;
        }
         
      }
          
      
      posted in Hardware
      Richard van der Plas
      Richard van der Plas
    • MySensors Gatway dimmers & Home assistant

      Hi there,
      i am having strange issues with MySensors & Home assistant.
      Whenever i request a light change state in hass, the dimmer first goes to 100% before going to the state i requested.
      I used the example code as on the front page:
      here 's a snippet:

      void receive(const MyMessage &message)
      {
          if ((message.type == V_LIGHT || message.type == V_DIMMER) && message.sensor==1) {
              int requestedLevel = atoi( message.data );
              requestedLevel *= ( message.type == V_LIGHT ? 100 : 1 );
              requestedLevel = requestedLevel > 100 ? 100 : requestedLevel;
              requestedLevel = requestedLevel < 0   ? 0   : requestedLevel;
              whiteLed = requestedLevel;
              fadeWhiteToLevel( requestedLevel )
          }
      
      

      Skip unnecessary 2nd light (behaviour is the same)

      void fadeWhiteToLevel( int toLevel )
      {
      
          int delta = ( toLevel - currentWhiteLevel ) < 0 ? -1 : 1;
      
          while ( currentWhiteLevel != toLevel ) {
              currentWhiteLevel += delta;
              analogWrite( LED_WHITE, (int)(currentWhiteLevel / 100. * 255) );
              delay( FADE_DELAY );
          }
         send(lightMsgWhite.set(currentWhiteLevel > 0));
         send(dimmerMsgWhite.set(currentWhiteLevel) );
         whiteLed= currentWhiteLevel;
      }
      
      posted in Hardware
      Richard van der Plas
      Richard van der Plas