ポカヨケ

Poka-yoke (ポカヨケ, [poka yoke]) is a Japanese term that means “mistake-proofing” or “inadvertent error prevention“. A poka-yoke is any mechanism in any process that helps an equipment operator avoid (yokeru) mistakes (poka). Its purpose is to eliminate product defects by preventing, correcting, or drawing attention to human errors as they occur.[1] The concept was formalised, and the term adopted, by Shigeo Shingo as part of the Toyota Production System.[2][3] It was originally described as baka-yoke, but as this means “fool-proofing” (or “idiot-proofing“) the name was changed to the milder poka-yoke.

https://en.m.wikipedia.org/wiki/Poka-yoke

Only in Japan

When you are searching the internet for more information and things to learn about Japan you will inevitably also find John Daub and his “Only in Japan” productions. And that is a good thing!

ONLY in JAPAN is a series produced in Tokyo by one-man band John Daub.  

Only in Japan Patreon page

Back in 2018 we even where around when John announced that he is going to live-stream.

And so we met up with him and eventually even said “Hi”.

this is John in full gear

Of course it wasn’t just us who got a good picture. We were part of the live stream as well – involuntarily as we had tried very hard to not be in frame.

pushing your myfitnesspal data to MQTT

MyFitnessPal is a great online service we are using to track what we eat. It’s well integrated into our daily routine – it works!

Unfortunately MyFitnessPal is not well set-up to interface 3rd party applications with it. In fact it appears they are actively trying to make it harder for externals to utilize the data there.

To access your data there’s an open source project called “python-myfitnesspal” which allows you to interface with MyFitnessPal from the command line. This project uses web-scraping to extract the information from the website and will break everytime MyFitnessPal is changing the design/layout.

Since the output for this would be command line text output it is not of great use for a standardized system. What is needed is to have the data sent in a re-useable way into the automation system.

This is why I wrote the additional tool “myfitnesspal2mqtt“. It takes the output provided by python-myfitnesspal and sends it to an MQTT topic. The message then can be decoded, for example with NodeRed, and further processed.

As you can see in the image above I am taking the MQTT message coming from myfitnesspal2mqtt and decoding it with a bit of javascript and outputting it back to MQTT.

var complete = {};
var sodium = {};
var carbohydrates = {};
var calories = {};
var daydate = {};
var fat = {};
var sugar = {};
var protein = {};

var weight = {};
var bodyfat = {};


var goalsodium = {};
var goalcarbohydrates = {};
var goalcalories = {};
var goalfat = {};
var goalsugar = {};
var goalprotein = {};

var caloriesdiff = {};

var ttopic = msg.topic.toLowerCase();

var firstobject = Object.keys(msg.payload)[0];

complete.payload = msg.payload[firstobject].complete;
complete.topic = ttopic+'/complete';

sodium.payload = msg.payload[firstobject].totals.sodium;
sodium.topic = ttopic+'/total/sodium';
carbohydrates.payload = msg.payload[firstobject].totals.carbohydrates;
carbohydrates.topic = ttopic+'/total/carbohydrates';
calories.payload = msg.payload[firstobject].totals.calories;
calories.topic = ttopic+'/total/calories';
fat.payload = msg.payload[firstobject].totals.fat;
fat.topic = ttopic+'/total/fat';
sugar.payload = msg.payload[firstobject].totals.sugar;
sugar.topic = ttopic+'/total/sugar';
protein.payload = msg.payload[firstobject].totals.protein;
protein.topic = ttopic+'/total/protein';

weight.payload = msg.payload[firstobject].measurements.weight;
weight.topic = ttopic+'/measurement/weight';
bodyfat.payload = msg.payload[firstobject].measurements.bodyfat;
bodyfat.topic = ttopic+'/measurement/bodyfat';

