Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
ben999B

ben999

@ben999
About
Posts
163
Topics
18
Shares
0
Groups
0
Followers
1
Following
0

Posts

Recent Best Controversial

  • IP phone and beacon
    ben999B ben999

    Hi guys

    Long time no speak but still a MySensors fan !!

    My new project is a bit tougher than expected.

    Here is the thing: landline phones used to be analog type, with some 40v running across the wires... adding a beacon for noisy environment was a breeze, just plug it in and whenever a call comes in the beacon picks the signal and rings.

    My country has now moved to digital signal, IP i would say (please correct me if wrong terminology).
    So now the phone is connected at the back of optic fiber internet box (modem) via RJ45 plug.

    Needless to say that analog beacon has become useless. Beacon manufacturers have not yet moved their tech towards IP protocol.

    Have you ever bumped into that kind of challenge ? :grin:

    I have a spare W5100 in the drawer... would it be able to access to the phone data, to check whether it's ringing ?

    Hope you get the picture and you can show me the way forward :+1:

    General Discussion

  • openHAB 4 MySensors Binding
    ben999B ben999

    @niccodemi I am no expert and am having a tough time with these files as well !!!

    My .things file looks like so :

    Bridge mqtt:broker:mosquitto "MySensorsGateway"@"Home" [host="openhabian", port="1883", secure=false]
    {
    	Thing topic garageDoor01 "Garage"@"Basement" {
    		Channels:
    			Type contact :	garageDoor01switch	[stateTopic="mysensors-out/19/1/1/0/16", transformationPattern="MAP:contact.map"]
    			Type datetime : garageDoor01switch_LastUpdate
    	}
    

    As far as i understand, you're missing that "linktopic" descrption...

    OpenHAB

  • openHAB 4 MySensors Binding
    ben999B ben999

    Hi @zkarolyi

    I can not provide any help on that matter as i went the MQTT way.

    The binding for serial gateway requires loads of work from the MySensors dev team; so it might tatke a while before it becomes available (if it does all together). I really appreciate all the effort put into this but i also understand that it might come to an end someday. No matter how much i prefer the serial gateway over MQTT... i ended up in the mqtt team

    Back to your issu : the jar file might not be compatible with OH4

    OpenHAB

  • openHAB 4 MySensors Binding
    ben999B ben999

    @mfalkvidd Genius !!! :open_mouth:

    OpenHAB

  • openHAB 4 MySensors Binding
    ben999B ben999

    Hello there
    I thought it would be a good idea to upgrade my system to openHAB4, as i wanted to play with my security cameras linked to a Synology NAS system...
    Well it didn't go according to plan.
    First openhabian had to be upgraded from Buster to Bullseye in order to get Java from 11 to 17. Then Java got upgraded, By that time MySensors stopped working. So i started over with a fresh install of MySensors. All went well until

    make
    
    hal/architecture/Linux/drivers/core/GPIO.cpp: In constructor ‘GPIOClass::GPIOClass()’:
    hal/architecture/Linux/drivers/core/GPIO.cpp:53:50: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 48 [-Wformat-truncation=]
       53 |    snprintf(file, sizeof(file), "/sys/class/gpio/%s/base", de->d_name);
          |                                                  ^~
    hal/architecture/Linux/drivers/core/GPIO.cpp:53:12: note: ‘snprintf’ output between 22 and 277 bytes into a destination of size 64
       53 |    snprintf(file, sizeof(file), "/sys/class/gpio/%s/base", de->d_name);
          |    ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    hal/architecture/Linux/drivers/core/GPIO.cpp:62:50: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 48 [-Wformat-truncation=]
       62 |    snprintf(file, sizeof(file), "/sys/class/gpio/%s/ngpio", de->d_name);
          |                                                  ^~
    hal/architecture/Linux/drivers/core/GPIO.cpp:62:12: note: ‘snprintf’ output between 23 and 278 bytes into a destination of size 64
       62 |    snprintf(file, sizeof(file), "/sys/class/gpio/%s/ngpio", de->d_name);
          |    ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    g++ -MT build/hal/architecture/Linux/drivers/core/interrupt.o -MMD -MP -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard -DMY_RADIO_RF24 -DMY_GATEWAY_LINUX -DMY_GATEWAY_MQTT_CLIENT -DMY_DEBUG -DLINUX_SPI_BCM -DLINUX_ARCH_RASPBERRYPI -DMY_MQTT_CLIENT_ID=\"impassedesroses\" -DMY_MQTT_SUBSCRIBE_TOPIC_PREFIX=\"mysensors-in\" -DMY_MQTT_PUBLISH_TOPIC_PREFIX=\"mysensors-out\" -DMY_RF24_PA_LEVEL=RF24_PA_LOW -DMY_CONTROLLER_IP_ADDRESS=127,0,0,1  -Ofast -g -Wall -Wextra -std=c++11 -I. -I./core -I./hal/architecture/Linux/drivers/core -I./hal/architecture/Linux/drivers/BCM -c hal/architecture/Linux/drivers/core/interrupt.cpp -o build/hal/architecture/Linux/drivers/core/interrupt.o
    hal/architecture/Linux/drivers/core/interrupt.cpp:33:10: fatal error: stropts.h: No such file or directory
       33 | #include <stropts.h>
          |          ^~~~~~~~~~~
    compilation terminated.
    make: *** [Makefile:99: build/hal/architecture/Linux/drivers/core/interrupt.o] Error 1
    
    

    Please advise if i should start over from the very begenning (fresh SD) or just stick with openHAB 3 (but soon or later it will be superseeded)

    Thanks a lot for your time people.

    OpenHAB

  • Microwave oven (no kidding :D)
    ben999B ben999

    @skywatch great, thanks a lot for your suggestion. A bit of research on the internet educated me about these diodes :D looks like they already exist on the board that carries the relay. However, i deeply thank you for the info. This forum and internet in general is such a powerful tool :+1:

    @ejlane your concern is fully justified :+1: i also come from an engineering background and i like to think "worse case scenario".
    The more one look the more one find that the very vast majority or microwave ovens work the same way : there are 3 industrial switches built in the door lock. 2 of them are cabled on the "power side", one is for signaling ("software side"). So we are pretty safe on that matter.
    But you are so right about safety. Magnetron do emitt dangerous waves and capacitors and stuff packed in the oven can be deadly because of high voltage.

    Thanks both for suggestions. I will come back with updated sketches and beg for advice once more ;)

    Hardware

  • Microwave oven (no kidding :D)
    ben999B ben999

    Hi guys,

    My microwave oven broke down last month.

    Not only it's a pain in the backside but it is also more waste for the planet.

    A quick search on the internet educated me about safety and how to test parts.

    Turns out the main board is dead (display works fine, most buttons too but "start" and "stop" buttons are useless).

    New motherboard is difficult to source and is no more available from manufacturer (i bought it 2 years ago but must have been some fairly old design... :face_with_rolling_eyes: )

    So back to drawing board and soldering iron:

    • arduino nano
    • 2.8" TFT colour display
    • rotary encoder
    • salvage "power board" from microwave (gives 12V and 5V)

    I am pretty well on my way design-wise and need a final advice on transistors ; following are 2 arrangements regarding what i would call the "oven door transistor" (the bottom PNP one).
    The 3 NPN transistors at the top drive a relay each one (magnetron, plate and heating resistance). Each transistor is driven by the arduino via a resistor.

    Please accept my apologies if any of my sketches make your eyes bleed. :grin:

    Which one would be the least bad and how could it be improved.

    Thanks a lot for reading :+1:

    EDIT: Sketches drawn with https://www.falstad.com

    1.JPG

    2.JPG

    Hardware

  • MQTT losing messages...
    ben999B ben999

    @JeeLet
    @OldSurferDude

    Thank you both :+1:

    My Raspberry 3 does it all :

    • gateway with nrf24 module (standard one)
    • mysensors MQTT gateway
    • Mosquitto broker

    MQTT Explorer has been installed on my fav laptop and it helps seeing clearer.

    Nevertheless i cannot reproduce the errors.

    I have multiple points of view:

    • node : using arduino ide serial monitor
    • mysensors gateway: using tail log in a terminal window
    • openHab : using tail log in an internet explorer window
    • MQTT explorer : in its own window

    I can sent MQTT messages from different devices :

    • iOS openhab from my phone
    • openhab (basic UI) from an internet explorer window
    • MQTT explorer (messages can be made-up, very cool tool)
    • terminal window (linux laptop via ssh)

    The less reliable way of sending MQTT message is via terminal : after 2 to 10 succesfull messages it then stops working. At first, node receives messages and processes them (servo moves). But after a few messages, node doesn't receive anymore. MQTT Explorer shows the change of state of the topic but message doesn't go anyfurther... no other monitor show a change.

    @OldSurferDude i'm not sure i understand

    Each node should be sending messages to its own topic.

    Can the mysensor gateway subscribe to more than one topic (which is mysensors-in at the mo) ?

    Thanks a lot for helping me through :blush:

    OpenHAB

  • MQTT losing messages...
    ben999B ben999

    @JeeLet thanks a lot for your message

    You're right :

    • openhab 3
    • Raspberry Pi 3 MQTT gateway with Mosquitto
    • arduino nodes
    • nRF24 network

    TBH i don't know where to start, so difficult to point a finger...

    OpenHAB

  • MQTT losing messages...
    ben999B ben999

    Hi guys,

    Long story cut short :

    I've had lots of "temporary gone bad nodes" since migrating from serial to mqtt.

    Nodes that are normally working fine but then stop responding (most annoying being the one driving the garage door motor :scream: i now keep a key anytime with me instead of just relying on openHab...). A reboot cures it.

    So i decided to design a simple logger with arduino + sd card + rtc.

    Beside that i am also designing an automatic cat flap locking node, so cats dont go out at night. As i dont want any rtc on that node, i rely on time supplied by controller with requestTime(). So here i am trying to understand how to send that request to controller via mqtt by sending publications...

    That's how i discovered that many publications are lost.

    What do you suggest to investigate further ? I might have reached my limits... :grimacing: some help would be welcome :+1:

    Thanks a lot :blush:

    OpenHAB

  • nrf24+ module with stick antenna
    ben999B ben999

    @skywatch oh great :+1: thanks for that !

    by removing the smd then the signal becomes "compatible" with a 2.4ghz stick antenna ?

    or shall i go with wire and adjust length ?

    Thanks everyone :)

    Hardware

  • nrf24+ module with stick antenna
    ben999B ben999

    @NeverDie thanks a lot for taking so much time for your answer :+1:

    Your explainations pushed my thinking a bit further. I now understand that i can't just solder a 2.4ghz stick antenna in-lieu of a "trace" antenna just because it is a 2.4ghz board... am i right ?

    The main reason for my post is that i need to have a remote antenna.
    And i also wanted to keep clear of Power Amplified modules as their power consumption is too high for my needs (tiny LiPo and solr panel)

    And i also wanted to use what's in the drawer ;)

    I shall then turn to nrf modules with external antenna. Usual one are difficult to get now. But it seems there are newer ones out there (at least their layout seems new to me) :

    nrf.JPG

    Anyone tried yet ?

    Anyway, thanks a lot for making things clearer :blush:

    Hardware

  • nrf24+ module with stick antenna
    ben999B ben999

    Hi Guys,

    I would like to connect a stick antenna to a basic nrf24L01+ module.

    Please note that i do not need any additional range.

    The reason i'm asking is because the nrf is surrounded by metal, copper traces and battery...

    So getting the antenna out of the housing might help.

    I have an SMA connector handy and a stick antenna as well.

    My main question is about soldering the coax cable :

    hack.JPG

    1 -shall i cut the trace as stated in numerous hacksites ?
    2 - shall i solder the inner conductor where the blue arrow is ?
    3 - shall i solder the outer connector (shield?) where the red arrow is ? or is it best to scratch underside of board and solder straight into ground plane ? but then that reveals more inner connector length, thus next question...

    What is the importance of the length of "naked" inner conductor where the insulation will be cut ?

    Thanks a lot for your help, comments of any sort are welcome ;)

    Hardware

  • Smart doorbell
    ben999B ben999

    @adamf663 sorry for delay! I am focusing on mostly software at the moment. So nothing to show so far ;) i'll be posting as soon as the project moves forward again :+1: please read on !!!

    @MasMat thanks a lot for your suggestions. As suggested first it is more than probably a case of rights/permissions.

    There are many ways to launch a script at startup but in my case some deamons were started via "root" and some others via "user".
    As stated before, all worked perfectly when logged under "user" (pi).
    So, to summarise:

    • rc.local didn't work
    • crontab didn't work
    • .bashrc didn't work
      These might work in the end but i'm not brainy enought to get to it.

    Then came "systemctl" !
    First create a .service file

    $ sudo nano  /etc/systemd/system/doorbell.service
    
    [Unit]
    Description=My test service
    After=multi-user.target
    [Service]
    Type=simple
    Restart=always
    ExecStart=/usr/bin/python /home/pi/doorbell02.py
    [Install]
    WantedBy=multi-user.target
    #WantedBy=default.target    -> test this if previous doesn't work
    

    Reload all daemons to check if your new .service file is ok
    Then allow your new service file to be loaded at boot
    Last, check if loading worked. If status returns "active" then it's a win :+1:

    $ sudo systemctl daemon-reload
    $ sudo systemctl --user enable doorbell.service
    $ sudo systemctl --user start doorbell.service
    $ systemctl --user is-active doorbell.service
    

    Last step: systemctl loads these services at loggin by default (as in : enter user and password). I need it to start automaticaly with no human input. systelctl offers a way to load services without loggin for a given user :

    $ loginctl user-status pi
    

    Check status with

    $ loginctl user-status pi
    

    If status returns "linger: yes" then it's (once again) a win :+1:

    Thanks again @MasMat for suggesting paths to investigate

    That's it for now, i'll be back on the hardware point of view next time !

    My Project

  • Smart doorbell
    ben999B ben999

    Hi @MasMat

    Thanks a lot for your suggestions ! You DO talk like a linux ninja though :D

    I'll have a go at these :+1:

    First let's try to understand :

    -fstab has multiple credentials currently

    what do you mean and how does this affect my "share"? I am very eager to understand. (although this part of my project is doing fine)

    did you have multiple pythons? (bbt.py, doorbell.py?)

    Sorry, no. My mistake. I tried to sanitise that post and forgot some dirt ;) only "doorbell.py running. Initial message corrected now.

    the launcher I believe has unnecessary lines (the changing directories)

    Ok i'll get that cleaned up

    crontab: why do "sudo crontab -e"? Would using just "crontab -e" use pi-users crontab and have less conflicting permissions?

    Ok i'll have a go as well, it makes sense. Trouble is i tend to put "sudo" everywhere so it kinda "forces" things to go as i planned them... not necessarily clever i agree... :/

    I let you know tonight

    Would you have a suggestion on how to debug this script running in the background ? I tried pdb but it messes things up (starts multiple instances of doorbell.py... camera is constantly taking pictures, whole thing goes crazy) There must be some log of some sort that gets error message from programs running in background ?

    Thank you ever so much for spending time here. I'm really stuck now (been 2 weeks) and i really appreciate your effort here :+1:

    My Project

  • Smart doorbell
    ben999B ben999

    My openhab is setup via files.

    I had some hard time discovering MQTT which was new to me and setging up openhab as it changed quite a lot since version 2.

    So here are my files, gin case it might help someone sometime :

    "items" file :

    Switch		doorBell01state	"Door Bell"              <alarm>	 {channel="mqtt:topic:mosquitto:doorBell01:doorBell01state"}
    

    "things" file :

    Bridge mqtt:broker:mosquitto "MySensorsGateway"@"Home" [host="192.168.1.20", port="1883", secure=false]
    {
    Thing topic doorBell01 "Door Bell"@"Front Gate" {
                    Channels:
                            Type switch :   doorBell01state         [stateTopic="doorbell/50/1/0/0/1", transformationPattern="MAP:onoff.map"]
            }
    }
    

    "rules" file :

    rule "frontgate bell ringing"
    when
             Item doorBell01state changed to ON
    then
            sendBroadcastNotification("Someone ringing at da gate!")
    end
    

    "map" file : (needed because i cant cope with types, numbers, decimals, values, ... so i tried many tricks and that one worked)

    0=OFF
    1=ON
    
    My Project

  • Smart doorbell
    ben999B ben999

    Hello World ;)

    Here is my latest project, near completion: smart doorbell.

    Old raspberry 1B connected to the regular RaspiCam V1 and a push button.

    As soon as pushbutton is pressed :

    • RPi sends an MQTT message to network
    • Cam takes a picture and stores it to my local NAS
    • Gateway sends a notification all my portable devices connected to openHAB
    • RPi sends and email with picture attached

    This post has 2 goals :

    • share my findings. My house was until now still relying on openhab2 and mysensors binding. All working very happily. But there was no direct answer to get a raspberry to behave as a MySensor device and talk directly to the gateway. It was also time to move to openhab3. I was then advised to have a go at MQTT. So be it !!!
    • get some help linux-wise for completion of this project.

    I had to learn new tricks along the way... like mounting a network drive to the RPi. It's kind of linking/sharing a folder between my NAS and my RPi. If a file is dropped into that "mounted folder" it then appears on each device. Magic :+1:
    To do so edit your fstab file

    $ sudo nano /etc/fstab
    

    and add something like :

     //192.168.1.77/home/DoorBell     /home/pi/doorbell/ cifs vers=2.0,username=username,   password=passwordthatgoeswithit,credentials=/home/pi/doorbell .smbcred,noauto,x-systemd.automount 0 0
    

    I have tested this setup both at work and at home. I had to remove "credentials" and everything after at home as i could never get it to work (got some errors). I also had to change from "vers=3.0" to "vers=2.0". Googling never got me a real explanation...

    This is my python script, working as it should :

    import os
    import subprocess
    from datetime import datetime
    from gpiozero import Button
    
    button = Button(17)
    
    while True:
            button.wait_for_press()
            os.system('mosquitto_pub -h openhabian -t doorbell/50/1/0/0/1 -m "1"')
            time = datetime.now()
            filename = "capture-%04d%02d%02d-%02d%02d%02d.jpg" % (time.year, time.month, time.day, time.hour, time.minute, time.second)
            subprocess.call("raspistill -t 500 -o %s" % filename, shell=True)
    	subprocess.call("echo '' | mutt -s 'Someone ringing !' -i messageBody.txt myemailaddress@someprovider.com -a %s" % filename, shell=True)
            os.system('sudo /home/pi/movefile.sh')
            os.system('mosquitto_pub -h openhabian -t doorbell/50/1/0/0/1 -m "0"')
    

    The picture is stored with a convenient name (date and time) like so : capture-20210910-224322.jpg
    mutt is some simple, cool and efficient mailing program.
    messageBody.txt is a plain text file containing the body of the generic email.
    movefile.sh is a script that moves the jpg file from RPi's SD card up to NAS shared folder once the email has been sent.

    As i said previously it's all working as intended with

    $ python doorbell.py
    

    Next step is to get that python script to be launched at startup. A job for cron:

    $ sudo nano launcher.sh
    
    	#!/bin/sh
    	# launcher.sh
    	# navigate to home directory, then to this directory, then execute python script, then back home
    	cd /
    	cd home/pi
    	sudo python doorbell.py
    	cd /
    
    $ chmod 755 launcher.sh
    $ sh launcher.sh
    $ mkdir logs
    $ sudo crontab -e
    

    add this to file :

    @reboot sh /home/pi/launcher.sh >/home/pi/logs/cronlog 2>&1
    
    $ sudo reboot
    

    Quick check at logfile to make sure it all went well:

    $ cat logs/cronlog
    

    From then the email part of my script doesn't work anymore.
    Trouble with rights ?

    ps aux
    

    returns that launcher.sh belongs to root but python script belongs to pi :

    root       475  0.0  0.0      0     0 ?        S    16:51   0:00 [cifsd]
    root       500  0.0  0.6   7932  2300 ?        Ss   16:51   0:00 /usr/sbin/cron -f
    root       502  0.0  0.6   9452  2384 ?        S    16:51   0:00 /usr/sbin/CRON -f
    root       506  0.0  0.3   1924  1148 ?        Ss   16:51   0:00 /bin/sh -c sh /home/pi/launcher.sh >/home/pi/logs/cronlog 2>&1
    root       511  0.0  0.2   1924  1108 ?        S    16:51   0:00 sh /home/pi/launcher.sh
    root       513  1.5  2.5  34348  9728 ?        Sl   16:51   4:25 python doorbell02.py
    root       514  0.0  0.3  27640  1364 ?        SLsl 16:51   0:00 /usr/sbin/rngd -r /dev/hwrng
    root       525  0.0  0.4   4292  1588 tty1     Ss+  16:51   0:00 /sbin/agetty -o -p -- \u --noclear tty1 linux
    root       527  0.0  0.4   6600  1852 ?        Ss+  16:51   0:00 /sbin/agetty -o -p -- \u --keep-baud 115200,38400,9600 ttyAMA0 vt220
    root       757  0.0  1.6  12224  6228 ?        Ss   16:53   0:00 sshd: pi [priv]
    pi         760  0.0  1.8  14584  7072 ?        Ss   16:53   0:00 /lib/systemd/systemd --user
    

    Does it ring a bell to anyone ?

    Thanks a lot for your help guys!

    My Project

  • Raspberry as a node (bis)
    ben999B ben999

    @Yveaux :+1: thank you

    :D here you are talking once again a weired language :D

    Ok i'll dig what MQTT can do for me. How does the piece of data (someone pushed the doorbell button) gets from RPi to openhab ? Does it stay local within the LAN (and gets directly to my gateway) or does it have to travel through internet up to openhab and down again to my gateway (remember, my bell has to ring) ?

    So last question just to be sure : it is not common practice to use RPi as a node ? And there is no "sketch" ready made that can be tweaked ?

    Thanks a lot for your time, i really appreciate it ;)

    Hardware
  • Login

  • Don't have an account? Register

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