Navigation

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

    Posts made by Sushukka

    • Domoticz V_TEXT sensor now bidirectional

      YEEEEEEESSSSHHH!!! This is now implemented in Domoticz!
      https://github.com/domoticz/domoticz/issues/2380

      You can change the V_TEXT sensor value in Domoticz via JSON, Scripts and Blocky and the update will be sent directly to the node without any hacks!!! This is big update; you can pass lots of information, parameters etc directly to the nodes without extra steps and work-arounds. LCD screen updates, speech-to-text commands, parameter/code driven nodes...now we just need bigger payload size for MySensors... ๐Ÿ˜„

      Edit: Just remember when updating that you may need to change your old sketches + tricks and hacks because you now get the V_TEXT update twice if you have the old hacks active.

      posted in Domoticz
      Sushukka
      Sushukka
    • RE: Domoticz TEXT sensor triggering

      YEEEEEEESSSSHHH!!! This is now implemented in Domoticz!
      https://github.com/domoticz/domoticz/issues/2380

      You can change the V_TEXT sensor value from Domoticz via JSON, Scripts and Blocky and the update will be sent directly to the node without any hacks!!! This is big update; you can pass lots of information, parameters etc directly to the nodes without extra steps. And @alowhum you don't need that poll anymore in the sketch. ๐Ÿ™‚ LCD screen updates, speech-to-text commands...now we just need bigger payload size for MySensors... ๐Ÿ˜„

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: Domoticz TEXT sensor triggering

      Here is the latest update:
      https://github.com/domoticz/domoticz/issues/2380
      At least got some response...do it yourself.
      Darn sad: a good, reliable and widely-used product, but the developers are just pricks or don't give shit. With better attitude this could be so much more and most likely there would be lots of more contributors helping with them.

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: Domoticz TEXT sensor triggering

      @monte I fully agree with this. I have tried to get some explanation to this V_TEXT problem through multiple channels and no one is really answering anything. Either the developers have dumped the whole project or are just nasty dwarfs in a cave. GitHub shows some activity but the project seems to lay very heavily on "gizmocuz" shoulders who probably has a nasty attitude but has also answered to this V_TEXT question 7/2017 not easily implemented -> Best to help with development...so it seems that they are lacking hands...but in other hand, if the attitude is bad there aren't probably many willing to come to help.

      So...same here, I'll continue using Domoticz, but actively seeking a better alternative for it and trying to build as little as possible Domoticz specific stuff.

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: Domoticz TEXT sensor triggering

      @monte True that. Thing is that people like to use the guis instead of configuration files. That's probably the reason why OpenHAB "fastly" evolves in that direction.

      For all the not-so-technical home automation builders I would myself suggest Domoticz as the choise for open source controller. OpenHAB maybe for the ones who buys ready-made stuff from Ikea, zWave etc and just want to control the stuff from one place. But still I'm pretty sure that many of those are not really interested or have required knowledge to start tinkering with OpenHAB. For MySensors users, as you said, it creates lots of additional work for little extra over Domoticz. Domo has this stupid V_TEXT sensor limitation and some people like that the default graphing stuff is limited. However, OpenHAB has nothing without setting up persistence services and their separate databases and definitions...and you can have the praised Influx-Grafana integration also for Domo. My personal opinion is that the normal Domo gui is still pretty useful plus you can have Imperihome, Dashticz type of connections or build your own with Rest API. With OpenHAB you don't have anything usable without manually building it first. I'm myself using Imperihome which basically gives little to complain about gui usability and visual aesthetics. With Domo you install MyDomoAtHome which has all the mappings done so that you can just start playing around with your Imperihome gui. With OpenHAB...
      https://github.com/openhab/openhab2-addons/tree/master/addons/io/org.openhab.io.imperihome
      The tagging part is not a small work to do...and this pretty much underlines the problem with OpenHAB. You can tune everything, but basically spend huge amount of time on doing that...or even getting things to work on basic level. The OpenHAB community seems to be active, but it has to, as there seems to be lots of problems too.

      But not bashing OpenHAB more: I want to like it, but it's just making liking it too hard for now. However, it has Eclipse foundation backing it up and has started evolving to the right direction out of the pure configuration file based setup/tuning. After year or two I believe it's much more user-friendly and more widely used. If not and Domo won't be developed anymore there is always the middleware/MQTT/NodeRed/cloud options to go...

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: Domoticz TEXT sensor triggering

      And update here about V_TEXT and OpenHAB: Yes it works like it should. When I update the V_TEXT sensor in OpenHAB, it will send the update without any extra scripts or hacks to the MySensors node.

      However, after spending several days and nights setting up OpenHAB I have to say that it is far from being ready. MySensors seems not to be qualified yet in the list of "downloadable ready" bindings in PaperUI. Had several errors with MQTT nodes. It is customizable yes, but requires way too much time to set up and maintain. It seems to be more like an architectural masterpiece than easy-to-use home controller.

      You can define nearly everything in PaperUI or HABmin like me (a hell of mouse clicking and scrolling) or define everything in multiple configuration files. When you finally have all the nodes and sensors defined (bindings, things, items), you have to build your own gui to see them in usable format. You can either use HabPanel for dashboards or configuration files for sitemaps. Dashboards, which has the best outlook imo, seems to have a problem of working with different devices. I tried to avoid the manual sitemap building by installing Imperihome binding. Connection ok, but alas, you have to manually tag every damn item you have to show them in Imperihome. With all manual configurations you actually need to define quite much of information and they are nicely connected making bigger future changes complicated. Having now around 100 sensors, all this stuff really takes time. Moreover it seemed that the reliability at least with MySensors Ethernet Gateways (one main for NFR24L01 nodes and several ESP8266s) was not in par with Domoticz. Startup problems, rebooting, lost nodes etc...And this was the last drop --> changed back to Domoticz.

      Have to say that after a couple of years OpenHAB could maybe be the number one open source home automation controller, but it requires lots of more work for getting there. Now it's too much of engineering and configuration porn vs. the real benefits it gives. Also I'm little bit afraid that the they are getting lost to this super elegancy by trying to be everything and pleasing everybody. PaperUI, HABmin, HomeBuilder, HabPanel, Basic UI, Classic UI, some third party UIs, configuration files... The concept is nice, but as with any product, you need to focus somewhere or otherwise you are just semicore in all areas. Domoticz has its problems, but at least it is reliable and allows putting the most of the available tinkering time to the actual node building than tuning the controller.

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: Domoticz TEXT sensor triggering

      @tbowmo Thanks @tbowmo and everybody! This active community has really saved my day so many times. You rule guys and gals! ๐Ÿ‘ ๐Ÿ˜Š
      Here is a working script:

      import paho.mqtt.client as mqttClient
      import sys
      
      irCommand = sys.argv[1]
      print("Parameter is: " + irCommand)
      
      client = mqttClient.Client("Python")  
      client.username_pw_set(username="xxx",password="xxx")
      client.connect("nnn.nnn.nnn.nnn", 1883)
      client.publish('domoticz/out/HomeNum_IR/0/0/1/0/47', irCommand, retain=False)
      # (ESP8266 "gateway" MQTT client -> node=0)
      

      And call it from Domoticz virtual selector switch:

      script:///home/pi/domoticz/scripts/python/hnumber_led_mode.py 7
      

      Parameter is the desired mode for led animation. Made a similar on for IR remote commands.

      Is there same ~25bit payload limit with MQTT too? I mean those NEC IR commands tend to be 32bit so probably cannot send them directly but need to be hardcoded in the sketch? Also planned to create a universal script for these needs where you could give also node number, child ids etc but then again...I chain myself even tighter to Domoticz shackles and again Domoticz should support this without scripting.

      Couple of more questions:

      • If you have several ESP8266 MQTT gateways, should one create a different topic for everyone or put them in the same MySensors queue? If so, will the MY_MQTT_CLIENT_ID make the separation?
      • I installed nodered-contrib-mysensors and it seems very promising. Definitely going to play around with it. I probably still need some actual controller but Node-red seems to be important part whatever you're gonna do especially when using MQTT queues.
      • When using MQTT instead of Ethernet GW, I lose small but very important check: node pinging. I can see from Domoticz log warning messages when some of my ESP8266 Ethernet nodes are down, but when using MQTT there are no warnings, just no data received. I assume this is quite logical because the MQTT node's address in Domoticz is actually broker's (Mosquitto) address + right MQTT topic. However, when sniffing Domoticz MQTT traffic, it seems to send PING messages quite regularly (but don't know if this triggers anything if the ping success or fails...):
      // MQTT topic: domoticz/out/HomeNum_IR/#
      PING
      qos : 0, retain : false, cmd : publish, dup : false, topic : domoticz/out/HomeNum_IR/0/0/3/0/18, messageId : , length : 40
      

      Update: Seems that the Domo has it's own requirements for MQTT queues and for preventing overlapping ESP8266 = GW = Node ID 0 have an option to have also Node ID in the MQTT queue definition. Still would be nice to be able to define the MQTT queue names freely in Domo...

      Also my bad: MySensors payload size is 25 bytes, not bits... This seems to be because of NFR24L01 limitations. However, it would be nice to see an extended payload size for passing eg. longer text information with more advanced microcontrollers like ESP8266 in the future releases. Minor need though.

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: Domoticz TEXT sensor triggering

      @monte I need to move to a next project so before conversion to Node-red and/or OpenHAB, how would you use netcat type of injection with MQTT? I mean now I have MySensors in W5100/MQTT mode and I want to send an update to my V_TEXT sensor via MQTT. Easiest way to do this with Domoticz would be by triggering some script. Sending an MQTT update via Python is probably easy (dunno, haven't done yet), but I have no idea how to form the message so that it would be in correct MySensors format...My node id is 31 and the text sensor child is 1:

      #define MY_NODE_ID     31
      #define LED_MODE_ID     1 
      MyMessage msgLedMode(LED_MODE_ID, V_TEXT);
      

      The payload is some number between -1 to 56. Really appreciate your help. ๐Ÿ˜Œ

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: Domoticz TEXT sensor triggering

      @gohan said in Domoticz TEXT sensor triggering:

      Life sucks, I know ๐Ÿ˜

      I see your point, my suggestion was merely a workaround to the node running but if you foresee domoticz limitations a problem for the future, maybe it could be worth moving to another controller now that you don't have too many nodes around

      Around a hundred sensors now and growing...not very excited of the conversion work... ๐Ÿ˜• However, started some planning already and now MySensors GW is converted from serial to W5100/MQTT and Node-red has been installed. Have had plans to test it for a some while, but now really started playing with it. Seems that you can do all kind of nice middle-level stuff with it. ๐Ÿ’ช

      Plan now is to test some other controller via MQTT but only by subscribing to the MySensors queue.

      Also interesting to hear that people have switched totally to Nodered ( @tbowmo do you still have some controller or just Node-red gui/dashboard). Is there some ready-made interpreters for MySensors messages or need one define them all manually?

      And @monte, I definitely think your solution is the coolest one...but I know that if I take this alluring path, I'll end even deeper with the domo hacking I want to get rid off. ๐Ÿ˜

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: Domoticz TEXT sensor triggering

      @gohan True...I'm just trying to find a way to avoid that darned dummy switch here and there mess. Have been playing with them too much lately. Domoticz developers seems to be also pretty slow to react to any suggestions. Ok, I don't pay to them, but HA and OpenHAB feels a bit more active nevertheless. Probably need to go the dummy hack path again, sigh. Probably have to change the controller soon as every this type of hack makes the conversion even harder in future.

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: Domoticz TEXT sensor triggering

      @nca78 Thanks for the feedback. I have had similar feeling towards Domoticz for some while. What controller would you suggest? Have been watching OpenHab more closely now, but the conversion work required... ๐Ÿ˜–

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: Domoticz TEXT sensor triggering

      @sushukka Strangely quiet here. ๐Ÿ™‚ This seems to be kind a common problem as there are many workarounds built because of this. However, I haven't seen no reasoning anywhere why the TEXT sensor update in Domoticz will not trigger any event to send the update to the node.
      I opened/continued a thread also on Domoticz forum:
      https://www.domoticz.com/forum/viewtopic.php?f=28&t=22801&p=177364#p177364
      Some LUA scripting maybe needed, but not sure yet. Still I see this a very crucial shortcoming as there are lots of cases where you need to pass parameters/commands etc. short information between Domo and MySensors nodes.

      posted in Troubleshooting
      Sushukka
      Sushukka
    • Domoticz TEXT sensor triggering

      Hello,
      This is already very well discussed topic, but I would like to broaden the scope a little bit without stealing anyones thread. So here it goes.
      There has been now several cases in my microcontroller journey with MySensors and Domoticz where I need to pass some command or code to some node for further processing. For example I want to have different lighting or user modes in some node. I create a dummy sensor on Domoticz and selector swith on that. After that I define a V_TEXT sensor on the node. Now I can simply update the TEXT sensor via the selector swith (Json commands) and the TEXT sensor variable will be updated. However, the information will not be passed to the node without explicitly requesting it from the node.

      MySensors/Domo support lots of ready made devices like RGB, switches, dimmers etc, but sometimes that's not just enough. The best way to pass information via controller is now by using V_TEXT/S_INFO sensor type, but it has a major downfall that Domoticz wont trigger anything when one of this type of sensors is updated. This forces MySensors users to do all kind of gimmicks with receive command triggering switches, dimmer hacking etc. All of which makes Domoticz ugly and kind a hacked.

      So what are the alternatives? I don't know, suggestions fellow MySenors users? The dummiest way is to make a poll requesting the TEXT info in regular manner. Works, but too inefficient. Other way is the dimmer type of hacking on Domo. I haven't used MQTT yet, could it be useful here? All the sensors and nodes are anyway MySensors ones so I assume that the Domo trigger problem persist. How about creating some generic lua script on Domo sending the information when it gets changed? Is it even possible to access this Domo/MySensors communication level ?

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: WS2812FX, MySensors and "Expansion of macro F"

      @mfalkvidd Thanks mfalkvidd...the oldest mistake one can make and I'm still falling to it regularly. Here are the links:
      Link to the library: https://github.com/kitesurfer1404/WS2812FX/issues/83
      Link to the problem workaround: https://github.com/kitesurfer1404/WS2812FX

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: WS2812FX, MySensors and "Expansion of macro F"

      @sushukka Here is discussion about this topic with WS2812FX author. Workaround found, maybe changes in the future. Nevertheless, this led library is really worth to try as it saves lots of time by having plenty of ready built animations for WS2812 addressable led strips + the library is very easy to use.

      posted in Troubleshooting
      Sushukka
      Sushukka
    • WS2812FX, MySensors and "Expansion of macro F"

      Hello,
      I try to compile a sketch with ESP8266 MySensors Gateway and WS2812FX library. I can use WS2812FX separately and compile all the example sketches there are, but now when trying to combine these two worlds together I get a following error:

      Build options changed, rebuilding all
      In file included from C:\Omat\Own_projects\Arduino\omat\libraries\MySensors/MySensors.h:28:0,
      
                       from C:\Omat\Own_projects\Arduino\omat\MySensors\HomeNumber_IrRemote\HomeNumber_IrRemote.ino:39:
      
      C:\Users\userxxx\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/pgmspace.h:21:51: error: __c causes a section type conflict with __c
      
       #define PSTR(s) (__extension__({static const char __c[] PROGMEM = (s); &__c[0];}))
      
                                                         ^
      
      C:\Omat\Own_projects\Arduino\omat\libraries\MySensors/core/MySensorsCore.h:91:40: note: in definition of macro 'CORE_DEBUG'
      
       #define CORE_DEBUG(x,...) hwDebugPrint(x, ##__VA_ARGS__) //!< debug
      
                                              ^
      
      C:\Omat\Own_projects\Arduino\omat\libraries\MySensors/core/MySensorsCore.cpp:594:13: note: in expansion of macro 'PSTR'
      
        CORE_DEBUG(PSTR("MCO:SLP:WUP=%d\n"), result); // sleep wake-up
      
                   ^
      
      In file included from C:\Users\userxxx\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/Arduino.h:243:0,
      
                       from sketch\HomeNumber_IrRemote.ino.cpp:1:
      
      C:\Users\userxxx\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/pgmspace.h:21:51: note: '__c' was declared here
      
       #define PSTR(s) (__extension__({static const char __c[] PROGMEM = (s); &__c[0];}))
      
                                                         ^
      
      C:\Users\userxxx\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/WString.h:38:76: note: in definition of macro 'FPSTR'
      
       #define FPSTR(pstr_pointer) (reinterpret_cast<const __FlashStringHelper *>(pstr_pointer))
      
                                                                                  ^
      
      C:\Users\userxxx\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/WString.h:39:34: note: in expansion of macro 'PSTR'
      
       #define F(string_literal) (FPSTR(PSTR(string_literal)))
      
                                        ^
      
      C:\Omat\Own_projects\Arduino\libraries\WS2812FX-master/WS2812FX.h:284:50: note: in expansion of macro 'F'
      
             _name[FX_MODE_CUSTOM]                    = F("Custom");
      
                                                        ^
      
      exit status 1
      Error compiling for board WeMos D1 R2 & mini.
      

      Not sure what this actually means, but I assume either MySensors or WS2812FX "overlaps" somehow.

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: Protecting a lock switch securely with MySensors and Domoticz

      @monte True but one need to draw a line to some level. Thing is that in this case the hacker would need to stay close proximity of the house and that would be recorded to security cameras I have around the property. In some crowded apartment building the situation would be a whole lot different. In that case I probably wouldn't have permission to mess with the lock or at least I wouldn't allow any remote functionality with it. But just speculating...remote lock functionality on highly crowded area...MySensors+arduino signing but not cryptography -> maye nah, ESP8266 with WPA2 maybe good enough, RaspBerry or some miniLinux would give lots of options, but not realtime systems, maybe not that reliable stepper etc. handling anymore. HW level should be anyway easy to make secure enough, but controller like Domoticz could be the weak link. Maybe just force authentication to Domo everytime. It seems to prevent also direct REST calls as it should.

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: Protecting a lock switch securely with MySensors and Domoticz

      @monte Good note. However, I draw the line on this level. My DHCP range is whole different than static IP range and in static range the Domoticz allowed adresses are quite arbitrary. Also Domo port is not any easy guessable common port. So to break in "cleanly" would take quite some time. Breaking in with "traditional" methods would be hundred times faster. ๐Ÿ™‚

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: Protecting a lock switch securely with MySensors and Domoticz

      Update: Finally got this project finished! As soon as there are some mechanic involved + it has to be super reliable, things starts to get complicated. However, now it's done and works fine.

      To this Domoticz/Wifi-hacking dilemma there were pretty easy workaround, which I didn't in my blindsight understand in the beginning: on Domoticz settings you can specify also fully defined IP addresses on allowed networks field. Of course the tooltip says networks and network ranges, but nothing prevents you to use straight IP addresses. So the solution was easy. Just define static IP addresses to the router for the selected devices and then define them in the Domoticz allowed networks field and voila! Now if there are some non defined IP address trying to access Domo, they will be prompted with userid and password and the normal household mobiles/pads/mydomo appliances can use Domo as before.

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: Protecting a lock switch securely with MySensors and Domoticz

      @smilvert Domoticz local network exception is already in place. The initial problem was that there is a small risk to have someone hacking your wifi hence being in your local network.

      @jkandasa Could this be done also on port level so that you could define access whitelist only for Domoticz web gui port but at the same time not touching "MySensors ESP8266 5003 ports" which are also accessing directly Domoticz?

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: Protecting a lock switch securely with MySensors and Domoticz

      @monte Hmm, not a bad hack and easy one too. However, when using mobile devices and the maximum of ten choices in the dummy selector you need to use drop-down menu. Not very user friendly for pin input... Going to have this as a backup idea anyway. ๐Ÿ™‚

      @jkandasa What I understand reverse proxy is a good solution when you don't have dozens of ESP8266 nodes already directly connected to Domoticz as Mysensors LAN gateways or...they use port 5003 and I should reverse proxy only the web gui port, right? In that case wouldn't that mean that every time I open Domoticz from any intranet device (mobile, laptop, pc), it would require authentication unless...I would define static IPs to all of them and whitelist them...?

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: Protecting a lock switch securely with MySensors and Domoticz

      @anticimex Good idea. Sadly I have already plenty of ESP8266s scattered around the house and they access directly the Domoticz controller (as MySensors LAN (wifi) gateways). Also there are couple of mobile devices which should be able to access Domo. I could apply a MAC filter either on router or Domo Rasp3, but the list would be quite long and pain in the ass to maintain.

      @gohan You probably haven't defined the local allowed networks in the settings panel ie. there is no authentication if accessed from those networks. Blanking this out, would be a quite feasible idea indeed, but then I have to login everytime I want to check some temperature or similar from my mobile phone when at home. Maybe I just force the authentication if cannot find any better solution.

      However, now it's implemented like this:

      • Lock unit has normal V_STATUS child presented to gateway
      • Logic unit has similar V_STATUS child but only for internal bookkeeping
      • Logic unit has also V_TEXT child for Domoticz to show who has lastly unlocked the door. This information could be used for push notifications or similar later on. Both nodes doesn't absolute nothing if this text sensor is somehow changed in Domo.
      • Simple trick was to do double check when V_STATUS command arrives to the lock and logic nodes. Basically they keep lock status updated by sending the commands directly to each other (of course via MySensors gateway). It would be enough to have only logic node sending the commands to lock node, but lock node has also button which could be used for locking/unlocking the door and therefore logic unit need to be informed also. So basically the nodes will check the message.sender if V_STATUS update arrives. If it's from each other, we accept it and if not, we revert the status back what it was and don't do anything else.
      • I haven't implemented the signing yet, but when done, I think this should be quite safe.
      • For remote access, I'm still planning to extend logic unit with ESP8266 which could then be isolated to different network or protected with networking tools.
      posted in Troubleshooting
      Sushukka
      Sushukka
    • Protecting a lock switch securely with MySensors and Domoticz

      Hello fellow MySensors users!
      Writing this here too as it seems that Domoticz forum is not very active one and this somehow relates also to MySensors API.

      I'm currently building a fingerprint door lock. A bit more complicated project but rewarding anyway. ๐Ÿ™‚
      There are outside interfacing unit connected to inside main logic module containing microcontroller and NRF24 transreceiver. NRF24 communicates with the lock module installed inside of the door which opens or closes the lock. I use MySensors with signing to have moderate protection in the transmission level. MySensors gateway is physically connected to Domoticz controller (Serial<->Raspberry). Reason to have MySensors here is that this could be leveraged further in the future and need some reliable enough wireless transmission protocol between the logic and lock units.

      Thing is that there is a small possibility that someone could hack through the Wifi in this neighbourhood. Turning on or off some lights haven't been anything to worry about so far but opening a closed door in an unmanned house would be. In Domoticz you could check the "protected" box in the switch settings but it can be turned off as easily without getting even password prompt when doing that. Moreover one could just go to the settings page and change the switch protection password, again without getting a prompt for old password or similar.

      So happen anyone here to have any ideas how to protect the switch within Domoticz securely? Now everything relies on well protected wifi and recent news of cracked wpa2 protocol isn't helping this. Also when having already dozens of wifi nodes in the house, changing the wifi password often is complicated.

      Currently I'm bouncing an idea connecting a ESP8266 to the inside main logic unit (Arduino Mega) and maybe just run there a simple protected lock control web page if remote opening is required... Moreover I have only one MySensor's controller in the house and all the sensors connected there will popup to Domoticz GUI. Any idea what sensor type I should use for communication between the main logic and lock unit without giving any possibility to affect it on Domoticz level (S.INFO maybe...)?

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: Multithreading with Arduino

      Hehe, took couple of hours but now have four led sequences running "in parallel" on Wemos D1 Mini. Three fades with random intervals and one flickering led with random intervals imitating noise in electric net. Also couple of static leds running on same board. Seems that MySensors have no problem to get its slice of the cake so I'm happy now.
      Btw, these leds are implemented in this:
      http://www.billingboats.com/da/22/2/boats/advanced-beginner/P-bb474-cux-87.html
      For a perfectionist took terrible amount of time to build, but looks pretty awesome now. ๐Ÿ™‚

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: Multithreading with Arduino

      @Yveaux Thanks Yveaux. ๐Ÿ™‚ I'll use this as a model with Adafruits multithreading examples. I want to learn how to handle this by myself because there are lots of projects where I need to handle parallelism somehow (not only leds). So far I have used basic scheduler based on "if currentMillis - previous > interval" style, but it's just a beginning. By using methods and program wide variables is a bit dirty way to accomplish this but so far been easiest to use. Now need to properly isolate these to own classes to keep the code clean. Getting rid of loops will need some thinking, but the biggest problem seems to be in my mind to undestand that eg. 10ms is enough to do lots of things. Ofc this is harder with 16MHz Arduino than 80/160MHz ESP8266. Anyway, this is an interesting area and I'm going to enjoy diving deeper to get more out of these already amazing microcontrollers. ๐Ÿ™‚

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: Multithreading with Arduino

      @mfalkvidd Thanks for the quick answer. I try to keep controllers well utilized before splitting the workload between several controllers. In current case I only need to control one 10W RGB LED and a stepper motor. This is connected to optic fibre star light ceiling where there are different programs to run. In front of the LED light source there is screen plate with random holes on a stepper motor creating blinking effect if wanted. This shouldn't be too hard to Arduino to handle. Just need chop my old LED color algorithms so that I can fit the stepper motor movements in (or more likely other way around as stepper motor requires finer controlling)

      But then there is another project upcoming where there are stairway and about 12m WS2812 addressable LED strip waiting. On there clocked up ESP8266 and Fastled libraries are probably must. Also need to think about the wiring carefully.

      Anyway multitasking requires gimmickry it seems. Having two core Arduinos or ESP8266s would be nice. ๐Ÿ™‚

      posted in Troubleshooting
      Sushukka
      Sushukka
    • Multithreading with Arduino

      Hello,
      So far have managed nicely to write partly simultaneous stuff with interrupts, schedulers etc, but having some headache now when trying to really do some multithreaded stuff. For example:

      • RGB LED color cycling/pulsing and controlling a stepper motor at the same time
      • Multiple LED color algorithms which should be run simultaneously

      It seems that the only way to go is to break the algorithm logics totally down in small pieces and just call the methods/classes from the main loop. For example with LED dimming just do one step color change, exit back to the loop and do eg. next stepper movement and over again. However, this basically means that majority of the nice LED color algorithms need to be heavily restructured to get rid off all loops and delays/waits. Also wondering if MySensors logic will actually have time to do anything because of the quite busy scheduling this will generate. Have anyone some nice ideas or tips to overcome these challenges?

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: Metal in walls prevents radio communication. Alternatives?

      @dakipro My experiences so far are that even the frequencies with NRF24L01 and ESP8266 are nearly same ESP8266 tend to have better range and communication reliability than NRF24 (even with PA+LNA and caps). Because of architectural differences ESP8266 draws however more energy and really wouldn't rely on batteries with it.

      Anyway in your case it seems that the box is little bit thicker than mine hence it probably dampens the signal somewhat more. If I were you, I would just bring the 5V in and by looking those pictures it shouldn't be hard. Currently I have only two battery operated nodes and they are freezer/fridge temperature sensors based on Sensebender. When you are going to have tens and tens of nodes around the house, the battery replacements start to get out of control. So after bringing 5V in, build just a standard Arduino or ESP8266 node. If the signal is not reliable enough, then bring (if using ESP8266) your wifi router closer or MySensors gateway (if using Arduino/NRF24). Of course you could use ESP8266 with Arduino but nowadays with Wemos Minis and similar complete boards, it's kind a dummy move. If putting up another Wifi extender or moving your Wifi router is not an option, just stick with the Arduino/NRF24. After finding out how far the NRF24 can reach with caps and MAX signal strength, you can set a repeater node in strategically selected position if required.

      However, if the box dampens the signal very heavily I would just keep the Arduino+light sensor in the box and wire the NRF24 part out of the box (using the same hole where the 5V comes in). Then you would need to build just one node and probably don't need to move any routers/gateways outside.

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: Metal in walls prevents radio communication. Alternatives?

      @dakipro Have been following the electricians work at my house many years now and tbh not very impressed how delicate or elegant their ways or work are. What I did was:

      • I drilled a small hole to the main electric intake metal box. Just couple of mm small hole and put plastic lead-through so that the metal edges won't wear the cable. Also drilled the hole to the bottom of the box so that there is no way rain or other crap to go in.
      • 5v supply power cable (from mobile or whatever adapter where you can get) through the hole and...
      • put ESP8266 (Wemos D1 Mini) in with LM393 light sensor and little bit modified "PulsePowerMeter" example from Mysensors build page and it has been working flawlessly about one year now
      • There is little to nothing to go wrong as the Wemos is inside it's own plastic box, secured away from everything and the light sensor is just taped on the led of the electric meter.

      So yes, the metal box blocks Wifi signals in some level but not that much it could prevent connection through that metal box, outer wall and one or two in-house walls between my Wifi router. Anyway, you need to get 5V/3,3V power inside the box as batteries don't last very long with ESP8266.

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: Metal in walls prevents radio communication. Alternatives?

      Weather station has been working lately pretty well. Only sometimes there can be an hour connection break or so. Therefore PA LNA may be just enough. So I'll build an outside repeater based on that and if it doesn't help I have now couple of other paths (double antenna, second ethernet gateway) to go. Thanks again fellow forum members, the community here is one of the most active in this area I have seen! ๐Ÿ™‚

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: Metal in walls prevents radio communication. Alternatives?

      @mfalkvidd My central gateway is already ethernet gateway. Also wouldn't that mean I should put my GW outside --> all the inside nodes wouldn't be able to connect it anymore.

      @gohan Sadly wifi has also problems when going outside. But could it be possible to use NRF24 with ESP8266 so that:

      • ESP8266 sits inside where is wifi coverage and...
      • NRF24L01 is wired through the wall outside.

      But this would mean that I would need force weather station somehow communicate only with this esp8266. Also would it generate some competition having two gateways in NRF24L01 network?

      posted in Troubleshooting
      Sushukka
      Sushukka
    • Metal in walls prevents radio communication. Alternatives?

      After installing the latest weather station node to the roof of the house, I finally found the limits of nrf24l01. First of all there is a need to pass a metal roof but luckily only partially as the weather station is installed on the end of the ridge. However, the biggest problem seems to be the insulation used in the second floor walls and the ceilings as it is polyurethane sheets with thin aluminum foil on both sides. This seems to block all radio communication very efficiently (also WIfi seems to be blocked pretty good). I have set transmission rate to max on the weather station, there are also 100uF capacitator and rate is set to 250Kbs. Also all transmission time intervals are carefully set so that there should be minimal sequential transfers to drain fully the capacitator. Still it works only part of the time, otherwise I get nacks, connection failures. Not power issue because everything works fine right if I bring my gatewat outside the door.

      As the installation of the weather station was very much pain in the butt, I really would like to find some way to get the singnals flying without touching the weather unit.
      Repeater path:

      • As I like to keep my gateway near center of the house, moving it is not an option. So maybe putting some repeater node in strategically good place between weather station and gw.
      • I tried this with one Nano+nrf24l01 repeater combo with transmission strength MAX. Because it was an old sensor node, it took power from Nano's 3.3V which probably is not enough but there was 100uF capacitator compensating that. Anyway, this repeater works fine every place inside the house but don't help a lot when you step outside.
      • So the next step...I have ordered nrf24l01+pa+lna with antenna and plan to try it in a repeater node separately powered and with combination of small and big capacitator. Planning to put this outside very near to the wall appr. 4m to the weather station and 8m to the gw. In that place it would have basically no obstacles to the outside's weather station but to gateway it has to pass those two metal insulation sheets and three drywalls. Will work or not, don't know if I could do anything more with plain vanilla nrf24l01...

      Mixed alternatives:

      • Another option would be some kind of a double antenna solution or mixed serial "don't know if it's even possible" route. The main idea would be somehow receiving the data outside and carrying it inside via cable and then send it wirelessly to the gateway. Any idea how to do that with a single Arduino or is basically two nodes combined required?
      • Also any other idea to overcome this problem would be very welcome.
      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: ACS712 strange values when measuring 3D printer power consumption

      @Yveaux ASCII art + SID music ftw. ๐Ÿ™‚ I played around with the sampling time (changed from 1480 to 3000/6000):

      double Irms = emon1.calcIrms(6000)
      

      Now the values are pretty close together. Still had to manually do the zero load subtraction (around 30W) but after that ACS712 shows surprisingly accurate values even for low 10/20W loads. Now it seems that when Prusa is heating up I get constantly around 100W higher values than I should. But when I turn the Kossel or hair dryer on = adding load to the same line, the Prusa crap seems to fitted in (or filled in) so that the total load seems to be accurate. My "reference" power meter could be off for reactive loads, but not this much and moreover Prusa's power supply is around 200W and I get 300W readings from ACS712.

      Anyway, I think I'll take the "so be it" step now and just have to live with the fact that Prusa will skew my power readings a bit. Usually there will be some other load in the same line so it should be partly corrected by that. Your help @Yveaux was pretty useful and I thank you for that. ๐Ÿ™‚ Also I usually have trusted to some homemade power calculation algorithms because OpenEnergyMonitor is so heavily based on CT3 but as I now saw how much better accuracy its algorithms give I'm going to switch in to that in future projects.

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: ACS712 strange values when measuring 3D printer power consumption

      @Yveaux said in ACS712 strange values when measuring 3D printer power consumption:

      void setup() {
      Serial.begin(115200);
      }

      void loop() {
      Serial.println( analogRead(A0) );
      }

      Cool, haven't thought you could use plotter like this. Hair dryer gave pretty sin/cos like load, Kossel 3D printer with a normal computer supply is quite close but Prusa's load was pretty spiky. It looked like:

                      /|
                     / |
                    |   \
            /------/    |
      ----/             \----
      

      Which probably underlines pretty well your point. ๐Ÿ™‚ Question is that is there anyway to tackle this when using emonlib?

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: ACS712 strange values when measuring 3D printer power consumption

      @Yveaux Thank you for the link. Very good document which went straight to my favorites. ๐Ÿ™‚
      Here is the algorithm of the sketch:

      /*
      Measuring AC Current Using ACS712
      This ACS712 algorithm is more precise than ACS712_2 algorithm but because of long while loop
      cannot be used with animated displays or similar non-interruptable functionality
      */
      const int sensorIn = A0;
      int mVperAmp = 100; // use 100 for 20A Module and 66 for 30A Module
      
      
      double Voltage = 0;
      double VRMS = 0;
      double AmpsRMS = 0;
      
      void setup(){ 
       Serial.begin(115200);
      }
      
      void loop() {
       Voltage = getVPP();
       VRMS = (Voltage/2.0) *0.707; 
       AmpsRMS = (VRMS * 1000)/mVperAmp;
       AmpsRMS -= 0.45;     // Empty load correction
       Serial.print(AmpsRMS);
       Serial.print("A ");
       Serial.print(AmpsRMS * 230);
       Serial.print("W\t");
       Serial.print(Voltage);
       Serial.println("V");
      
       delay(500);
      
      }
      
      float getVPP() {
        float result;
        int readValue;             //value read from the sensor
        int maxValue = 0;          // store max value here
        int minValue = 1024;          // store min value here
        
         uint32_t start_time = millis();
         while((millis()-start_time) < 1000) { //sample for 1 Sec
           readValue = analogRead(sensorIn);
           // see if you have a new maxValue
           if (readValue > maxValue) {
               /*record the maximum sensor value*/
               maxValue = readValue;
           }
           if (readValue < minValue) {
               /*record the maximum sensor value*/
               minValue = readValue;
           }
         }
         
         // Subtract min from max
         result = ((maxValue - minValue) * 5.0)/1024.0;
            
         return result;
       }
      

      I have also used another algorithms, but this seems to give now good enough results. This algorithm is taken from: http://henrysbench.capnfatz.com/henrys-bench/arduino-current-measurements/acs712-arduino-ac-current-tutorial/

      Edit: Switched using Emonlib and used:

      emon1.current(0, 9.5);             // Current: input pin, calibration.
      

      Now all other loads seems to show correctly but Prusa is still showing too much (200W vs 300W). So it seems to be that the Prusa's power supply is creating lots of reactive/non-linear load affecting badly to the power factor (right?). Probably this is just that much you can do with these cheap sensors. Maybe need to set Prusa out of this power meter or build own Prusa power sensor with different calibration/correction routines.

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: ACS712 strange values when measuring 3D printer power consumption

      @dbemowsk Yes, there are about 8 devices behind this line. But they rarely use over 600W together and are actually splitted after UPS. However, I can use all other devices but 3D printers at the same time and having quite reliable numbers. As I mentioned before when I plug only Prusa MK2 and nothing else the values goes crazy. Latest testing results:

      • Only Arduino + ACS712 and Prusa plugged in --> ACS712 power usage: 630W, reference: 196W.
      • Replacing Prusa with a hair dryer to the same setup --> ACS712 power usage: 435/849/1430W, reference: 443/864/1443W.

      What's wrong with my Prusa? ๐Ÿ˜ง

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: ACS712 strange values when measuring 3D printer power consumption

      I have only one line going through ACS712 and then its splitted to multiple outlets with extension cord. First I though that my 20A ACS712 is actually only 5A one, but same problem happes with the second ACS712 20A. Also even 5A should be able to measure this load as Prusa's maximum intake is around 180W.
      Maybe it has something to do with the power factor, dunno. Now I have anyway managed to pinpoint the problem to 3D printers. When plugging only Arduino+ACS712+Prusa MK2 to the wall, ACS712 shows around 690W loads when the Prusa's maximum is about 180W as mentioned above. My old faithful hair dryer power consumption is measured correctly (430W, 820W, 1400W).

      posted in Troubleshooting
      Sushukka
      Sushukka
    • ACS712 strange values when measuring 3D printer power consumption

      Not sure if this is the right forum but essentially building this on MySensors node so here it goes.
      So far I have implemented several ACS712 AC measurement nodes around the house. After calibration the accuracy is around 10-20W which has been good enough for me. However now I'm really having a trouble to understand why the values it provides are way of the chart. Information about this node:

      • My computer room has 2xPCs, Xbox, 2x3D printer, Raspberry 3 running Domoticz, Gigabit switch and home theatre amplifier

      • There comes one 230V/50Hz power intake to a small UPS. UPS provides backup power only to the switch and the other PC. All other devices are connected only through UPS power surge protection outlets. There are couple of multiple output extension power cords to achieve this.

      • Now if I use anything else than the 3D printers the power meter shows realistic values. If I turn either of the 3D printers on the values goes all crazy. I have used my Belkin power meter as reference point and with 3D printer on it shows around 200W and arduino +680W. If I turn the both printers on, the values goes even more separate. Blink node implemented to the electric meter of the house backups Belkin's "reference" values.

      • I have tried to separate the arduino power meter so that it is at least one meter away from the 3D printers but no difference.

      • The other 3D printer (Kossel) uses normal computer supply and the other (official Prusa) probably quite similar. Common thing is that they both are open type printers and they have the same hotends. Hotend takes 12V 5A and Kossel heated bed around 12V 11A, Prusa probably something similar.

      I have tried to use different exension cords, pluggin in different apparatus (hair dryer is my common calibration device) but currently I have no idea what's going on. Only thing I could imagine would be something related to the magnetic fields these quite much DC current consuming printers generate. Arduino is currently sitting about one meter from them, but could it still somehow disturb the ACS712? Also I have checked that the Arduino Nano's 5V voltage stays very stable and shouldn't affect the calculations.

      Edit. I plugged Prusa to another wall outlet about one meter away (same phase/fuse though) and turned it on -> no affect to the Arduino sitting in the same place. So it cannot be my magnetic mumbo jambo theory. So now I'm even more lost...do they generate some noise to the line or...??? ๐Ÿ˜•

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: NRF24 problems with cold temperatures

      Update: Managed to get my NFR24 radios work with Sensebender micro with greatly oversized 100uF normal electrolytic capacitor. Been in my freezer (appr. -20C) now for three days and still works fine. 2xAA batteries powering the node. Not sure where the problem is, maybe just the capacitor size because of diminishing capacitance curve in freezing temperatures. Have still some spare Nanos and Pros to spend, but gradually moving to ESP8266 based sensor network. They have proven to be very reliable even under -20 degrees celsius.

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: NRF24 problems with cold temperatures

      Thanks Nca78. I ordered some 47uF/16V tantalum capacitators. Hopefully they will work. Ceramic would have been better but they seem to be only available on a very small (pF/nF) level.

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: NRF24 problems with cold temperatures

      Have been powering nrf directly from power adapter using the the 8pin socket adapter boards which have internal 5V->3.3V converter. Have been using nrfs directly with Arduino too. Sundberg84 do you mean the "Decoupling-Capacitor" connected directly to VCC+GND pins on the radio (https://www.mysensors.org/build/connect_radio) or something else already on the board? With my latest node I used 47uF/16V electrolytic capacitor soldered directly to the VCC/GND pins. Last reading from the node's temperature sensor was -3.2ยฐC and then nothing.

      posted in Troubleshooting
      Sushukka
      Sushukka
    • NRF24 problems with cold temperatures

      Hello,
      Has anyone else had problems with cold temperatures and NFR24 chip? I have used Arduino Nanos and Pro Minis with normal ebay NRF24 chips with/without capacitors and also with the standard attach board which has 5V input etc. Power supply has always been an adapter ("Hlk-Pm01 Ac-Dc 220V To 5V" or just mobile phone power adapter) so there should be no power issues. Have been feeding also power directly to the NFR24 bypassing Arduino's limitations etc. So far it seems that somewhere near 0ยฐC the nodes stop responding. When bringing back inside, they revive and continue working. Arduino blinks and seems to do something, but communication just freezes (need to do more investigation how Arduino itself is affected). It's worth to mention that my Wemos D1 Mini nodes have been working perfectly in same conditions (same power adapters, locations, -20ยฐC). Radio coverage shouldn't be an issue as there are already couple of inside repeater nodes near the outside locations.
      I have just oredered couple of sensebender boards for monitoring fridge/freezer temperatures and because they need to be battery operated + facing cold temperatures I'm starting to wonder if they will work at all. I have tested this with several NRF24 chips form different orders so it shouldn't be faulty batch related issue.

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: Wemos D1 Mini / ESP8266, MySensors and Analog A0

      @mfalkvidd Thanks again. ๐Ÿ™‚ Commented the issue too. Hopefully they get that fixed someday soon as it is quite a nasty issue for ESP8266 users.

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: Wemos D1 Mini / ESP8266, MySensors and Analog A0

      @mfalkvidd Hehheh, now it works. I commented out the ADC_MODE line from MyHwESP8266.cpp. It seems that in my version (newest MySensors core available in Arduino IDE) the ADC_MODE line is out of the #ifdef MYDEBUG-clause. It's just a free floating line in the root of the application logic.

      int8_t hwSleep(uint8_t interrupt1, uint8_t mode1, uint8_t interrupt2, uint8_t mode2, unsigned long ms) {
      	// TODO: Not supported!
      	(void)interrupt1;
      	(void)mode1;
      	(void)interrupt2;
      	(void)mode2;
      	(void)ms;
      	return -2;
      }
      
      // ADC_MODE(ADC_VCC);
      
      uint16_t hwCPUVoltage() {
      	// in mV
      	return ESP.getVcc();
      }
      
      uint16_t hwCPUFrequency() {
      	// in 1/10Mhz
      	return ESP.getCpuFreqMHz()*10;
      }
      
      uint16_t hwFreeMem() {
      	return ESP.getFreeHeap();
      }
      

      Now it works perfectly. Thank you a lot for your patience mfalkvidd! There are some calibration issues when having Wifi and all other stuff up and running. Basically this is related to the statistics functions but that's no problem, I just switched back to the old algorithm and now measurement works within 10W tolerance using 5V input to sensor. Still even with MYDEBUG variable on, I very much wonder why MySensors change the only ESP8266 analog pin for internal voltage measurement.

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: Wemos D1 Mini / ESP8266, MySensors and Analog A0

      @mfalkvidd said: Not sure if reading VCC has any benefits. I tried Serial.println(ESP.getVcc()); and got values around 3000 (prolly volts in four digits). It didn't change when putting load on ACS712 so it's most probably what it looks like: board's internal VCC value. Also ADC_MODE(ADC_VCC); seems to guide to the same VCC measurement. Howerver, as it was written in the link you send, I tried this too. The ADC_MODE definition line should be put outside any functions eg. after include statements. I assumed that it was define so I wrote #define ADC_MODE(ADC_VCC) and #define ADC_MODE ADC_VCC just to be sure. Still the results are the same: I get 65536 output when activating MySensors library. I have omitted the int/long type casts writing Serial.println(analogRead(A0)); in both sketch. Also if I remove MySensors library from the second sketch, I get the same ~506-510 values I get from the first sketch.

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: Wemos D1 Mini / ESP8266, MySensors and Analog A0

      @mfalkvidd Darnit, my bad. Forgot to uncomment the include MySensors.h after changing from 5V to 3.3V. Now when using 3.3V input the idle value floats around 510. I can include all the other libraries like EEPROM.h, SPI.h, ESP8266Wifi.h, Filters.h, DHT.h...MySensors library does something.
      Here is the simplest sketch for analog reading:

      const int currentPin = A0;
      void setup()
      {
       Serial.begin(9600);
      }
      
      void loop()
      {
      Serial.println(analogRead(currentPin));
      delay(200);
      }
      

      Works fine. Raw output values floats around 500 --> 660 when testing from 0-1400W so I can measure wattages reliably and high enough. However this skecth don't work until I comment MySensors.h library.

       /**
       * DESCRIPTION
       */
      // Enable debug prints to serial monitor
      #define MY_DEBUG 1
      
      // Define this nodeID manually
      #define MY_NODE_ID 13
      
      // Use a bit lower baudrate for serial prints on ESP8266 than default in MyConfig.h
      #define MY_BAUD_RATE 9600
      
      #define MY_GATEWAY_ESP8266
      #define MY_ESP8266_SSID "xxxxxxx"
      #define MY_ESP8266_PASSWORD "xxxxxxx"
      
      // Set the hostname for the WiFi Client. This is the hostname
      // it will pass to the DHCP server if not static.
      #define MY_ESP8266_HOSTNAME "ESP8266-PowerSocket2"
      
      // Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
      #define MY_IP_ADDRESS 192,168,0,71
      
      // If using static ip you need to define Gateway and Subnet address as well
      #define MY_IP_GATEWAY_ADDRESS 192,168,0,1
      #define MY_IP_SUBNET_ADDRESS 255,255,255,0
      
      // The port to keep open on node server mode 
      #define MY_PORT 5003      
      
      // How many clients should be able to connect to this gateway (default 1)
      #define MY_GATEWAY_MAX_CLIENTS 2
      
      #include <EEPROM.h>
      #include <SPI.h>
      #include <DHT.h>
      #include <ESP8266WiFi.h>
      #include <MySensors.h>  
      #include <Filters.h>
      
      //------------- ACS712 related definitions -------------
      #define ACS712_ID 2
      #define ACS712_PIN A0
      float ACS712sensorValue = 0;
      //------------------------------------------------------
      
      void setup() { 
        Serial.begin(9600);
      }
      
      void presentation() {
        // Send the sketch version information to the gateway and Controller
       // sendSketchInfo("ESP8266 PowerSocket2", "1.0");
      }
      
      void loop() { 
      
        //-- Send ACS712 update if interval reached
        ACS712sensorValue = analogRead(A0);  // read the analog in value:
        Serial.println(ACS712sensorValue);
        delay(200);
      }
      
      

      Pretty much the simpliest MySensors sketch you can make and doing just analogRead(A0). Somehow MySensors library is screwing things up. Also I haven't found any 3.3V hall sensors out there for measuring bigger loads like 20A so the problem for this should be pinpointed somehow.

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: Wemos D1 Mini / ESP8266, MySensors and Analog A0

      @mfalkvidd I changed the input voltage from 5V to 3.3V to ACS712 and now it shows again some numbers. Need to do the calibration from the scratch again as the scale has now changed. So thank you for guiding the dummy further on the road. ๐Ÿ™‚ Getting little bit tired of ESP8266's 3.3V specs. Majority of the sensors tend to be 5V and too often need to implement all kind of voltage drops, step-ups etc, to get things working. One major reason for ESP8266 usage is it's lower footprint comparing to Arduino + NFR24 and it's pretty much lost with this extra voltage crap needed.

      Also, the big question is that how in the earth this worked with the same hardware setup (only ACS712 connected to ESP8266) with another sketch where MySensors library was not included? ๐Ÿ˜ฎ I have a hairdryer connected to it and got reliable measurements up to 1400W. Probably would have some problems over 2000W orso when the scale would have been ended, but anyway I shouldn't get different numbers with MySensors library included?

      EDIT: Didn't work. Late night coding --> forgot to uncomment the MySensors library. Still works only without MySensors library which is strange af.

      posted in Troubleshooting
      Sushukka
      Sushukka
    • Wemos D1 Mini / ESP8266, MySensors and Analog A0

      Hello,
      What's going on with MySensors and Wemos D1 Mini's A0 port? I have an ACS712 hall sensor connected to A0 and it works fine together with other sensors in this sketch:

      #include <Filters.h>
      
      float testFrequency = 50;                     // test signal frequency (Hz)
      float windowLength = 20.0/testFrequency;     // how long to average the signal, for statistist
      int sensorValue = 0;
      float intercept = -0.045; // to be adjusted based on calibration testing
      float slope = 0.0350; // to be adjusted based on calibration testing
      //float intercept = -0.045; // to be adjusted based on calibration testing
      //float slope = 0.0495; // to be adjusted based on calibration testing
      RunningStatistics inputStats;                 // create statistics to look at the raw test signal
      
      float current_amps; // estimated actual current in amps
      
      unsigned long printPeriod = 5000; // in milliseconds
      // Track time in milliseconds since last reading 
      unsigned long previousMillis = 0;
      
      void setup() {
        Serial.begin( 9600 );    // start the serial port
        inputStats.setWindowSecs( windowLength );
      }
      
      void loop() {
         
          sensorValue = analogRead(A0);  // read the analog in value:
          inputStats.input(sensorValue);  // log to Stats function
              
          if((unsigned long)(millis() - previousMillis) >= printPeriod) {
            previousMillis = millis();   // update time
            
            // display current values to the screen
            Serial.print( "\n" );
            // output sigma or variation values associated with the inputValue itself
            Serial.print( "\tsigma: " ); Serial.print( inputStats.sigma() );
            // convert signal sigma value to current in amps
            current_amps = intercept + slope * inputStats.sigma();
            //if (current_amps < 0.15) { current_amps = 0.00; }
            Serial.print( "\tamps: " ); Serial.print( current_amps );
            Serial.print( "\tWatts: " ); Serial.print( current_amps*230 );
          delay(1);
        }
      }
      

      ACS712 raw input floats around 720 when no load. I have calibrated it to appr. 10w tolerance. When put all this together with MySensors code, I don't get anymore any reliable numbers from A0. After stripping not related code from MySensors sketch what was left is here:

       /**
       */
      // Enable debug prints to serial monitor
      #define MY_DEBUG 1
      
      // Define this nodeID manually
      #define MY_NODE_ID 13
      
      // Use a bit lower baudrate for serial prints on ESP8266 than default in MyConfig.h
      #define MY_BAUD_RATE 9600
      
      #define MY_GATEWAY_ESP8266
      #define MY_ESP8266_SSID "xxxxxx"
      #define MY_ESP8266_PASSWORD "xxxxx"
      
      // Set the hostname for the WiFi Client. This is the hostname
      // it will pass to the DHCP server if not static.
      #define MY_ESP8266_HOSTNAME "ESP8266-PowerSocket2"
      
      // Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
      #define MY_IP_ADDRESS 192,168,0,71
      
      // If using static ip you need to define Gateway and Subnet address as well
      #define MY_IP_GATEWAY_ADDRESS 192,168,0,1
      #define MY_IP_SUBNET_ADDRESS 255,255,255,0
      
      // The port to keep open on node server mode 
      #define MY_PORT 5003      
      
      // How many clients should be able to connect to this gateway (default 1)
      #define MY_GATEWAY_MAX_CLIENTS 2
      
      #include <EEPROM.h>
      #include <SPI.h>
      #include <ESP8266WiFi.h>
      #include <MySensors.h>  
      #include <Filters.h>
      
      //------------- ACS712 related definitions -------------
      #define ACS712_ID 2
      #define ACS712_PIN A0
      int ACS712sensorValue = 0;
      //------------------------------------------------------
      
      void setup() { 
        Serial.begin(9600);
      }
      
      void presentation() {
        // Send the sketch version information to the gateway and Controller
        sendSketchInfo("ESP8266 PowerSocket2", "1.0");
      }
      
      void loop() { 
      
        //-- Send ACS712 update if interval reached
        ACS712sensorValue = analogRead(A0);  // read the analog in value:
        Serial.println(ACS712sensorValue);
        wait(200);
      }
      

      It connects nicely to my home wlan, but somehow A0 is now used, changed or reserved to something else. AnalogRead(A0) just prints 65536 all the time. It seems that specifically MySensors library is somehow messing this up because when commenting it out I get correct readings from A0. I'm wondering if it has something to do with ESP8266/Arduino pinmapping? Currently I have used this table (https://github.com/esp8266/Arduino/blob/master/variants/nodemcu/pins_arduino.h#L37-L59) to map the correct pins on the board and Arduino IDE:

      static const uint8_t LED_BUILTIN = 2;
      static const uint8_t BUILTIN_LED = 2;
      
      static const uint8_t D0   = 16;
      static const uint8_t D1   = 5;
      static const uint8_t D2   = 4;
      static const uint8_t D3   = 0;
      static const uint8_t D4   = 2;
      static const uint8_t D5   = 14;
      static const uint8_t D6   = 12;
      static const uint8_t D7   = 13;
      static const uint8_t D8   = 15;
      static const uint8_t RX   = 3;
      static const uint8_t TX   = 1;
      

      Nothing related to A0 though... Quite irritating as this is the only analog input available on Wemos... Moreover pretty much the same sketch has been working on Arduino Nano+NFR24L01. Problem with that combination was that when using statistics functions to get reliable enough data from ACS712 on top of all the other sensor functionality on the same node, I faced memory problems which are not happening with Wemos D1M. So please can someone help me with this?

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: Wemos D1 Mini ESP8266 GW Homeassistant connection problem with sensor node

      Ok, I managed to add DHT part to the ESP8266GW sketch, but still have the problem with reading the DHT22 data.

      /**
       * The MySensors Arduino library handles the wireless radio link and protocol
       * between your home built sensors/actuators and HA controller of choice.
       * The sensors forms a self healing radio network with optional repeaters. Each
       * repeater and gateway builds a routing tables in EEPROM which keeps track of the
       * network topology allowing messages to be routed to nodes.
       *
       * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
       * Copyright (C) 2013-2015 Sensnology AB
       * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
       *
       * Documentation: http://www.mysensors.org
       * Support Forum: http://forum.mysensors.org
       *
       * This program is free software; you can redistribute it and/or
       * modify it under the terms of the GNU General Public License
       * version 2 as published by the Free Software Foundation.
       *
       *******************************
       *
       * REVISION HISTORY
       * Version 1.0 - Henrik EKblad
       * Contribution by a-lurker and Anticimex, 
       * Contribution by Norbert Truchsess <norbert.truchsess@t-online.de>
       * Contribution by Ivo Pullens (ESP8266 support)
       * 
       * DESCRIPTION
       * The EthernetGateway sends data received from sensors to the WiFi link. 
       * The gateway also accepts input on ethernet interface, which is then sent out to the radio network.
       *
       * VERA CONFIGURATION:
       * Enter "ip-number:port" in the ip-field of the Arduino GW device. This will temporarily override any serial configuration for the Vera plugin. 
       * E.g. If you want to use the defualt values in this sketch enter: 192.168.178.66:5003
       *
       * LED purposes:
       * - To use the feature, uncomment WITH_LEDS_BLINKING in MyConfig.h
       * - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved
       * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
       * - ERR (red) - fast blink on error during transmission error or recieve crc error  
       * 
       * See http://www.mysensors.org/build/esp8266_gateway for wiring instructions.
       * nRF24L01+  ESP8266
       * VCC        VCC
       * CE         GPIO4          
       * CSN/CS     GPIO15
       * SCK        GPIO14
       * MISO       GPIO12
       * MOSI       GPIO13
       * GND        GND
       *            
       * Not all ESP8266 modules have all pins available on their external interface.
       * This code has been tested on an ESP-12 module.
       * The ESP8266 requires a certain pin configuration to download code, and another one to run code:
       * - Connect REST (reset) via 10K pullup resistor to VCC, and via switch to GND ('reset switch')
       * - Connect GPIO15 via 10K pulldown resistor to GND
       * - Connect CH_PD via 10K resistor to VCC
       * - Connect GPIO2 via 10K resistor to VCC
       * - Connect GPIO0 via 10K resistor to VCC, and via switch to GND ('bootload switch')
       * 
        * Inclusion mode button:
       * - Connect GPIO5 via switch to GND ('inclusion switch')
       * 
       * Hardware SHA204 signing is currently not supported!
       *
       * Make sure to fill in your ssid and WiFi password below for ssid & pass.
       */
      
      #include <EEPROM.h>
      #include <SPI.h>
      #include <DHT.h>
      
      // Enable debug prints to serial monitor
      #define MY_DEBUG 
      
      // Use a bit lower baudrate for serial prints on ESP8266 than default in MyConfig.h
      #define MY_BAUD_RATE 9600
      
      // Enables and select radio type (if attached)
      //#define MY_RADIO_NRF24
      #define MY_RADIO_RFM69
      
      #define MY_GATEWAY_ESP8266
      
      #define MY_ESP8266_SSID "Mywlan"
      #define MY_ESP8266_PASSWORD "xxxxxxx"
      
      // Enable UDP communication
      //#define MY_USE_UDP
      
      // Set the hostname for the WiFi Client. This is the hostname
      // it will pass to the DHCP server if not static.
      #define MY_ESP8266_HOSTNAME "ESP8266-sensorNode1"
      
      // Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
      //#define MY_IP_ADDRESS 192,168,0,80
      
      // If using static ip you need to define Gateway and Subnet address as well
      //#define MY_IP_GATEWAY_ADDRESS 192,168,0,1
      //#define MY_IP_SUBNET_ADDRESS 255,255,255,0
      
      // The port to keep open on node server mode 
      #define MY_PORT 5003      
      
      // How many clients should be able to connect to this gateway (default 1)
      #define MY_GATEWAY_MAX_CLIENTS 2
      
      // Controller ip address. Enables client mode (default is "server" mode). 
      // Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere. 
      //#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 68
      
      // Enable inclusion mode
      #define MY_INCLUSION_MODE_FEATURE
      
      // Enable Inclusion mode button on gateway
      // #define MY_INCLUSION_BUTTON_FEATURE
      // Set inclusion mode duration (in seconds)
      #define MY_INCLUSION_MODE_DURATION 60 
      // Digital pin used for inclusion mode button
      #define MY_INCLUSION_MODE_BUTTON_PIN  3 
      
       
      // Flash leds on rx/tx/err
      // #define MY_LEDS_BLINKING_FEATURE
      // Set blinking period
      // #define MY_DEFAULT_LED_BLINK_PERIOD 300
      
      // Led pins used if blinking feature is enabled above
      #define MY_DEFAULT_ERR_LED_PIN 16  // Error led pin
      #define MY_DEFAULT_RX_LED_PIN  16  // Receive led pin
      #define MY_DEFAULT_TX_LED_PIN  16  // the PCB, on board LED
      
      #if defined(MY_USE_UDP)
        #include <WiFiUDP.h>
      #else
        #include <ESP8266WiFi.h>
      #endif
      
      #include <MySensors.h>
      
      //-------- DHT22 related definitions ----->>>
      // Set this to the pin you connected the DHT's data pin to
      #define DHTPIN 4
      #define DHTTYPE DHT22   // DHT 22  (AM2302)
      // Set this offset if the sensor has a permanent small offset to the real temperatures
      #define SENSOR_TEMP_OFFSET 0
      
      #define CHILD_ID_HUM 0
      #define CHILD_ID_TEMP 1
      
      float lastTemp;
      float lastHum;
      bool metric = true;
      float temperature;
      
      // Sleep time between sensor updates (in milliseconds)
      // Must be >1000ms for DHT22 and >2000ms for DHT11
      static const uint64_t UPDATE_INTERVAL = 10000;
      
      MyMessage msgHum(CHILD_ID_HUM, V_HUM);
      MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
      DHT dht(DHTPIN, DHTTYPE);
      //<<<----- DHT22 related definitions --------
      
      void setup() { 
         dht.begin();
      }
      
      void presentation() {
          // Send the sketch version information to the gateway
        sendSketchInfo("TemperatureAndHumidity", "1.1");
      
        // Register all sensors to gw (they will be created as child devices)
        present(CHILD_ID_HUM, S_HUM);
        present(CHILD_ID_TEMP, S_TEMP); 
      }
      
      void loop() {
        // Get temperature from DHT library
        temperature = dht.readTemperature();
        wait(2000);
        Serial.print("Temperature:");
        Serial.println(temperature);
        if (isnan(temperature)) {
          Serial.println("Failed reading temperature from DHT!");
        } else if (temperature != lastTemp) {
          // Only send temperature if it changed since the last measurement or if we didn't send an update for n times
          lastTemp = temperature;
      
          // Reset no updates counter
          temperature += SENSOR_TEMP_OFFSET;
          send(msgTemp.set(temperature, 1));
        } 
        // Get humidity from DHT library
        float humidity = dht.readHumidity();
        if (isnan(humidity)) {
          Serial.println("Failed reading humidity from DHT");
        } else if (humidity != lastHum) {
          // Only send humidity if it changed since the last measurement or if we didn't send an update for n times
          lastHum = humidity;
          send(msgHum.set(humidity, 1));
      
        }
        wait(UPDATE_INTERVAL); 
      }
      
      

      Serial log shows:

      รˆยคlรkh$MยดH>hรค?รผ0;255;3;0;9;Starting gateway (RRNGE-, 2.0.0)
      0;255;3;0;9;TSM:INIT
      scandone
      state: 0 -> 2 (b0)
      state: 2 -> 3 (0)
      state: 3 -> 5 (10)
      add 0
      aid 10
      cnt 
      
      connected with Mywlan, channel 9
      dhcp client start...
      0;255;3;0;9;TSM:RADIO:OK
      0;255;3;0;9;TSM:GW MODE
      0;255;3;0;9;TSM:READY
      f r0, scandone
      .....ip:192.168.0.59,mask:255.255.255.0,gw:192.168.0.1
      .IP: 192.168.0.59
      0;255;3;0;9;No registration required
      0;255;3;0;9;Init complete, id=0, parent=0, distance=0, registration=1
      Temperature:nan
      Failed reading temperature from DHT!
      Failed reading humidity from DHT
      pm open,type:2 0
      Temperature:nan
      Failed reading temperature from DHT!
      Failed reading humidity from DHT
      Temperature:nan
      

      It seems that MySensors somehow screws the ESP8266 pinout layout or the normal Adafruit Arduino DHT library won't work correctly with it. If I dump the Mysensor stuff and just use the same Wemos D1 mini board with the same DHT22 sensor and DHT library it shows the temperature/humidity values no problem.

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: Wemos D1 Mini ESP8266 GW Homeassistant connection problem with sensor node

      @hek Thanks again and a very good point there. Mysensors sketch examples have been very useful so far so maybe better to stick with them. One question about the ESP8266 gateways: If I change my sensor node sketch to gateway sketch will the node still act like some kind of a hub? I mean when I'm going to build tens of sensors around the house, I don't want to have too many repeater nodes slowing down the Wifi network.

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: Wemos D1 Mini ESP8266 GW Homeassistant connection problem with sensor node

      Ok, thanks! ๐Ÿ™‚ I thought that a gateway is also needed when using ESP8266. Is there then any idea to use Mysensors with ESP8266 and Homeassistant? Wouldn't it just be better to setup a MQTT server on Homeassistant server and connect sensors directly as MQTT clients to it? I have also some nrf24l01 boards waiting to be implemented. Those would then connect through Mysensors gateway (serial/ethernet).

      posted in Troubleshooting
      Sushukka
      Sushukka
    • RE: Wemos D1 Mini ESP8266 GW Homeassistant connection problem with sensor node

      Yes, they both run on similar Wemos D1 Mini board.

      posted in Troubleshooting
      Sushukka
      Sushukka
    • Wemos D1 Mini ESP8266 GW Homeassistant connection problem with sensor node

      Hello,
      I'm trying to setup my first ESP8266 sensor. I have uploaded the ESP8266 Gateway sketch from Mysensors_master library:

      /**
       * The MySensors Arduino library handles the wireless radio link and protocol
       * between your home built sensors/actuators and HA controller of choice.
       * The sensors forms a self healing radio network with optional repeaters. Each
       * repeater and gateway builds a routing tables in EEPROM which keeps track of the
       * network topology allowing messages to be routed to nodes.
       *
       * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
       * Copyright (C) 2013-2015 Sensnology AB
       * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
       *
       * Documentation: http://www.mysensors.org
       * Support Forum: http://forum.mysensors.org
       *
       * This program is free software; you can redistribute it and/or
       * modify it under the terms of the GNU General Public License
       * version 2 as published by the Free Software Foundation.
       *
       *******************************
       *
       * REVISION HISTORY
       * Version 1.0 - Henrik EKblad
       * Contribution by a-lurker and Anticimex, 
       * Contribution by Norbert Truchsess <norbert.truchsess@t-online.de>
       * Contribution by Ivo Pullens (ESP8266 support)
       * 
       * DESCRIPTION
       * The EthernetGateway sends data received from sensors to the WiFi link. 
       * The gateway also accepts input on ethernet interface, which is then sent out to the radio network.
       *
       * VERA CONFIGURATION:
       * Enter "ip-number:port" in the ip-field of the Arduino GW device. This will temporarily override any serial configuration for the Vera plugin. 
       * E.g. If you want to use the defualt values in this sketch enter: 192.168.178.66:5003
       *
       * LED purposes:
       * - To use the feature, uncomment WITH_LEDS_BLINKING in MyConfig.h
       * - RX (green) - blink fast on radio message recieved. In inclusion mode will blink fast only on presentation recieved
       * - TX (yellow) - blink fast on radio message transmitted. In inclusion mode will blink slowly
       * - ERR (red) - fast blink on error during transmission error or recieve crc error  
       * 
       * See http://www.mysensors.org/build/esp8266_gateway for wiring instructions.
       * nRF24L01+  ESP8266
       * VCC        VCC
       * CE         GPIO4          
       * CSN/CS     GPIO15
       * SCK        GPIO14
       * MISO       GPIO12
       * MOSI       GPIO13
       * GND        GND
       *            
       * Not all ESP8266 modules have all pins available on their external interface.
       * This code has been tested on an ESP-12 module.
       * The ESP8266 requires a certain pin configuration to download code, and another one to run code:
       * - Connect REST (reset) via 10K pullup resistor to VCC, and via switch to GND ('reset switch')
       * - Connect GPIO15 via 10K pulldown resistor to GND
       * - Connect CH_PD via 10K resistor to VCC
       * - Connect GPIO2 via 10K resistor to VCC
       * - Connect GPIO0 via 10K resistor to VCC, and via switch to GND ('bootload switch')
       * 
        * Inclusion mode button:
       * - Connect GPIO5 via switch to GND ('inclusion switch')
       * 
       * Hardware SHA204 signing is currently not supported!
       *
       * Make sure to fill in your ssid and WiFi password below for ssid & pass.
       */
      
      #include <EEPROM.h>
      #include <SPI.h>
      
      // Enable debug prints to serial monitor
      #define MY_DEBUG 
      
      // Use a bit lower baudrate for serial prints on ESP8266 than default in MyConfig.h
      #define MY_BAUD_RATE 9600
      
      // Enables and select radio type (if attached)
      //#define MY_RADIO_NRF24
      #define MY_RADIO_RFM69
      
      #define MY_GATEWAY_ESP8266
      
      #define MY_ESP8266_SSID "Mywlan"
      #define MY_ESP8266_PASSWORD "xxxxxx"
      
      // Enable UDP communication
      //#define MY_USE_UDP
      
      // Set the hostname for the WiFi Client. This is the hostname
      // it will pass to the DHCP server if not static.
      #define MY_ESP8266_HOSTNAME "ESP8266-sensor-gateway"
      
      // Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
      //#define MY_IP_ADDRESS 192,168,0,70
      
      // If using static ip you need to define Gateway and Subnet address as well
      //#define MY_IP_GATEWAY_ADDRESS 192,168,0,1
      //#define MY_IP_SUBNET_ADDRESS 255,255,255,0
      
      // The port to keep open on node server mode 
      #define MY_PORT 5003      
      
      // How many clients should be able to connect to this gateway (default 1)
      #define MY_GATEWAY_MAX_CLIENTS 2
      
      // Controller ip address. Enables client mode (default is "server" mode). 
      // Also enable this if MY_USE_UDP is used and you want sensor data sent somewhere. 
      //#define MY_CONTROLLER_IP_ADDRESS 192, 168, 178, 68
      
      // Enable inclusion mode
      #define MY_INCLUSION_MODE_FEATURE
      
      // Enable Inclusion mode button on gateway
      // #define MY_INCLUSION_BUTTON_FEATURE
      // Set inclusion mode duration (in seconds)
      #define MY_INCLUSION_MODE_DURATION 60 
      // Digital pin used for inclusion mode button
      #define MY_INCLUSION_MODE_BUTTON_PIN  3 
      
       
      // Flash leds on rx/tx/err
      // #define MY_LEDS_BLINKING_FEATURE
      // Set blinking period
      // #define MY_DEFAULT_LED_BLINK_PERIOD 300
      
      // Led pins used if blinking feature is enabled above
      #define MY_DEFAULT_ERR_LED_PIN 16  // Error led pin
      #define MY_DEFAULT_RX_LED_PIN  16  // Receive led pin
      #define MY_DEFAULT_TX_LED_PIN  16  // the PCB, on board LED
      
      #if defined(MY_USE_UDP)
        #include <WiFiUDP.h>
      #else
        #include <ESP8266WiFi.h>
      #endif
      
      #include <MySensors.h>
      
      void setup() { 
      }
      
      void presentation() {
        // Present locally attached sensors here    
      }
      
      
      void loop() {
        // Send locally attached sensors data here
      }
      
      
      

      and it seems to start ok:

      รˆHlรฌร‰`,lEร˜4Hรˆrรฐรบ0;255;3;0;9;Starting gateway (RRNGE-, 2.0.0)
      0;255;3;0;9;TSM:INIT
      0;255;3;0;9;TSM:RADIO:OK
      0;255;3;0;9;TSM:GW MODE
      0;255;3;0;9;TSM:READY
      scandone
      f 0, ....scandone
      state: 0 -> 2 (b0)
      state: 2 -> 3 (0)
      state: 3 -> 5 (10)
      add 0
      aid 5
      cnt 
      
      connected with Mywlan, channel 9
      dhcp client start...
      ......ip:192.168.0.70,mask:255.255.255.0,gw:192.168.0.1
      .IP: 192.168.0.70
      0;255;3;0;9;No registration required
      0;255;3;0;9;Init complete, id=0, parent=0, distance=0, registration=1
      pm open,type:2 0
      

      My sensor sketch looks like this:

      /**
       * The MySensors Arduino library handles the wireless radio link and protocol
       * between your home built sensors/actuators and HA controller of choice.
       * The sensors forms a self healing radio network with optional repeaters. Each
       * repeater and gateway builds a routing tables in EEPROM which keeps track of the
       * network topology allowing messages to be routed to nodes.
       *
       * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
       * Copyright (C) 2013-2015 Sensnology AB
       * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
       *
       * Documentation: http://www.mysensors.org
       * Support Forum: http://forum.mysensors.org
       *
       * This program is free software; you can redistribute it and/or
       * modify it under the terms of the GNU General Public License
       * version 2 as published by the Free Software Foundation.
       *
       *******************************
       *
       * REVISION HISTORY
       * Version 1.0: Henrik EKblad
       * Version 1.1 - 2016-07-20: Converted to MySensors v2.0 and added various improvements - Torben Woltjen (mozzbozz)
       * 
       * DESCRIPTION
       * This sketch provides an example of how to implement a humidity/temperature
       * sensor using a DHT11/DHT-22.
       *  
       * For more information, please visit:
       * http://www.mysensors.org/build/humidity
       * 
       */
      
      // Enable debug prints
      #define MY_DEBUG
      #define MY_NODE_ID 1
      
      // Enable and select radio type attached 
      //#define MY_RADIO_NRF24
      #define MY_RADIO_RFM69
      //#define MY_RS485
      
      #include <SPI.h>
      #include <MySensors.h>  
      #include <DHT.h>
      
      // Set this to the pin you connected the DHT's data pin to
      #define DHTPIN 4
      #define DHTTYPE DHT22   // DHT 22  (AM2302)
      
      // Set this offset if the sensor has a permanent small offset to the real temperatures
      #define SENSOR_TEMP_OFFSET 0
      
      // Sleep time between sensor updates (in milliseconds)
      // Must be >1000ms for DHT22 and >2000ms for DHT11
      static const uint64_t UPDATE_INTERVAL = 10000;
      
      // Force sending an update of the temperature after n sensor reads, so a controller showing the
      // timestamp of the last update doesn't show something like 3 hours in the unlikely case, that
      // the value didn't change since;
      // i.e. the sensor would force sending an update every UPDATE_INTERVAL*FORCE_UPDATE_N_READS [ms]
      static const uint8_t FORCE_UPDATE_N_READS = 10;
      
      #define CHILD_ID_HUM 0
      #define CHILD_ID_TEMP 1
      
      float lastTemp;
      float lastHum;
      uint8_t nNoUpdatesTemp;
      uint8_t nNoUpdatesHum;
      bool metric = true;
      
      MyMessage msgHum(CHILD_ID_HUM, V_HUM);
      MyMessage msgTemp(CHILD_ID_TEMP, V_TEMP);
      DHT dht(DHTPIN, DHTTYPE);
      
      void presentation()  
      { 
        // Send the sketch version information to the gateway
        sendSketchInfo("TemperatureAndHumidity", "1.1");
      
        // Register all sensors to gw (they will be created as child devices)
        present(CHILD_ID_HUM, S_HUM);
        present(CHILD_ID_TEMP, S_TEMP);
      }
      
      
      void setup()
      {
        // Wait for the time of the minimum sampling period to give the sensor time to power up
        // (otherwise, timeout errors might occure for the first reading)
        wait(2000);
      }
      
      
      void loop()      
      {  
        // Get temperature from DHT library
        float temperature = dht.readTemperature();
        if (isnan(temperature)) {
          Serial.println("Failed reading temperature from DHT!");
        } else if (temperature != lastTemp || nNoUpdatesTemp == FORCE_UPDATE_N_READS) {
          // Only send temperature if it changed since the last measurement or if we didn't send an update for n times
          lastTemp = temperature;
      
          // Reset no updates counter
          nNoUpdatesTemp = 0;
          temperature += SENSOR_TEMP_OFFSET;
          send(msgTemp.set(temperature, 1));
      
          #ifdef MY_DEBUG
          Serial.print("T: ");
          Serial.println(temperature);
          #endif
        } else {
          // Increase no update counter if the temperature stayed the same
          nNoUpdatesTemp++;
        }
      
        // Get humidity from DHT library
        float humidity = dht.readHumidity();
        if (isnan(humidity)) {
          Serial.println("Failed reading humidity from DHT");
        } else if (humidity != lastHum || nNoUpdatesHum == FORCE_UPDATE_N_READS) {
          // Only send humidity if it changed since the last measurement or if we didn't send an update for n times
          lastHum = humidity;
          // Reset no updates counter
          nNoUpdatesHum = 0;
          send(msgHum.set(humidity, 1));
      
          #ifdef MY_DEBUG
          Serial.print("H: ");
          Serial.println(humidity);
          #endif
        } else {
          // Increase no update counter if the humidity stayed the same
          nNoUpdatesHum++;
        }
      
        // Sleep for a while to save energy
        wait(UPDATE_INTERVAL); 
      }
      
      

      It seems to somehow sniff the wlan information from gateway as it registers itself to the wlan network:

      TSM:INIT
      TSM:RADIO:OK
      TSP:ASSIGNID:OK (ID=1)
      TSM:FPAR
      TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
      scandone
      state: 0 -> 2 (b0)
      state: 2 -> 3 (0)
      state: 3 -> 5 (10)
      add 0
      aid 6
      cnt 
      
      connected with Mywlan, channel 9
      dhcp client start...
      TSM:FPAR
      TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
      ip:192.168.0.59,mask:255.255.255.0,gw:192.168.0.1
      TSM:FPAR
      TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
      TSM:FPAR
      TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
      !TSM:FPAR:FAIL
      !TSM:FAILURE
      TSM:PDT
      TSM:INIT
      TSM:RADIO:OK
      TSP:ASSIGNID:OK (ID=1)
      TSM:FPAR
      TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
      TSM:FPAR
      TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
      TSM:FPAR
      TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
      TSM:FPAR
      TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
      

      I can see them in my router's DHCP table:

      ESP8266-sensor-gateway	Wireless 192.168.0.70	 	5C:CF:7F:2B:D5:22	 
      ESP_DE24D3	Wireless 192.168.0.59 	18:FE:34:DE:24:D3	 
      

      Gateway continues writing:

      0;255;3;0;9;TSP:SANCHK:OK
      0;255;3;0;9;TSP:SANCHK:OK
      
      

      and client:

      TSM:FPAR
      TSP:MSG:SEND 1-1-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0,ft=0,st=bc:
      

      It seems that whatever serial.print-lines I write on the sensor sketch (in presentation, setup, loop) they never end up to the actual serial log. Don't know why. ๐Ÿ˜ž

      Finally to the Homeassistant. I have defined in configuration.yaml:

      mysensors:
        gateways:
          - device: '192.168.0.70'
            persistence_file: '/home/homeassistant/.homeassistant/mysensors3.json'
            tcp_port: 5003
        debug: true
        optimistic: false
        persistence: true
        retain: true
        version: 2.0
      

      And when starting Homeassistant it says:

      16-11-17 11:48:58 INFO (MainThread) [homeassistant.core] Timer:starting
      16-11-17 11:48:58 INFO (Thread-5) [mysensors.mysensors] Trying to connect to ('192.168.0.70', 5003)
      16-11-17 11:48:58 INFO (Thread-5) [mysensors.mysensors] Connected to ('192.168.0.70', 5003)
      

      But tells nothing more nor comes any updates of my DHT22 sensor in the log.
      This is currently the whole environment. Homeautomation is running correctly on my Raspberry Pi3 and I can access the web interface with no problem. Then there are these two Wemos D1 mini ESP8266 boards currently connected via USB to my laptop. One has nothing but USB cable feeding power (=gateway), other has USB cable + DHT22 sensor connected. DHT22 sensor works as I have tested it alone without Mysensors libraries having a web server running on that Wemos showing the temperature/humidity information on a web page. Running out of ideas, hopefully someone can help. :s

      posted in Troubleshooting
      Sushukka
      Sushukka