goalsodium.payload = msg.payload[firstobject].goals.sodium;
goalsodium.topic = ttopic+'/goal/sodium';
goalcarbohydrates.payload = msg.payload[firstobject].goals.carbohydrates;
goalcarbohydrates.topic = ttopic+'/goal/carbohydrates';
goalcalories.payload = msg.payload[firstobject].goals.calories;
goalcalories.topic = ttopic+'/goal/calories';
goalfat.payload = msg.payload[firstobject].goals.fat;
goalfat.topic = ttopic+'/goal/fat';
goalsugar.payload = msg.payload[firstobject].goals.sugar;
goalsugar.topic = ttopic+'/goal/sugar';
goalprotein.payload = msg.payload[firstobject].goals.protein;
goalprotein.topic = ttopic+'/goal/protein';

caloriesdiff.payload = msg.payload[firstobject].goals.calories - msg.payload[firstobject].totals.calories;
caloriesdiff.topic = ttopic+'/caloriedeficit';

daydate.payload = firstobject;
daydate.topic = ttopic+"/date";

return [complete, sodium, carbohydrates, calories, fat, sugar, protein, weight, bodyfat, goalsodium, goalcarbohydrates, goalcalories, goalfat, goalsugar, goalprotein, daydate, caloriesdiff];

In the end it expands into a multitude of topics with one piece of information per MQTT topic.

And with just that every time the script is run (which I do in a docker container and with a cronjob) the whole lot of pieces of information about nutrition and health stats are being pushed and stored in the home automation system.

This way they are of course also available to the home automation system to do things with it.

Like locking the fridge.

blocking ads and promotions on twitter

When a group of people with the same problem meets, they work together and sometimes do an experiment.

Nobody likes ads or “promotional content”.

At some point Twitter chose to push ads in the official Twitter client into every timeline and decided to make them look like normal timeline content.

It did not take long for a group of people that do not like that to meet and join forces: Since about a week now a very small group of people has taken their Twitter block lists and merged them using the Block Together service.

This experiment great since it’s completely effortless. You link your block lists once and from thereon you keep using Twitter like you always did. Whenever you see a paid promotion you “block it”. Everybody from thereon will not see promotions and timeline entries from this specific Twitter user (unless you would actively follow them).

17326 accounts blocked! Wow! I started with about 3500 before merging with others.

And the effect after about a week is just great! I cannot see a downside so far but the amount of promotion content on my timeline has shrunk to a degree where I do not see any at all.

This is a great way to get rid of content you’ve never wanted and focus on the information you want.

more japanese pun

A couple of days ago I wrote about a Japanese pun I came across while surfing and doing language learning. I wanted to know more about how these kind of language-tricks work in Japan. And this is what I’ve found:

“Japanese puns, or 駄洒落 (dajare), can be not only groan- or laughter-inducing, but they can also help you improve both the depth and breadth of your language ability.”

Dajare: 13 types of Japanese puns.

This assortment of fun has been put together by Tofugu. A seemingly comprehensive website around the japanese language. It’s even got a podcast!

staying in Tokyo off-center (武蔵小杉)

Ever since I’ve first visited Tokyo in 2012 I fell in love with country, culture and the city. On average I was there 4 times a year to do business.

After leaving Rakuten I went back to Tokyo for a vacation together with my wife in October 2017. The idea was to show her what I was enthusiastically mumbling about all the time when I came back from Japan.

When staying in Tokyo I’ve stayed in different areas across the city. From very center to not-so-much-center. Given the great public transportation and taxi system in Tokyo it always was a great experience.

So after a couple of times I developed a preference for an area that was in walking distance to the Rakuten office, was well connected to the public transport system and offered all sorts of starting-points for daily life on a longer term. It ticked a lot of boxes.

You can follow my foot-steps from a route I had recorded in 2015 in preparation for a presentation I’ve held at the Rakuten Technology Conference on my pet project Miataru.

this is in real-time – from Hotel to Office

The areas name is Musashi-Kosugi (武蔵小杉). And it actually is in the city of Kawasaki in Kanagawa prefecture. Effectively just across the Tama river from Ota-city in Tokyo prefecture.

Like any great neighborhood everything is conveniently close and the service everywhere is spotless. The hotel of preference is fairly priced and extremely close to the two train stations. So you can get anywhere quick by train.

