Roderick Eime (CC BY 2.0)

Yes, alcohol makes you fat

This might not be news to you, but it was to me. I had heard that alcohol was kind of like a sugar, but never thought much of it. Adding my drinks to MyFittnessPal showed me how important it is to quit drinking while on diet. Here a few of the drinks, each as a 0,5l beverage at 1,700 kcal basic metabolic rate:

Beer: 215 kcal (13% of daily allowance)
Alkopop: 340 kcal (20% of daily allowance)
Red Wine: 335 kcal (20% of daily allowance)
Sparkling: 400kcal (24% of daily allowance)
Vodka: 1075 kcal (63% of daily allowance)
Gin-Tonic: 350 kcal (21% of daily allowance)

Germans drink 9,7l of pure alcohol per year – 7% of their daily requirement

I don’t intend to stop drinking altogether. I love the social glue it provides a geek. All I now know is that I should moderate both the type als well as the amount.

 

Control of the Logitech Media Server using the LogicMachine

I use the Logitech Media Server to stream multi-room audio in our apartment. Lately I wanted to be able to also control the Spotify Plugin from the KNX buttons at home and automate some tasks.

This is a simple user library to allow you to send commands to a player attached to your LMS.

--Functions for Logitech Media Server integration
squeezboxserverip = '192.168.178.2' -- IP of the Logitech Media Server

function unescape(space)
return string.gsub(space, ':', '%%3A') -- the telnet server returns : as %3A
end

function squeezeboxsendcommand(player,command,value)
socket=require('socket')
local client = socket.connect(squeezboxserverip, 9090)
playercommand = player .. ' ' .. command .. ' '
client:send(playercommand .. value .. '\n')
local result=client:receive()
status = string.sub(result, string.len(unescape(playercommand))) --remove the MAC and command to get to the answer
client:close()
os.sleep(0.2)
return(status)
end

function squeezeboxstatus(player)
socket=require('socket')
local client = socket.connect(squeezboxserverip, 9090)
playercommand = player .. ' status'
client:send(playercommand .. '\n')
local result=client:receive()
status = split(result, ' ')
--status = string.sub(result, string.len(unescape(playercommand))) --remove the MAC and command to get to the answer
client:close()
log(status)
return(status)
end

to play a Spotify Playlist you need to add this code to a KNX object.


require('user.squeezebox') --get the user library to access LMS

local player = 'b8:27:eb:ad:6b:c3' --set witch player to access

if (event.getvalue() == true) then
squeezeboxsendcommand(player, 'playlist', 'clear') -- reset any playlist
squeezeboxsendcommand(player, 'playlist add', 'spotify:user:1175125342:playlist:7yCDwOnYZTXFTYymXZxp0t') --get this command from the logs of the LMS when playing the Spotify playlist
squeezeboxsendcommand(player, 'playlist shuffle', 1) -- shuffle, if you want
squeezeboxsendcommand(player, 'play', '') -- now play the list
grp.write('11/6/1', 'Playing Spotify')
else
squeezeboxsendcommand(player, 'playlist', 'clear')
grp.write('11/4/0', false) --turn off player
end

Jessica Pereira (CC BY 2.0)

The most important rule of Diet Club is don’t talk about Diet Club

I am breaking one of the most important rules of my weight loss program. Ray Cronise popularized the ruleThe most important rule of Diet Club is don’t talk about Diet Club. It sounds against one’s instinct and intuition. It even seems to contradict some scientific studies that seemed to show that telling your friends that you will loose weight would keep you honest. But that’s not correct. Telling friends and family does the oposite. Although well intentioned, your friends will keep you from completing your goal. First they will give you instant gratification by praising your new goal. This is shown to keep you from achieving it, as your brain will now be happy without having to do the hard work. Even if you could keep that from influencing you, your friends and family will actively or passively make it hard for you to diet. As soon as you tell them, they will want to know why? How? How long? Why again? All this will erode your willpower. My advice: keep your dieting plans to yourself

yoppy (CC BY 2.0)

Calorie counting as gamification of your weight loss

I have been successfully using both the app as well as the website from myfittnesspal to loose weight. Some of the features are that you can add friends kind of like on facebook to your account, who will like your achievements. What I have been missing a true gamification. Give me 1.000 points for staying under my kcal maximum. Give me 50.000 points for loosing a 1kg of weight. You get the point.

As part of the gamification of weight loss I would also like to suggest you get either a step counting app like Google Fit, a smart watch or a fitness band. All these also lack the point and merit based rewards required for true gamification. All I did is give myself a goal (12.000 steps a day, less than 1.000 kcal a day) and reward myself for it (pat on the shoulder).

Raspberry Pi GPIO Audio Amp control with relays using squeezlite

I have had a project in the making for some time. We use a Raspberry Pi with a Squeezeplug image to run Squeezelight on it to do basic audio out in our bathroom. As an amp I use the Dayton DTA-1. The amp has to be manually turned on and off each time we use it. This is subobtimal, as the whole idea behind the Logitech Media Server is to be able to use an app to use it.

While researching I came across the Squeezelite RPI GPIO project. It is a drop in replacement for the squeezelight binary provided by the Squeezeplug guys. To get it to work you need to change the code in a few places.

First log into your Raspberry Pi as root.

Get the latest git version of Squeezelite RPI GPIO:
git clone https://code.google.com/r/phermann2-squeezelite-rpi-gpio/
cd phermann2-squeezelite-rpi-gpio/

Then edit the Makefile:
nano Makefile

Change the CFlags to this:
CFLAGS ?= -Wall -fPIC -O2 $(OPTS) -DGPIO -DDSD -DLINKALL -DRESAMPLE -DFFMPEG
notice the -DGPIO, this gives you access to the desired functions.

compile with this command
make

now make a backup copy of your current squeezelight binary:
cp /opt/squeezelight/squeezelight /opt/squeezelight/squeezelight.original

edit the start script of squeezelight, as we need root rights
nano /etc/init.d/squeezelite
all I did is add a
USER=root
after the first fi in the file… it overrides everything it detects automatically.

restart the squeezelite service to check if it worked.

You now need to connect pin 18 on the Raspberry PI to the input on your relais.

Relais for a Raspberry Pi Squeezbox Amp control

In my case I got a board for Arduino with 5 Volt relais and 3,3 volt pins. I took an old power cable and spliced it to attach it to the fist relais and added a socket for the power source of the amp.