Posts

Showing posts from November, 2017

Towards a better doorbell...

Image
Something we struggle with as a household is the front door bell. We have a wireless pushbutton at the door, with three (3) separate mains or battery-powered devices listening and responding to make sure there's one in earshot. However, the button's range is limited within the house by walls and other things, so it's hard to make sure a) the responders are in range b) they are close enough for us to hear! How about a doorbell that sends a text to the phone? Perfectly possible, surely. Stick an ESP8266 in the closest responder (mains-powered) that looks for the signal to ring the bell on one of its GPIO pins; this has to be possible surely! Have ESP8266 publish an MQTT "front door bell rung" message  Have a Node RED node listen for this and trigger whatever we fancy on its receipt e.g. A text message to one or more phones (handy if we're out, actually) An indicator to a camera  A Klaxon at the back of the house BAR-BAR-BAR ALERT!! Cool. 1 looks

Node-red and mosquitto together - some fiddling about

Image
Node-red is amazingly powerful, and relatively easy to do things with. I've now set up Node-red on the RPi3 server, and also the MQTT broker mosquitto . Here's the Node-red browser display: Node-red display in my browser I've configured: An MQTT Broker input node, connected to... This is subscribed to the topic "test/myTopic"  A debug node, configured to display the msg.payload Which can be viewed in the "debug" tab on the right pane An HTTPRequest node, configured to the URL /myTestHTTPRequest, connected to... i.e. accessed via http://server.local:1880/myTestHTTPRequest A JavaScript function node, which creates a msg.payload with the JS date/time, connected to... An HTTPResponse node, which returns the input date/time string to the HTTP requester  And astonishingly, it all works! Very cool.  I am very impressed by the range of node types available, including  Various protocol inputs/outputs (MQTT, tcp, udp, HTTP) Lots

MQTT Broker - mosquitto

I just installed mosquitto using brew - went fine apart from the error at the end: Macintosh-Gouk:~ john$ brew link mosquitto Linking /usr/local/Cellar/mosquitto/1.4.14_2...  Error: Could not symlink share/man/man5/mosquitto.conf.5 /usr/local/share/man/man5 is not writable. The  obvious  suggestion, since I have no  intent  of  using   another user for this kind of work, was to change the permissions on /usr/local : Macintosh-Gouk:~ john$ sudo chown -R $(whoami) /usr/local Password: Macintosh-Gouk:~ john$ brew link mosquitto Linking /usr/local/Cellar/mosquitto/1.4.14_2... 25 symlinks created Did the trick.  /usr/local/sbin/mosquitto -c /usr/local/etc/mosquitto/mosquitto.conf   Now  let's check it's working... Terminal1:  mosquitto_sub -h 127.0.0.1 -t mynewtopic Eat my shorts Terminal2:  mosquitto_pub -h 127.0.0.1 -t mynewtopic -m 'Eat my shorts' At some point I'll want maybe to make it run on startup Prepare mo

Sonoff Basic wifi-enabled mains controller

Image
Controller with case on The board I've lashed out on a couple of Sonoff Basic wifi-enabled mains switches  - mine didn't come with the IP66 case, because I got it from Banggood who sell them for £4.xx including postage, which is ridiculous! Clearly nobody wants to use a proprietary app and a Cloud-based control package to control their home, that would be mad. Wouldn't it? Itead expect you to do that, and I might have a go with it if I fancy it. However, the dreaded scargill.net has suggestions for reprogramming the included ESP8266 chip so it can be easily controlled using MQTT. Hurray! However, his software can't be upgraded OTA (Over The Air) i.e. from a (local or remote) website because it takes up too much of the precious FLASH in the old-style chips used in these devices. I have found this alternative instead, which offers OTA and MQTT, and uses the Arduino IDE which I already have. All I have to do now is get from USB to Serial i.e. use an FTDI chi

Useful Scargill links

Home Control 2017 ESP8266 Flashing Facebook ESP8266 page Code repository  Alternative ESP-01 Sonoff MQTT code Sonoff-Tasmota Wiki SHT30 note  - I have just ordered 5-6 of these! EMONCMS  - interesting, but requires lots of RPi changes, a USB HDD root drive and MySQL installed :-(

Node-red experiments

Image
I've been looking at the tech.scargill.net website, which is a fount of all ESP8266 knowledge. His recommendation is to use Node-red to setup IoT networks based on MQTT, so I've installed it on my Mac, using the instructions at this location . Seems to work ok - I went to nodejs.org and installed 8.9.1 LTS, then did  sudo npm install - g -- unsafe - perm node - red.  There were some deprecated warnings on the install, about versions being out of date, but I have to assume that node-red uses those, so little chance to modify/alter. npm WARN deprecated i18next-client@1.10.3: you can use npm install i18next from version 2.0.0 npm WARN deprecated nodemailer@1.11.0: All versions below 4.0.1 of Nodemailer are deprecated. See https://nodemailer.com/status/ npm WARN deprecated node-uuid@1.4.8: Use uuid module instead /usr/local/bin/node-red-pi -> /usr/local/lib/node_modules/node-red/bin/node-red-pi /usr/local/bin/node-red -> /usr/local/lib/node_modul