You can see the hotel location and the train tracks pretty well on this next map. The red portion shows the viewing direction of the night-picture below.

And like any great neighborhood there’s loads of current information available and lots of community activities around the year. In the case of Musashi-Kosugi you can have the more official website and the more up-to-date blog.

If you plan to visit Tokyo I can only recommend you take a look at more off center options of accomodation. I’ve always enjoyed being able to leave the center of buzz like Shibuya, Ropongi and get back into my bubble of quietness without compromising on everything else than party-and-entertainment options. Actual longer-term daily-life is much more enjoyable off-center – as you can imagine.

And for the end of this post: Let us enjoy a sunset with parts of the Musashi-Kosugi skyline:

health: tracking food

It had been mentioned before: regarding my own health until 2015 I did not have any structure and understanding when it came to food, sports, weight and all that is connected.

I used to be around 147kg (324lbs) when I made the decision to change that. Less than 8 months later I reached the weight that is considered “normal weight” for my body height.

Maybe more important than losing weight and going from class III obesity   to normal is to keep in the range offering the biggest health benefits.

2015 till today

Apart from sport and being more active the key to managing weight in general for me was to understand and keep learning about food from many different perspectives.

Like in good science to learn more and make progress you got to listen and take well notes. Some things only can be understood when there’s enough historical data available. Not only the amount of time logged but also what is being logged is quite important.

In a normal week I am used to one-meal-a-day which I am preparing myself together with my wife. We eat in the evening – this makes things so much easier as there’s one time and space where everything regarding food comes together during routine days.

Also this routine works well in the long run. If we only got 10 minutes to prepare we will be able to hit the nutrition targets with either much or not-so-much quantities of food. In the last 4 years we practiced and played and created recipes for all situations you can think of. In a way we have made our simple-and-healthy-recipes the fall-back position we are using when we otherwise would have eaten something unhealthy.

Most importantly: We have tracked everything we cooked and ate. On a gram scale. I even built our own wifi enabled and calibrated kitchen scales.

Where do we track? There are so many options but since 2015 we stick to MyFitnessPal.

4+ years constant tracking

We are still happy using this as the base for tracking as the app is bearable even on Android and the food database that it uses is offering a good-enough data detail level.

So after more than 4 years of doing this a lot of data as come together. As I am doing it in sync with my wife a lot of things happened…

We have not become vegans. We eat meat still and we still like it. It’s just that the quality of meat we eat has gotten much better and with this the number of times we eat meat have reduced to maybe once a week at most.

We have started to eat things and experiment cooking with ingredients we did not know a year ago. While we keep adding ingredients all the time we find that you can optimize and gain so much joy from just jumping in head first into new tastes and recipes.

We’ve developed a “body-feel”. Apart from the taste buds changing completely over time I could not have thought of how much food influences how you feel. Different nutritious values lead to very different feels afterwards. I would go as far to say that most of the headaches I very frequently had while being overweight could have been traced back to what I’ve eaten just before.

So what now? We will keep tracking. Maybe not on a cloud service but on our self-hosted service. Maybe you got a good hint towards such self-hosted solutions to enter and track nutrition over time.

IoP – the internet of pets – predictive maintenance of a cat

In the interesting field of IoT a lot of buzz is made around the predictive maintenance use cases. What is predictive maintenance?

The main promise of predictive maintenance is to allow convenient scheduling of corrective maintenance, and to prevent unexpected equipment failures.

The key is “the right information in the right time”. By knowing which equipment needs maintenance, maintenance work can be better planned (spare parts, people, etc.) and what would have been “unplanned stops” are transformed to shorter and fewer “planned stops”, thus increasing plant availability. Other potential advantages include increased equipment lifetime, increased plant safety, fewer accidents with negative impact on environment, and optimized spare parts handling.

Wikipedia

So in simpler terms: If you can predict that something will break you can repair it before it breaks. This improvse reliability and save costs, even though you repaired something that did not yet need repairs. At least you would be able to reduce inconveniences by repairing/maintaining when it still is easy to be done rather than under stress.

You would probably agree with me that these are a very industry-specific use cases. It’s easy to understand when it is tied to an actual case that happened.

