(Rpi Zero W + CC1101)-based receiver for wireless thermometers

Status du project
Date de début automne 2019
Fin tôt en 2020
Status DONE!
Initiateur Magnus

Let us make more use of the the on-board green power/status LED!

See also: - -

Add these lines to /boot/config.txt:

# disable status led

Then, here a small python script to use it:
import warnings
import logging
from gpiozero import LED,PinNonPhysical
warnings.simplefilter('ignore', category=PinNonPhysical)
class ActivityLED:
    def __init__(self):
        if not '[none]' in open('/sys/class/leds/led0/trigger','r').read():
            logger.warn('LED trigger not set to none...')
    def blink(self):
if __name__=='__main__':
    import time

I am using Eclipse Mosuitto a local MQTT broker, setting up a bridge to the This decouples their web service quite nicely from my other listener (an e-ink display in the corridor). The config was quite some trial and error, so here what eventually works (modulo the XXXX):

# Bridge to Adafruit.IO
# see:
# and better:
connection cc1101hub
bridge_attempt_unsubscribe false
cleansession false
notifications false
remote_username magnustron
remote_password XXXX
start_type automatic
try_private false
topic "" out 0 cc1101hub/terrasse/temperature magnustron/feeds/terrasse-temperature 
topic "" out 0 cc1101hub/salon/temperature    magnustron/feeds/salon-temperature
topic "" out 0 cc1101hub/salon/humidite       magnustron/feeds/salon-humidite 
topic "" out 0 cc1101hub/enfants/temperature  magnustron/feeds/enfants-temperature
topic "" out 0 cc1101hub/enfants/humidite     magnustron/feeds/enfants-humidite 
topic "" out 0 cc1101hub/chambre/temperature  magnustron/feeds/chambre-temperature 
topic "" out 0 cc1101hub/chambre/humidite     magnustron/feeds/chambre-humidite
topic "" both 0 test     magnustron/feeds/test

My home router seems to require a reconnection from time to time. Running this script every five minutes from cron works for that (note that it typically needs to be run as root, i.e. to be added to cron via:

sudo crontab -e
# see:
# to crontab (via "sudo crontab -e"):
# */5 * * * * /home/pi/ 2>&1 | logger -t
echo "Performing Network check for $wlan"
/bin/ping -c 2 -I $WLAN $PING_IP_ROUTER
if [ $? -ge 1 ] ; then
    echo "${WLAN} seems to be down somewhat. Attempting reconnection."
    /sbin/ifconfig $WLAN down
    /bin/sleep 5
    /sbin/ifconfig $WLAN up
    echo "${WLAN} is okay"

No need for HDMI here. Add this to /etc/rc.local:

# disable HDMI (save energy)
/usr/bin/tvservice -o
  • projects/electronics/tfa-whub-cc1101.txt
  • Dernière modification: 2020/04/05 22:47
  • de magnustron