Let me tell you a case that happened here last week. It happened to Leela – a 10 year old white British short hair lady cat with gorgeous blue eyes:

Ever since her sister had developed a severe kidney issue we started to unobtrusively monitor their behavior and vital signs. Simple things like weight, food intake, water intake, movement, regularities (how often x/y/z).

I’ve built hardware to allow us to do that in the most simple and automated way. In the case of getting to know their weight we would simply put the kitty litter box on a heavily modified persons scale. I wrote about that already back int 2016.

When Leela now visits her litter box she is automatically weighed and it’s taken note that she actually used it.

A lot of data is aggregated on this and a lot of things are being done to that data to generate indications of issues and alerts.

This alerted us last weekend that there could be an issue with Leelas health as she was suddenly visiting the litter box a lot more often across the day.

We did not notice anything with Leela. She behaved as she would everyday, but the monitoring did detect something was not right.

What had happened?

The chart shows the hourly average and daily total visits to the litterbox.

On the morning of March 9th Leela already had been to the litter box above average. So much above average that it tripped the alerting system. You can see the faded read area in the top of the graph above showing the alert threshold. The red vertical line was drawn in by me because this was when we got alerted.

Now what? She behaved totally normal just that she went a lot more to the litter box. We where concerned as it matched her sisters behavior so we went through all the checklists with her on what the issue could be.

We monitored her closely and increased the water supplied as well as changed her food so she could fight a potential bladder infection (or worse).

By Monday she did still not behave different to a degree that anyone would have been suspicious. Nevertheless my wife took her to the vet. And of course a bladder infection was diagnosed after all tests run.

She got antibiotics and around Wednesday (13th March) she actually started to behave much like a sick cat would. By then she already was on day 3 of antibiotics and after just one day of presumable pain she was back to fully normal.

Interestingly all of this can be followed up with the monitoring. Even that she must have felt worse on the 13th.

With everything back to normal now it seems that this monitoring has really lead us to a case of “predictive cat maintenance”. We hopefully could prevent a lot of pain with acting quick. Which only was possible through the monitoring in place.

Monitoring pets is seemingly becoming a thing – which lead to my rather funky post title declaration of the “Internet of Pets”. I know about a certain Volker Weber who even wrote in the current c’t magazine about him monitoring his dogs location.

Health is a huge topic for the future of devices and gadgets. Everyone will casually start to have more and more devices in their daily lifes. Unfortunately most of those won’t be under your own control if you do not insist on being in control.

You do not have to build stuff yourself like I did. You only need to make the right purchase decisions according to things important to you. And one of these things on that checklist should be: “am I in full control of the data flow and data storage”.

If you are not. Do not buy!

By coincidence the idea of having the owner of the data in full control of the data itself is central to my current job at MindSphere. With all the buzz and whistles around the Industry IoT platform it all breaks down to keep the actual owner of the data in control and in charge. A story for another post!

something is coming up…

Since 2011 we’ve got this Boogie Board in the household. It’s simply a passive LCD panel on which you can write with a plastic pen. When you do you’re interacting with the liquid crytals and you switch their state. So what was black becomes white.

So we got this tablet and it’s magnetically pinned to our fridge. And whenever we’ve booked the next trip we’re crossing off days by coloring them in a grid.

How do you do such countdowns?

Twitter Blocklists

My usual twitter use looks like this: I am scrolling through the timeline reading up things and I see an ad. I click block and never again will I see anything from this advertiser. As I’ve written here earlier.

As Twitter is also a place of very disturbing content there are numerous services built around the official block list functionality. One of those services is “Block Together“.

Block Together is designed to reduce the burden of blocking when many accounts are attacking you, or when a few accounts are attacking many people in your community. It uses the Twitter API. If you choose to share your list of blocks, your friends can subscribe to your list so that when you block an account, they block that account automatically. You can also use Block Together without sharing your blocks with anyone.

blocktogether.org

I’ve signed up and apparently this is as easy as it gets when you want to share block lists.

There seem to be more people that use Twitter like I do. For example Volker Weber wrote about his handling of “promoted content”.

My block list on Twitter currently includes 1881 accounts and these are only accounts that put paid promotions without my request into my timeline.

I’ve read that Volker has such a long list as well – maybe it’s worth sharing as Volker is one person I would trust on his decisions for such a list. (vowe is a good mother!)

get your calendar (one each)

In less than 10 days the season of chaos will end and discord will take over.

To be prepared and to not miss any important days – as some sort of public service announcement – I hereby link you to the discordian calendars adjusted for the current year 3185 (2019).

A holyday not found on any calendar. A calendar not found on any planet. A planet not found in any universe. A universe not found in any imagination. An imagination not found.

cliche internet alias

work and walk

Working in the IT industry requires us to spend copious amounts of time focused on our screens mostly sitting at our desks. But this does not have to be that way.

For me sitting down for long times creates a lot of unwanted effects and essentially leads to me not being able to focus anymore properly.

In 2015 my wife and I attacked that “health problem” as a team. And in the 12 months until 2016 we both lost 120 kg / 260lbs added up together in body weight and completely changed the way we deal with food and sport.

With that I also changed the way I work. Sitting down was from now on the exception.

Coincident with this lifestyle change my then-employer Rakuten rolled out it’s then new workplace concept and everyone got great electric stand-up desks that allowed you to change the height up and down effortlessly.

When I started with SIEMENS of course their workplace concept included standing desks as well!

For those times I am working from home one of the desks is equipped with a standing desk with an additional twist.

pictured is a LifeSpan TR1200-DT5

So this desk let’s you work while standing. But it also allows you to walk while you work. You can set the speed from 0 to 6.4 km/h.

Given a good headset I personally can attend conference calls without anyone noticing I am walking with about 4 km/h paces.

When I am spending a whole day working from this desk it is not uncommon to accumulate 25-40 km of total distance without really noticing it while doing so. Of course: later the day you’ll feel 40km in one way or the other

monthly distance … something between 50 and 350km … only 50km at the desk when walking outside is possible.

It took a bit of getting used to as your feet are doing something entirely different from what the rest of the body is doing. But at least for me it started to feel natural very quickly.

I’ve put two curved 24″ monitors onto it and aside from the docking ports for a company notebook I am using thinclients to get my usual work machines screens teleported there. There’s a bit of a media set-up as well as sometimes I am using one of the screens for watching videos.

For those now interested in the purchase of such a great walking desk: I can only recommend doing so! But be aware of some thoughts:

There are not a lot of vendors of such appliances. And those vendors are not selling a lot of them. This means: be ready for a € 1000+ purchase and be ready to shell out some good money on extended warranties.

My first desk + treadmill was replaced 3 times before. It was LifeSpans first generation of treadmill desks and it just kept exploding. I actually had glowing sparks of fire spitting out of the first generation treadmill.

I’ve returned it for no money loss and waited for the second generation. This current, second generation of LifeSpan treadmill desks is really doing it for me for longer than the first generation ever had without breaking. Looking at the use of the device I would see it as a purchase over 5 years. After 5 years of actual and consistent use I wouldn’t be overly annoyed if the mechanical parts of the appliance would stop working. I am not expecting such a device to live much longer anyhow.

Energy consumption wise it’s quite impressive how much energy this thing consumes. I wasn’t quite expecting those levels. So here’s for you to know:

this is a 28km workday with some pauses

So just around 500 Watts when in use. The 65W base load is the monitors and computers on top.

did you know: Linus Torvalds used to use a first generation model – the one that broke on me many times

I can only recommend to try something like this out. Unfortunately it’s quite hard to find a place to try it out. At least I was not able to try before buy.

But then again I could answer your questions if you had any.

“kachung” + shutter sound

When you take a picture with an iPhone these days it does generate haptic feedback – a “kachung” you can feel. And a shutter sound.

Thankfully the shutter sound can be disabled in many countries. I know it can’t be disabled on iPhones sold in Japan. Which kept me from buying mine in Tokyo. Even when you switch the regions to Europe / Germany it’ll still produce the shutter sound.

Anyway: With my iPhone, which was purchased in Germany, I can disable the shutter sound. But it won’t disable the haptic “kachung”.

look ma! no mirror! (yes this is an iPhone 6)

It’s interesting that Apple added this vibration to the activity of taking a picture. Other camera manufactures go out of their way to decouple as much vibration as possible even to the extend that they will open the shutter and mirror in their DSLRs before actually making the picture – just so that the vibration of the mirror movement and shutter isn’t inducing vibrations to the act of taking the picture.

With mirror less cameras that vibration is gone. But now introduced back again?

Am I the only one finding this strange?

celebrate the discordian holyday: Chaoflux

allow me to explain by quoting wikipedia:

Dicordianism is a paradigm based upon the book Principia Discordia, written by Greg Hill with Kerry Wendell Thornley in 1963, the two working under the pseudonyms Malaclypse the Younger and Omar Khayyam Ravenhurst.

According to its primary historian, Adam Gorightly, Discordianism was founded as a parody religion. Many outside observers still regard Discordianism as a parody religion, although some of its adherents may utilize it as a legitimate religion or as a metaphor for a governing philosophy.


The Principia Discordia, if read literally, encourages the worship of Eris, known in Latin as Discordia, the goddess of disorder, or archetypes and ideals associated with her. Depending on the version of Discordianism, Eris might be considered the goddess exclusively of disorder or the goddess of disorder and chaos.

Both views are supported by the Principia Discordia. The Principia Discordia holds three core principles: the Aneristic (order), the Eristic (disorder), and the notion that both are mere illusions.

Due to these principles, a Discordian believes there is no distinction between disorder and chaos, since the only difference between the two is that one refers to ‘order’.

This is likely a major reason for the inconsistency in the wording. An argument presented by the text is that it is only by rejecting these principles that you can truly perceive reality as it is, chaos.

wikipedia

And given that information you can expect a discordian calendar to exist. This calendar defines years (YOLD = year of our lady of discord) and seasons and days. And holydays:

Chaosflux is a Holyday of the season of Chaos. It is celebrated on Chaos 50 (Discordian calendar) or February 19 (Gregorian calendar).

Very little is known about this holyday. What we do know is pretty much made up as we go along.

discordia wikia GFDL

So now back to the holyday itself. How would you celebrate such a distinguished day?

I will use the services of theuselessweb.com to click 5 times on their most interesting button and then meditate on what comes up:

disaster warning!!! This is just a test.

Apparently yesterday somebody pushed the wrong button. Twice.

Like most countries Germany got a system in place to broadcast out warnings to the public in case of disasters or else.

And it proved to be quite useful in the past when it comes to the occasional storm or heavy snowfall/rain/lightning.

Seeing that they run a test and then again send out an apology to have run a test is puzzling and funny at the same time. Everyone has a “bad hair” day, right?

How to weigh your cat! – the IoT version

This is Leela. She is a 7 year old lilac white British short hair cat that lives with us. Leela had a sister who used to live with us as well but she developed a heart condition and passed away last year. Witnessing how quickly such conditions develop and evaluate we thought that we can do something to monitor Leelas health a bit to just have some sort of pre-alert if something is changing.

Kid in a Candystore

As this Internet of Things is becoming a real thing these days I found myself in a candy store when I’ve encountered that there are a couple of really really cheap options to get a small PCB with input/output connectors into my house WiFi network.

One of the main actors of this story is the so called ESP8266. A very small and affordable system-on-a-chip that allows you to run small code portions and connect itself to a wireless network. Even better it comes with several inputs that can be used to do all sorts of wonderful things.

And so it happened that we needed to know the weight of our cat. She seemed to get a bit chubby over time and having a point of reference weight would help to get her back in shape. If you every tried to weigh a cat you know that it’s much easier said than done.

The alternative was quickly brought up: Build a WiFi-connected scale to weigh her litter box every time she is using it. And since I’ve recently bought an evaluation ESP8266 I just had to figure out how to build a scale. Looking around the house I’ve found a broken human scale (electronics fried). Maybe it could be salvaged as a part donor?

A day later I’ve done all the reading on that there is a thing called “load-cell”. Those load cells can be bought in different shapes and sizes and – when connected to a small ADC they deliver – well – a weight value.

I cracked the human scale open and tried to see what was broken. It luckily turned out to have completely fried electronics but the load-cells where good to go.

Look at this load cell:

Hardware

That brought down the part list of this project to:

  • an ESP8266 – an Adafruit Huzzah in my case
  • a HX711 ADC board to amplify and prepare the signal from the load-cells
  • a human scale with just enough space in the original case to fit the new electronics into and connect everything.

The HX711 board was the only thing I had to order hardware wise – delivered the next day and it was a matter of soldering things together and throwing in a small Arduino IDE sketch.

My soldering and wiring skills are really sub-par. But it worked from the get-go. I was able to set-up a small Arduino sketch and get measurements from the load-cells that seemed reasonable.

Now the hardware was all done – almost too easy. The software would be the important part now. In order to create something flexible I needed to make an important decision: How would the scale tell the world about it’s findings?

Software

Two basic options: PULL or PUSH?

Pull would mean that the ESP8266 would offer a webservice or at least web-server that exposes the measurements in one way or the other. It would mean that a client needs to poll for a new number in regular intervals.

Push would mean that the ESP8266 would connect to a server somewhere and whenever there’s a meaningful measurement done it would send that out to the server. With this option there would be another decision of which technology to use to push the data out.

Now a bit of history: At that time I was just about to re-implement the whole house home automation system I was using for the last 6 years with some more modern/interoperable technologies. For that project I’ve made the decision to have all events (actors and sensors) as well as some additional information being channeled into MQTT topics.

Let’s refer to Wikipedia on this:

“MQTT1 (formerly MQ Telemetry Transport) is an ISO standard (ISO/IEC PRF 20922) publish-subscribe-based “lightweight” messaging protocol for use on top of the TCP/IP protocol. It is designed for connections with remote locations where a “small code footprint” is required or the network bandwidth is limited. The publish-subscribe messaging pattern requires a message broker. Thebroker is responsible for distributing messages to interested clients based on the topic of a message. Andy Stanford-Clark and Arlen Nipper of Cirrus Link Solutions authored the first version of the protocol in 1999.”

Something build for oil-pipelines can’t be wrong for your house – can it?

So MQTT uses the notation of a “topic” to sub-address different entities within it’s network. Think of a topic as just a simple address like “house/litterbox/weight”. And with that topic MQTT allows you to set a value as well.

The alternative to MQTT would have been things like WebSockets to push events out to clients. The decision for the home-automation was done towards MQTT and so far it seems to have been the right call. More and more products and projects available are also focussing on using MQTT as their main message transport.

For the home automation I had already set-up a demo MQTT broker in the house – and so naturally the first call for the litterbox project was to utilize that.

The folks of Adafruit provide the MQTT library with their hardware and within minutes the scale started to send it’s measurements into the “house/litterbox/weight” topic of the house MQTT broker.

Some tweaking and hacking later the litterbox was put together and the actual litterbox set on-top.

Since Adafruit offers platform to also send MQTT messages towards and create neat little dashboards I have set-up a little demo dashboard that shows a selection of data being pushed from the house MQTT broker to the Adafruit.io MQTT broker.

These are the raw values which are sent into the weight topic:

You can access it here: https://io.adafruit.com/bietiekay/stappenbach

So the implementation done and used now is very simple. On start-up the ESP8622 initialises and resets the weight to 0. It’ll then do frequent weight measurements at the rate it’s configured in the source code. Those weight measurements are being monitored for certain criteria: If there’s a sudden increase it is assumed that “the cat entered the litterbox”. The weight is then monitored and averaged over time. When there’s a sudden drop of weight below a threshold that last “high” measurement is taken as the actual cat weight and sent out to a /weight topic on MQTT. The regular measurements are sent separately to also a configurable MQTT topic.

You can grab the very ugly source code of the Arduino sketch here: litterbox_sourcecode

And off course with a bit of logic this would be the calculated weight topic:

Of course it is not enough to just send data into MQTT topics and be done with it. Of course you want things like logging and data storage. Eventually we also wanted to get some sort of notification when states change or a measurement was taken.

MQTT, the cloud and self-hosted

Since MQTT is enabling a lot of scenarios to implement such actions I am going to touch just the two we are using for our house.

  1. We wanted to get a push notification to our phones whenever a weight measurement was taken – essentially whenever the cat has done something in the litterbox. The easiest solution: Set-Up a recipe on If This Than That (IFTTT) and use PushOver to send out push notifications to whatever device we want.
  2. To log and monitor in some sort of a dashboard the easiest solution seemed to be Adafruits offer. Of course hosted inside our house a combination of InfluxDB to store, Telegraf to gather and insert into InfluxDB and Chronograf to render nice graphs was the best choice.

Since most of the above can be done in the cloud (as of: outside the house with MQTT being the channel out) or inside the house with everything self-hosted. Some additional articles will cover these topics on this blog later.

There’s lots of opportunity to add more logic but as far as our experiments and requirements go we are happy with the results so far – we now regularly get a weight and the added information of how often the cat is using her litterbox. Especially for some medical conditions this is quite interesting and important information to have.

small tool to filter iCal / iCalendar / ICS files

I am managing my appointments using Outlook on windows and iCal on OS X. Since I am not using any Exchange service right now I was happy to find out that Outlook offers a functionality to export a local calendar automatically to an iCalendar compatible ICS file. Great feature but it lacks some things I desperately need.

outlookg

Since I am managing my private and my business appointments in the same calendar, differentiating just by categories, I had a hard time configuring outlook to export a) an ics file containing all business appointments and b) an ics file containing all private appointments. It’s not possible to make the story short.

So I fired up Visual Studio as usual and wrote my own filter tool. I shall call it “iCalFilter”. It’s name is as simple as it’s functionality and code. I am releasing it under BSD license including the sources so everyone can use and modify it.

icalfilter_1

It’s a command line tool which should compile on Microsoft .NET and Mono. It takes several command line parameters like:

  1. Input-File
  2. Output-File
  3. “include” or “exclude” –> this determines if the following categories are included or excluded in the output file
  4. a list of categories separated by spaces
  5. an optional parameter “-remove-description” which, if entered, removes all descriptions from events and alarms

Easy, eh?!

Grab the Source and Binary here: https://github.com/bietiekay/iCalFilter

UPDATE: You can now access the source code on github! You can even add your changes!

How to sell a car

Mission accomplished. I successfully talked a co-worker, who needed to buy a new car, into buying a gadget-packed BMW 1 series.

He calls it his “cluster on 4 wheels” – because obviously there is some processing “horse-power” in this machine :-)

img_7539s

May he always have a safe ride!

Source 1: http://blog.ahzf.de/index.php/2009/09/21/mein-cluster-hat-vier-rader/

Welcome to the world of tomorrow!

So here we are on a new blog engine. It took me the better part of two days to do the Migration of 2,869 posts and 2,732 comments, a lot of pictures and movie files.

I will write an article on this but for now only two captures images from the migration:

php-xpath
yeah PHP rocks!

regex-magic 
had to do some regex action to do the url rewrites

Hail Eris! All Hail Discordia!

pope

I was in desperate need for an DDate equivalent running on Windows. DDate is an unix implementaion of date accoridng to the erisian calendar described in the principia discordia.

I only found some C Implementations. And since it’s fun to do I ported the original Discordian Date C code to C#.

You can download the C# sourcecode, licensed under CC-BY-NC here.

I also created a web page which displays the current discordian date and offers you to convert any gregorian date into discordian date representation.

This page can be accesses here. You can call another page with parameters and you only will get the ddate output back:

for example: http://ddate.schrankmonster.de/DiscordianDate.aspx?year=2009&month=6&day=9

Source 1: http://ddate.schrankmonster.de/
Source 2: http://dropbox.schrankmonster.de/dropped/SharpDDateLib.zip