Showing posts with label tools. Show all posts
Showing posts with label tools. Show all posts

Wednesday, May 12, 2021

Home Assistant – DIY home IoT and automations domotica

Moving away from IFTTT

I used to orchestrate my home IoT devices such as cheap Tuya or Ewelink Sonoff wifi relays using the cloud IFTTT (If This Than That) platform as it made it easy to setup some flows without having any local infrastructure. Yet, quickly the flows became a bit more complex to add smart integration with other platforms such as Tado and Ezviz Wifi doorbell. Initially I still was able to achieve most of the orchestration and rules by integrating other cloud platform such as apilio.io and later on switchur. But as the IFTTT suddenly decided to charge extra high monthly costs (besides the high rates they charge to the manufacturers supporting IFTTT), and my use cases and needs became too complex to manage well with IFTTT, I decided to look at some alternatives. Too bad IFTTT didn’t had a bit more respect for their community and early adopters, but after all, I’m very glad to made the move, as much more fine grained control is now possible.Home Assistant - Wikipedia

First I tried to play around with OpenHAB as a free home IoT platform, as it can easily run within a normal Windows environment (Java based) and has easy support for remote iOS/Android application. But soon I concluded I should switch to Home Assistant as it has a massive community support and a great look and feel with many devices and platform supported, including my favorites such as the Google Nest Hub and Google ChromeCast.

Setup Home Assistant

In order to run Home Assistant, one should check out the excellent installation documentation they provide. I chose to use a docker container in order to first test within a Windows environment but next run the same on an old small media pc on which I installed Ubuntu. Running perfectly on limited CPU, 2GB Ram and an 250GB SSD.

Home Assistant Docker

To just run home assistant docker in Windows, make sure to have installed WSL. In order to store your Home Assistant configuration outside of the docker container, a volume (folder) should be mapped from your OS towards the docker container. These files will be fully accessible from the Docker container, but will not be touched when upgrading or removing your docker container, to make sure your personal stored files are not lost. This mapping is possible with –v option:

initial install:

docker run --init -d --name="home-assistant" -e "TZ=Europe/Brussels" -w /config -v "<path>\ha-config\:/config" -p 8123:8123 homeassistant/home-assistant:stable

run docker:

docker run -d --name="home-assistant" -e "TZ=Europe/Brussels" -w /config -v "<path>\ha-config\:/config" --net=host --restart=unless-stopped homeassistant/home-assistant:stable

update docker:

docker update home-assistant

This will start your personal home assistant and make it accessible on port 8123.

Yet, after a while other option may be desired and other docker containers of other applications may be used (eg plex, youtube-dl, deepstack, etc). If you don’t want to type the full command with all option at each run, you can use docker compose to store your configuration option and allow to easily start, stop, upgrade etc. A docker-compose.yml file will just store your options for you to ease the commands to run.

A basic docker-compose.yml file used in Linux Ubuntu example shown below:

version: '3'
services:
  homeassistant:
    container_name: home-assistant
    image: homeassistant/home-assistant:stable
    volumes:
      - /home/myt/homeassistant/:/config
      - /home/myt/homeassistant/media/:/media
    environment:
      - TZ=Europe/Brussels
    restart: unless-stopped
    network_mode: host

With such as docker-compose file, below commands can be used. The container name homeassistant at the end of these commands is optional, it can be used if multiple dockers are defined in your compose file:

start with docker compose :

docker-compose up –d homeassistant

restart with docker compose:

docker-compose restart –d homeassistant

update with docker compose:

docker-compose pull

docker-compose up -d --build homeassistant

Advanced tips for running commands on the host without ssh 

Remote access

The main development of the free and open source project Home Assistant is supported by the Dutch company Nabu Casa. They get their money to continue the development of Home Assistant by adding full remote cloud support to your local Home Assistant environment. This allows easy integration with Amazon and Google cloud services (assistant, text to speech, Nest Hub) and remote access to control your home with the Home Assistant app. These services require access to your local free Home Assistant deployment. Yet, these paid cloud services (5$/month) are not mandatory and all these cloud services can also be achieved when manually setup. It will just require some extra manual effort. Anyone who may not be familiar with Linux configuration and less IT minded will definitely be advise to use this paid subscription. Yet below approach is an alternative.

Different options exist to get remote access to your local server. As most will receive a dynamic IP address from their ISP that will regularly change, some forwarding is required in order to always know the public IP address of your local server. A dynamic DNS forwarder may be supported by your router or a little application can be installed on your server to update the public address of a DNS. Yet, even when the dynamic public IP address is know, this will require you to open a port on your router and allow inbound traffic from the internet towards your local server. Another solution that could be used is by running telebit.io or dataplicity (similar to ngrok but will keep for free your unique fixed dns whichs is only possible in the paid version of ngrok). With this little telebit service you can easily install and get a fixed telebit.io DNS linked to a specific port, such as port 8123 of your local Home Assistant by running below and confirming your email address:

> curl https://get.telebit.io/ | bash

> ~/telebit http 8123

Over time, I notice local network interruptions may interrupt the telebit forwarding. As a result, I configured a little cronjob that will check every 5 minutes if the external telebit url is still accessible. If not, it will deactivate and activate telebit again.

> crontab –e

*/5  *  *  *    *    /home/myt/check_telebit.sh

check_telebit.sh:

#!/bin/bash

URL=https://***.telebit.io
EXPECTED_STATUS=200

status=$(curl -s -o /dev/null -w '%{http_code}' $URL)
if [ $status -ne $EXPECTED_STATUS ]; then
    echo "HTTP status code is not $EXPECTED_STATUS. Disabling and re-enabling Telebit."
    # disable Telebit
     /home/myt/telebit disable
    # enable Telebit
    /home/myt/telebit enable
else
    echo "HTTP status code is $EXPECTED_STATUS"
fi

Whatever solution is chosen, once a public accessible URL is available towards your local Home Assistant, it can be used within the Home Assistant iOS and Android apps and within the configuration of Amazon or Google Cloud services.

It might be required to also define the external public url within your HA configuration.yaml file:

homeassistant:
  external_url: !secret external_url

As soon as any remote public online access is enabled, I would strongly advice to make sure the server is regularly patched with security updates as well as enabling 2FA within Home Assistant, as you should with any other cloud service.

Integration of services and devices

Once Home Assistant is up and running, it allows you to easily connect many different devices and cloud services. These can be setup using the Home Assistant Configuration Dashboard (localip:8123/config/dashboard) –> Integrations. Yet, also many services will require to be defined within the ‘configuration.yaml’ file stored within the config folder of your Home Assistant. All information required to correctly define these in your local config can be found on the excellent documentation pages of Home Assistant.

Services

Below a list of the services I found most useful:

  • Google Calendar: whenever I need some activity to be scheduled on time, I do prefer to create a specific Google Calendar for it instead of hard coding it in scripts or automations. This makes it possible to get a clear overview of your schedules (using different colors for each calendar) and will also make it possible to easily add repetitions or exceptions (eg during holidays) by just planning it within your calendar as if you’d plan a regular meeting. Once the calendar is defined, an automation can be created that will trigger whenever a meeting starts and/or stops.
    • Good to know: within a trigger by state change, you can define a ‘From’, ‘To’ state and ‘For’ how long that state should be active before the action is triggered. Eg the calendar will change to state ‘on’ when a meeting becomes active. The status can always be checked easily using the ‘Developer Tools’ page. Yet, if both ‘For’ and ‘To’ are left empty, the automation can be triggered by any change. I found this very useful as I initially tended to copy the automation in order to get a trigger for all states expected, while a common trigger was easier.
    • HaCalendarTrigger
  • Alarm: an Alarm control panel can be defined which allows you to arm, disarm and many other options. To set this up, I followed much of the approach as explained here by Thomas. Based on groups of sensors and groups of users, I automatically arm and disarm my custom alarm. When leaving (armed_away) or when at home (armed_home) sensors will trigger the alarm which will start recording on the camera’s, send notification and flash lights. Yet, in contradiction with the approach of Thomas, I don’t use a group to initiate the triggers. Since, once the group has state ‘open’ it will no longer detect other doors or windows being opened. So if for example you would have a window open before leaving, the group state will be open before the alarm is armed. Next, if another window in the same group would open, the group state will remain open and thus not trigger the alarm. Using Google Nest mini, Hub and ChromeCast integration I can also start a sirene youtube video at full volume and flash blue led lights. Different advanced options exist in order to get advanced notifications with specific option and sounds. An example below of an alert notification in case of alarm triggered, this requires ios actionable notifications push category ‘camera’ to be defined in order to allow immediate action on the notification to disarm. The camera category has special treatment in order to allow to open a life stream of the camera when long-pressing the notification on the iPhone. Using the url option, a specific lovelace site in the Home Assistant can be opened whenever the notification is clicked. The update.caf default iOS sound made some sound that would take my attention when needed.
  • - service: notify.mobile_app_iphone
      data:
        url: /lovelace-alarm/alarm
        title: Alarm
        message: Alarm at home {{now().strftime("%H:%M:%S %d/%m/%Y")}}
        data:
          entity_id: camera.ip_cam_stream
          attachment:
            content-type: jpeg
          apns_headers:
            apns-collapse-id: alert
          push:
            sound:
              name: Update.caf
              critical: true
            category: camera
            thread-id: alarm

  • Telegram notification call: Still in order to make sure I would be aware of alarm events (eg at night of while away) I preferred to get called to make sure I would wake up. By integrating the CallMeBot api linked to telegram, this can be achieved. The bot will make a call and with text to speech read the pre-defined message eg indicating which sensor was triggered.
  • HACS: HACS is THE un-official Home Assistant Community Store. It supports many custom integrations of services and extra front-end customizations. Once HACS is installed, it will be very easy to find, install and update any other custom integration.

Devices and integrations

As I used to only use cloud based services with IFTTT, most of my devices can still be controlled via the different cloud manufacturers, eg Ewelink and Tuya. These have a huge set of cheap wifi devices connecting through their platform. Using a local Home Assistant, you could opt to disable most of these cloud accesses if you don’t trust the cheap China based firmwares. Yet, for me I do prefer to have a fallback to control my devices using Home Assistant and the specific device apps. If my Home Assistant would not be accessible remotely, I may still be able to control the devices directly.

  • Sonoff Ewelink wifi relays (+- €6 per relay): the relay just allows to turn on or off the current on a wire. Whatever is connected to it will thus get power on or off by it. I use it to control lights, water heating, cameras that doesn’t support full integration, garage ports, etc. Integration of Ewelink Sonoff devices is now well supported in combination with the standard Sonoff cloud firmware.
  • Sonoff Ewelink wifi power plug switch (+- €6 per switch): Same behavior as the wifi relay, but made for power cord connection
  • Sonoff Ewelink wifi door sensors (DW2) (+- €6 per sensor): these very small battery based sensors will just detect if the sensor is open or closed. Based on this the alarm can trigger if desired, etc.
  • tado central heating (base kit +- €200, +- €60 per extra optional radiator valve): this allows multi room valves to control temperature in each room separately and get constant sensor information on temperature and humidity of each room. Over time, I extended this to multiple rooms as it showed to give a high comfort: when needed separate room temperature can be increased while also allowing to limit the heating to minimum when not needed. So over time, this may result in some heating cost saving.
  • Ezviz wifi doorbell DB1 with camera (+- €100): doorbell that will call you on your phone when someone rings the bell, it includes sensor for detecting motion (before button is pressed) and camera to see life feed. It support local SD card recording and recording using Home Assistant, by doing so, no cloud recording subscription is needed (while possible). Motion detection integration within HA is possible, yet so far the bell button press event can’t be captured within Home Assistant yet.
  • Tuya wifi power plugs (+- €6): I connect an AirWick power plug-in to this smart plug, so I can plan when the AirWick fragrance should be release (it’s too overwhelming when leaving powered on all the time). So based on a specific Google Calendar I repeat the AirWick to turn on and off at regular intervals. Using local tuya HACS or standard tuya integration, full integration within HA is working well.
    • Many of these Tuya smart power plugs also offer power monitor functionality. This can easily be integrated into the power moniotorring of Home Assistant. If the device only provided current, it can be converted into kWh using the Utility Meter integration.
  • Cheap IP camera’s (+- €15 per camera): some don’t allow full integration, but by connecting these to a wifi relay, still they can be turned on and off. Some cheap ip camera’s do support rtsp video streaming, which can be integrated into HA generic camera integration. In order to find the correct rtsp url to use, eg with ffmpeg, one can use the onvif device manager tool which will scan your local network and discover many cameras including the rtsp url, or using this site detecting your IP cam device type and url. Doing so, I discovered I was still able to integrate some cameras I didn’t expect they would work. Example configuration.yaml:
  • camera:
      - platform: ffmpeg
        name: Living webcam YCC365
       # PTZ support for YCC365 compatible cameras: https://github.com/fjramirez1987/PTZ-YCC365
        input: !secret YCC365_rtsp_url

    • I also bought a cheap Tuya based wifi IP camera (+- €15). Because it was based on Tuya, I expected to be able to get a better integration in Home Assistant platform. Yet, it seems these cameras don’t allow any RTSP life streaming feed of the camera image, nor ONVIF protocol. Even the motion detection notifications can’t be integrated, except within the Tuya application itself. So I’m still looking for a good wifi ip camera with optimal Home Assistant integration to be able to trigger any Home Assistant event as soon as a motion is detected. As a temporary workaround I now trigger a Tuya wifi plug state when a motion is detected. With Home Assistant local tuya HACS integration, this plug state switch can immediately be detected and next this can trigger any other event within Home Assistant. This allows alarm trigger on camera motion detection, but is not optimal off course. Since the AirWick sense is only connected to this Tuya wifi smart plug, briefly turning it on and off again at some motion detection has not much further impact.Since 10/2021 the Tuya integration within HA has been renewed and now much better support is available, including camera support!
    • When you’d have multiple camera’s to show in a web lovelace, it might be interesting to look at the WebRTC plugin which makes it possible to have faster rtsp streaming.
  • Tuya water irrigation wifi control (+- €35): open or close a water to allow remote garden irrigation
  • Tuya wifi roller blind motor (+- €40): remote control roller blinds and by integrating within Home Assistant they can become smart and eg take into account sun state or anything else
  • Tuya wifi IR controller (+- €15): allows to control all infra red devices via wifi. this allows to ‘integrate’ many old ‘dump’ devices, althout the integration is not always optimal since you can’t get any feedback or status info of the device.
  • Tuya wifi smoke detector (+- €15): get notified when smoke is detected at home and sound a loud alarm
  • Audi connected car integration: see mileage, state of car doors, windows and locks
  • Google ChromeCast, Audio ChromeCast and Google Nest Hub (€35 - €100): ChromeCast devices allow great interaction and Home Assistant has good support for these.
  • Tuya ZigBee gateway & ZigBee door sensor and scene button: 
    • These ZigBee devices didn't seem supported by default in Home Assistant. In order to still be able to read the states of such unsupported device, it might be a solution to add a 'Vritual Tuya Device' (when adding a virtual device, best to add it into the 'Tuya App Account' instead of into an Asset, to make sure it becomes visible in Home Assistant)
    • Using the Tuya app build in scene's, the virtual devices (eg switch) can be set whenever the states of the Home Assistant unsupported device state would change. This will allow to still see the actual state of such unsupported device in Home Assistant and interact with it.

Personal tips for automations and scripts

Scripts to return to automatic default state

While defining different automations and scripts, you will notice this will probably be a incremental approach. Specific occupations will occur, which you’ll notice you may want to cover over time, extending your automations and scripts to cover more exceptional cases or combinations etc.

Personally, I tried to use the automations to trigger and initiated special activities, yet, within the ‘Action’ part of the automation, I would try to use as most as possible a call to a script. This allows you to re-use many actions as the same script can be called at other triggered events. This will make sure you won’t have to redefine the same actions over and over again for each automation.

For many group of devices I also tried to follow the same setup as used by tado: define a default standard schedule and allow to overrule it manually whenever desired. As soon as the manual overruling is no longer needs, return to the default automatic schedule.

  • I most often define a default automatic schedule using a specific Google Calendar: eg when outside lights need to turn on and off, when camera’s need to turn on and off, when water heating needs to trigger, etc.
  • Within the Home Assistant web and app interface, all buttons are available to overrule this automatic default schedule
  • I created for all these groups of devices a script to return to automatic state whenever launched. This ‘automatic’ or ‘default’ script became very important. Whenever a specific intervention is ended, I would not call to turn on or off a specific device, but always call this ‘auto’ script in order to make sure the device can return to the state it should be as defined by the default schedule.

For example: I created a default schedule to light up some outside lights in the evening based on a specific Google Calendar. But I don’t want to keep these light on all night, only in the evening and morning. Yet, I return home in the middle of the night, I still want these outside lights to light up for a short time. So the lights follow the schedule in the calendar and whenever I return while the sun is down, I make sure the lights will light up. But after a while, the light will not be turned off but the ‘auto’ script will be triggered to make sure they return to their default schedule. So the 'auto' script will detect if the lights should go on or off depending on sun state and calendar planning. I applied the same approach for cameras, heating, water heating, alarm etc. These ‘auto’ scripts tent to become complex with different conditions to cover all cases, but once defined, any automation can easily call such ‘auto’  script at any time without worrying about all special cases and combinations. This has proven to be very valuable.

Parallel processing

While writing different scripts and automations in Home Assistant, one should remember when an automation or script sequence is launched, all commands will be executed in the specific sequence one after another. If multiple actions would need to be executed in parallel, different automations can be created that get triggered. Eg by creating a variable (‘Configuration > Helpers’). As soon as the state of this variable changes, all automations depending on this helper variable state will be triggered and execution will be started in parallel. For an alarm activation this may be needed to make sure the different actions get triggered asap, such as recording, lights, notifications etc.

Icons Material Design

It is possible to assign custom icons to devices, buttons, scripts etc within Home Assistant. The easiest way to achieve this is by using Material Design icons, which are natively supported, eg using ‘mdi:account’ to get a kind of account/user type of icon.

As many icons are supported by Material Design, I mostly use this materialdesignicons.com website with good search capabilities in order to easily search through the long list of icons and try to find some icons that matches best my needs. Since late 2021 extra support has for Material iconas has been added withing HA which allows very easy Material Design icon selection within HA itself.

Most valuable uses cases to automate

  • Full autonomous alarm system: turning on and off based on location of the family members, see details above. It will turn on and off the in house cameras making sure the camera’s are only capturing when needed so to limit capturing private privacy in house activity.
  • Warn if the garage gate is open, with smart notifications to easily close the garage gate or trigger the alarm. As long as the garage gate remains open, the warning notification will triggered regularly (every 30min) to keep on warning the gate remains open.
  • Whenever the garage gate is open, start the garage camera to record any motion detected
  • Warn when leaving the house while some doors or windows are still open, indicating in the notification which door or window is not closed.
  • Warn when windows are open for a too long time, while it’s cold outside.
  • Warn when the battery of door and window sensors are getting low
  • Control the lights outside the house, to turn on and off based on sunset and sunrise or alarms
    • Flash the front door lights several times when arriving home and frost is expected the next day so to warn the car windshield should be protected against frost.
    • Turn off the lights in the middle of the night till morning, but when arriving home in this period, still turn on the front door lights for a short period while entering the house.
  • Turn on hall light at night or when cloudy weather
  • If motion is detected at the front door, cast a life feed to Google Nest Hub to see what’s happening
    • These use cases quickly became a bit more complex as exceptions where desired to only start the casting when someone is home and no casting on the hub was active. If some music casting was active, it would continue the music after a short interruption to show the front door camera stream.
  • Start camera recording when alarm is triggered
  • Warn if my car is unlocked for a long period or when it’s unlocked while no one of the family is close to the car.
  • When taking a bath in the bathroom, make sure the temperature of the bathroom is high enough and hot water heating is enabled.
  • Disable the bathroom ventilation system at night (as it makes too much noise).
  • Detect and notify high humidity (mostly in bathroom). If high humidity is detected, allow to easily turn on heating and enable bathroom ventilation system.
  • If a room heating is on yet some window is open in the same room, send a warning notification.
  • If warm outside and no rain is expected in coming days and it didn’t rain much in previous days, start the water irrigations system for a while early in the morning.
  • Turn on some color led lamp behind television when casting and making the led color randomly change when casting music.
  • When a song is playing on ChromeCast or Nest Hub, allow with one click to retrieve artist and song name and query it for immediate mp3 download on YouTube-DL to store the music in our offline music Plex collection. With some iOS shortcuts, any song we hear (eg on radio) can be identified (eg with MusiXMatch / Shazam) and the song name and artist can be forwarded through Home Assistant (since remotely accessible) which will trigger the mp3 download using YouTube-DL. This way, the YouTube-DL site and API don’t need to be publicly/remotely accessible, so all queries are forwarded via Home Assistant with REST API.
  • Monitor power consumption of fridge/freezer to get a warning if a long period is detected in which no power is used or very high power is used. I want to (try to) detect if the fridge has lost power or if the freezer door wouldn't be closed correctly (resulting in high power usage).
  • Monitor power consumption of our home. I have made a REST custom integration to fetch Pixometer.io values to be retrieved from the Pixometer.io API. I made my own custom HACS integration to retrieve Pixometer.io scan details.
  • Track fuel prices from mazoutvoordeel.be and get notified if low prices are detected and/or fuel tank is getting empty.
  • Track library loans and automatically extend loans when only couple of days are left, using my own custom HACS integration ‘Mijn Bibliotheek.be’
  • Track Telenet internet subscription usage (telemeter), with my own custom HACS integration Telenet Telemeter.
  • Track Youfone.be mobile phone and data subscription usage, with my own custom HACS integration Youfone.be.
  • Check if traffic to work or home might be slower than expected and show a map of the traffic using the Waze travel time integration.
  • 'Afvalbeheer' integration (installed via HACS) to get details of local waste collection. This allows to show specific warnings/notifications. If waste will be collected next day, but the garage door didn't open in last X hours or the phone is connected for charging in the evening, send special notification to highlight the waste collection. Example sensor configuration.yaml for Belgium (RecycleApp):
    • sensor:
    • - platform : afvalbeheer
      wastecollector: RecycleApp
      builtinicons: 1
      resources:
      - restafval
      - gft
      - papier
      - pmd
      postcode: !secret postcode
      streetnumber: !secret streetnumber
      streetname: !secret streetname
      cityname: !secret cityname
      printwastetypes: 0
      upcomingsensor: 1
      dateformat: '%d-%m-%Y'
      name: Recycle
      dutch: 1

Frontend web / app lovelace dashboards

I like to have all house automation easily accessible within the Home Assistant app using the interface (lovelace). Over time I’ve build different views and splitted these up as described below:

    • General quick-switch screen with big buttons to easily control all devices, lights etc.

     

    • Alarm screen with immediate view on main sensors and camera and allow to trigger alarm or cast camera to hub
      • A separate screen is available to show photo and video album gallery with recent camera captures of motion detections
      • A similar alarm main info screen is build, but with specific limited buttons specifically to cast to Nest Hub showing main info on small screen without need to scroll
      • It can also show some graphs with recent alarm and sensor activities. Whenever I show graphs, I added a selector to easily define the history horizon to show. This is performed using a simple helper input_number variable that holds the number of hours of history to be loaded.
        • Standard history graph lovelace entity config:

        type: history-graph

        entities:

          - entity: sensor.speedtest_download

        hours_to_show: 48

        refresh_interval: 0

        type: 'custom:config-template-card'

        variables:

          - 'states[''input_number.hours_of_history''].state'

        entities:

          - input_number.hours_of_history

        card:

          type: history-graph

          entities:

            - entity: sensor.speedtest_download

          hours_to_show: '${vars[0]}'

          refresh_interval: 0

          historygraph

          The same approach can be used with any other lovelace entity card type to have a dynamic parameter, eg I use the same on a map card to hours_to_show on a map:

          type: 'custom:config-template-card'

          variables:

            - 'states[''input_number.hours_of_history''].state'

          entities:

            - input_number.hours_of_history

          card:

            type: map

            entities:

              - entity: person.name

            hours_to_show: '${vars[0]}'

            default_zoom: 10

    • Car overview showing state of car windows and locks and showing mileage and remaining gas.
      • It can also show a map with car track in recent period and family members presence
      • As the Audi connected services allows to get status of many different windows and locks, I added a bullet on the car picture to easily see which door/window/lock would be on. More or less similar integration is possible with other car vendors such as BMW etc.:
      • audi

      • Home central heating screen with clear overview of room temperature and humidity. This screen will allow me to quickly change temperature, hot water heating, control bathroom lights and ventilation, see upcoming weather conditions, etc.
        • It can also show some graphs showing heating and temperature activity
        • Again the ventilation is not smart, but by just connecting it to a wifi relay, some control to turn on and off is possible even with cheap devices.
        • Media screen with overview of media playing and allow to quickly start YouTube, Spotify or plex media to stream to hub or ChromeCast devices. Also allows to control main devices by infra red to easily change volume, channel, etc. To integrate Spotify, I used the spotcast integration and developed a specific automation to detect if the Spotify playback is interrupted because it started to play on another device.
          • Full floorplan image of all house levels showing all lights and plugs and electricity connections linked to the fuses within the electricity box: Every light or plug is linked to a fuse wiring which enables to quickly see the fuse linked to a specific light or plug. Whenever I’d need to turn off a fuse, I would immediately see which other plugs or lights would be impacted. Any fuse can be enabled/disabled to see which plugs/lights are linked, as well as any light or plug can be enabled/disabled to easily see to which fuse it’s linked.
              floorplan
          • In order to allow easier configuration, I use many input helpers variables which are easier to change later on in order to tweak specific needs, instead of searching through all automations and scripts. With some templates this can be achieved, for example:
            • Condition on sun elevation with input_number variables:
              • {{state_attr('sun.sun', 'elevation') < states.input_number.sunset_elevation.state|float }}
            • Conditions based on humidity sensor with input_number variables:
              • {{states.sensor.room_humidity.state|float >= states.input_number.max_room_humidity.state|float}}
            • If for example a delay is required, it can be based on a variable input_number:
              • delay: '{{states.input_number.xxx_timeout_min.state| multiply(60) | int}}'

          Integration with other applications

          While setting up Home Assistant, the need rose to have an own multi media management platform, mainly for music, but also for some movies. So I added another docker container to run Plex and scan a folder with media files. Different plugins exist to integrate Plex with Home Assistant and the Plex Assistant looks promising, but is not yet setup (currently still missing full Dutch music support).

          Below service is used to cast Plex to ChromeCast script in home assistant scripts.yaml, the input_select.media_player helper is used to allow a drop-down choice of the ChromeCast device to cast too. Within the helper variable input_select.PlexPlaylist all playlists defined in Plex are listed so you can choose which playlist should be started when casting, a random song will be selected from this playlist:

          play_plex_media_selection:
            alias: Play Plex media selection
            sequence:
            - service: media_player.play_media
              data_template:
                entity_id: media_player.{{ states('input_select.media_player') }}
                media_content_id: 'plex://{ "playlist_name": "{{states(''input_select.PlexPlaylist'')}}",
                  "shuffle": "1" }'
                media_content_type: PLAYLIST
            mode: single
            icon: mdi:play-network

          To easily search a song on YouTube an cast it, I created a REST sensor based on YouTube API. Full details described in HA Community post.

          In order to easily download much from YouTube, I also added a docker container MeTube with YouTube-DL yt_dlp including API. This was integrated with Home Assistant via REST API in order to easily allow to download any YouTube music video to mp3. 

          By setting the YTDL_OPTIONS updatetime to false, this will result in the same behavior as passing the command line option --no-mtime to yt_dlp. This will make sure the timestamp of the downloaded file will be set to current time of download (now). Else the local downloaded file will receive the timestamp of the youtube upload timestamp provided in the youtube headers.

          docker-compose.yaml used for this YouTube-DLP MeTube:

            metube:

              # https://github.com/alexta69/metube

              container_name: metube

              image: "alexta69/metube"

              restart: unless-stopped

              network_mode: host

              #ports:

              #  - '8081:8081'

              volumes:

                - /home/plex/media:/mp3

                - /home/plex/movies:/video

              environment:

                - TZ=Europe/Brussels

                - UID=1000

                - GID=1000

                - 'YTDL_OPTIONS={"updatetime": false}'

                - DOWNLOAD_DIR=/video

                - AUDIO_DOWNLOAD_DIR=/mp3

                - OUTPUT_TEMPLATE=%(title)s.%(ext)s

          Rest command integration to allow REST http request from Home Assistant towards YouTube-DL within home assistant configuration.yml:

          rest_command:

            youtubedl:
                url: '
          http://localhost:8081/add'
                method: POST
                payload: '{"format":"mp3", "quality":"best", "url":"{{ youtube_url }}"}'
                content_type:  'application/json; charset=utf-8'

          Script to call YouTube-DL via REST API:

          download_youtube_mp3:
            alias: Download YouTube MP3
            sequence:
            - service: rest_command.youtubedl
              data:
                youtube_url: '{{ states(''input_text.youtube_url'') }}'

          search_download_youtube_mp3:
            alias: Search & Download YouTube MP3
            sequence:
            - service: rest_command.youtubedl
              data_template:
                youtube_url: ytsearch:{{ states('input_text.search_mp3_youtube') }}

          download_mp3_selection:
            alias: Download MP3 selection based on selected media player playing artist and song
            sequence:
            - service: rest_command.youtubedl
              data_template:
                youtube_url: ytsearch:{{state_attr(('media_player.' ~ states("input_select.media_player")), "media_artist")}} {{state_attr(('media_player.' ~ states("input_select.media_player")), "media_title")}}

          Once this is integrated, a webhook can also be defined within Home Assistant to allow a http call from other applications to pass through Home Assistant. Within Home Assistant automation.yaml. This allows for example to call your Home Assistant public dns with http query such as: https://homeassistant-public-dns/api/webhook/ytsearch?search=Faithless Insomina:

          - id: 'XXXX'
            alias: YouTube search and download webhook
            description: ''
            trigger:
            - platform: webhook
              webhook_id: ytsearch
            condition: []
            action:
            - service: input_text.set_value
              data:
                value: '{{ trigger.query.search }}'
              entity_id: input_text.search_mp3_youtube
            - service: script.search_download_youtube_mp3
              data: {}
            mode: single

          Having such a webhook, allowed me to define an iOS shortcut that would use Shazam and once the music has been identified, call the HA Webhook to immediately download the MP3 of the best YouTube video match. I have this iOS shortcut linked to a double or tripple tap on the back of my iPhone to very easily scan and download any song I hear without any further manual action.

          • Shazam it
          • Replace ‘&’ with ‘ ‘ in Shazam Media
          • Get contents of url (webhook + shazam query input) with HTTP method POST

          Further integration and optimizations with Plex have been shared in HA Community forum:

          Apple Watch and CarPlay integration with Home Assistant

          When using Apple Watch and CarPlay, iOS actions can be defined to easily trigger a Home Assistant automation and scripts.
          Yet, iOS actions don't contain actual status information of your Home Assistant. In order to overcome this and further extend the action with related actions, actionable notification are very powerfull.
          See information I wrote on this in the HA Forum and Apple Watch specific optimisations.
          To make the Apple Watch very powerfull, I defined several action such as 'Alarm Status', 'Media Status', 'Light Status', 'Heating Status'. These actions will just trigger an actionable notification to be returned immediately. And these actionable notifications contain actual HA status information and the actions linked to it can be defined dynamically and with actual status information.


          Update: 18/01/2024: Apple Watch and CarPlay information added.

          Update: 09/01/2022 taking into account some last HA updates such as much improved Tuya support and Material Design icons.

          Update: 21/02/2023: added info on Spotify and my own custom integrations

          Update: 10/07/2023: updated info on MeTube instead of YoutubeDL container

          Update: 13/12/2023: added extra blogpost links 

          Wednesday, December 18, 2013

          iTop running on Windows portable PHP/MySQL MoWeS

          Based on my previous topic informing about the nice functionalities of MoWeS to get easily and quickly a PHP/MySQL environment, I did set up an iTop environment in order to discover and play with the CMDB/ITIL ticketing service desk tool.

          While doing so, I also discovered the MoWeS Mixer is not available any longer. Apparently the company Chsoftware behind this tools has stopped in 2012. But the MoWeS tool still works very well on Windows 7 x64 and new packages can easily be added by updating the mowes.ini and packages.ini files manually.

          In order to get iTop running, some other parameters had to be updated as well: extra memory allocation is to be allowed in php.ini by changing the memory_limit from 32M to 64M. The php_soap.dll extension needs to be loaded as well by uncommenting it in the php.ini file. For mysql, the allowed packets needed to be extended by adding a parameter max_allowed_packet=500M within the [mysqld] section of the my.ini file.

          I’ve created an archive containing a clean MoWeS environment with clean iTop. The iTop still needs to be configured using the web wizard upon first connection to the iTop site (localhost/itop) (mysql username: root, password: <empty>. I’ve also a MoWeS environment with base demo iTop installed (itop username: admin, password: itop).

          Sunday, December 8, 2013

          vCard contact export from Excel contact list

          Recently I needed a way to easily convert a list with contact information into a vCard file, respecting the vCard syntax, in order to import this vCard contact information into a phone.

          After some quick Google lookup I ended with this nice Excel created and shared by Savas Geivanidis.

          After entering all the contact information into the sheet as instructed, the export macro started executing it’s work and I ended with a vCard file as I wanted. But the process took very long (more than 4 minutes), even if my contact list only contained 100 contacts.

          Since Savas was so kind to keep his VBS macro unprotected, I analyzed it and optimized it. The main performance issues I detected was the multiple loops and the cell deletions used in the code. A loop was set up to run over the contact data, and copy all data it into a new sheet. Next a loop was used to run through the data and delete all cell containing the value ‘no data’. Next the new sheet was saved into a text .vcf file.

          After rewriting the VBS macro I ended up with one loop, running through the data and saving the information immediately into a text file. The same list of 100 contacts now takes less than 1sec to export instead of more than 4 minutes. Some tests with 1000 contacts were positive as it took only 4sec or less to export. I ended up cleaning up the full sheet and creating a template of it to allow easy reuse. Feel free to use this version 1.0 of vCard Exporter for any purpose.

          The optimized source code is shown below for illustration:

          Sub Create_vCard() 

          '

          ' This Macro creates a vCard from an existing phonebook Excel list

          '__________________________________________________________________

          ' Based on DesktopContacts v0.8 by Savas Geivanidis (savas@mycosmos.gr) egnatia.ee.auth.gr/~aki/dc/DesktopContacts0.8.xls

          ' Major performance improvements by myT in vCardExporter v1.0

          '___________________________________________________________________

             
              Application.ScreenUpdating = False

              ' turns off screen updating

              Application.DisplayStatusBar = True

              ' makes sure that the statusbar is visible

             
              'detect number of data contacts provided

              'mainsheet = ActiveSheet.Name

              mainsheet = "PhoneBook"

              Range("A30000").Select

              Selection.End(xlUp).Select

              nod = ActiveCell.Row

              Range("B30000").Select

              Selection.End(xlUp).Select

              nod1 = ActiveCell.Row

              If nod1 > nod Then

                  nod = nod1

              End If

             
              'Check if data is provided

              If nod <= 2 Then

                  popup = MsgBox("No contact data could be found. Fill in the contact data in the 'PhoneBook' sheet and provide at least a first or last name for each contact." & vbLf & "See the 'Information' sheet and http://myTselection.blogpsot.com for more information", vbExclamation + vbOKOnly + vbMsgBoxSetForeground, "vCard Exporter: No data found")

                  Application.ScreenUpdating = True

                  Exit Sub

              End If

             
              'request target filename

              vcardname = Application.GetSaveAsFilename("", "vCard Files (*.vcf), *.vcf", , "Please select the name of the vCard to export")

              If vcardname = False Then

                  Application.ScreenUpdating = True

                  Exit Sub

              End If

              start_time = Now()

              Application.StatusBar = "Preparing VCARD data"

             
             
              Set vcardFileSystemObject = CreateObject("Scripting.FileSystemObject")

              Set vcardFile = vcardFileSystemObject.CreateTextFile(vcardname, True)

             
             
              'copy formula for VCARD syntax to all rows with contact data

              Range(Cells(1, 61), Cells(1, 101)).Copy

              Range(Cells(3, 61), Cells(nod, 101)).PasteSpecial Paste:=xlPasteFormulas

              Application.CutCopyMode = False

              Range("A3").Select

             
              Application.StatusBar = "Processing contact data..."

             
              vcardFile.writeline ("")

              For iRow = 3 To nod

                  For iColumn = 61 To 101

                      currentValue = Worksheets(mainsheet).Cells(iRow, iColumn).Value

                      Application.StatusBar = "Processing contact data " & Round(((iRow - 2) / (nod - 2)) * 100) & "%" '&" on row " & iRow & ", column " & iColumn & ", value: " & currentValue

                      If (currentValue <> "no data") Then

                          vcardFile.writeline (currentValue)

                      End If

                      If currentValue = "END:VCARD" Then

                          vcardFile.writeline ("")

                      End If

                  Next iColumn

              Next iRow

              vcardFile.Close

              Application.StatusBar = "All " & nod - 2 & " contact data processed"

             
              Worksheets(mainsheet).Range(Cells(2, 61), Cells(nod, 101)).ClearContents

              Worksheets(mainsheet).Range("A3").Select

              end_time = Now()

              'DateDiff("s", start_time, end_time)

              Application.StatusBar = "vCard export in " & PrintHrMinSec(DateDiff("s", start_time, end_time)) & "sec done into file: " & vcardname

              Application.ScreenUpdating = True

             
              If (nod - 2 = 1) Then

                  popup = MsgBox(nod - 2 & " contact is exported to:" & vbLf & "'" & vcardname & "'" & vbLf & vbLf & "Please send this file to your phone and run it in order to add this contact into it." & vbLf & vbLf & "Original development 'Desktop Contacts v0.8' by Savas Geivanidis (aki@egnatia.ee.auth.gr)" & vbLf & vbLf & "Major layout and performance improvements myT in 'vCard Exporter v1.0' - http://myTselection.blogpsot.com", vbInformation + vbOKOnly + vbMsgBoxSetForeground, "vCard Exporter: data exported")

              Else

                  popup = MsgBox(nod - 2 & " contacts were exported to:" & vbLf & "'" & vcardname & "'" & vbLf & vbLf & "Please send this file to your phone and run it in order to add these contacts into it." & vbLf & vbLf & "Original development 'Desktop Contacts v0.8' by Savas Geivanidis (aki@egnatia.ee.auth.gr)" & vbLf & vbLf & "Major layout and performance improvements myT in 'vCard Exporter v1.0' - http://myTselection.blogpsot.com"", vbInformation + vbOKOnly + vbMsgBoxSetForeground, "vCard Exporter: data exported")

              End If

              Application.DisplayStatusBar = True

          End Sub

          '***********************

          '* This function calculates hours, minutes

          '* and seconds based on how many seconds

          '* are passed in and returns a nice format

          Public Function PrintHrMinSec(elap)

            Dim hr

            Dim min

            Dim sec

            Dim remainder

           
            elap = Int(elap) 'Just use the INTeger portion of the variable

           
            'Using "\" returns just the integer portion of a quotient

            hr = elap \ 3600 '1 hour = 3600 seconds

            remainder = elap - hr * 3600

            min = remainder \ 60

            remainder = remainder - min * 60

            sec = remainder

           
            'Prepend leading zeroes if necessary

            If Len(sec) = 1 Then sec = "0" & sec

            If Len(min) = 1 Then min = "0" & min

           
            'Only show the Hours field if it's non-zero

            If hr = 0 Then

               PrintHrMinSec = min & ":" & sec

            Else

               PrintHrMinSec = hr & ":" & min & ":" & sec

            End If

           
          End Function

          Thursday, August 8, 2013

          Svn file full history

          If you’d need to search in the full history of a file stored in SVN, the script below can make an export of all changes ever applied into a file, starting for the first revision (full file) and adding each time an overview of all changes applied.

          If you remember you ever applied some changes in a file, but removed it afterwards, this can help to search in the full history. Only tested on text based files.

          For each revision, the revision number, author, timestamp and svn comments will be listed, followed by an overview of the removed lines, added lines, update lines etc. The initial revision will be a full extract of the original file.

          Usage: save the SvnFileFullHistory.bat script in an SVN folder next to the file for which you’d need a full history extract. Drop the svn file onto the bat script to start the script and retrieve the full history of the dropped svn file. The full svn file history will be saved in a txt file in the same folder and with the same base name as the file to extract, but adding “-FullSvnHistory.txt” behind the file name. The extract can take a while, depending on the number of revisions and the size of the svn file. But while the extract is ongoing, the “…-FullSvnHistory.txt” can be read already, reloading it to get future updates.

          A similar linux shell script has been created as well (not fully tested).

          Based on information found on stackoverflow by user ladenedge.

          Full script content:

          @echo off   
          TITLE SVN - Full file history
          REM Original source: http://stackoverflow.com/questions/282802/how-can-i-view-all-historical-changes-to-a-file-in-svn and http://stackoverflow.com/questions/5622367/generate-history-of-changes-on-a-file-in-svn/5721533#5721533
          echo Copy this bat script next to the checked out svn file on which to get full svn history. Drag and drop the svn file onto the bat script to start fetching the info (or a open command window and provide the name of the svn file as first parameter to the bat script execution)
          if "%1%"=="" pause
          set file=%1
          set report=%file%-FullSvnHistory.txt
          if [%file%] == [] (
            echo Usage: "%0 <file>"
            exit /b
          )
          echo Retrieving svn history of file, please wait...
          echo The report will be saved in the file: %report%.
          echo To stop the process press Ctrl+c.
          rem first revision as full text
          for /F "tokens=1 delims=-r " %%R in ('"svn log -q %file%"') do (
            svn log -r %%R %file% > %report%
            svn cat -r %%R %file% >> %report%
            goto :diffs
          )
          :diffs
          rem remaining revisions as differences to previous revision
          for /F "skip=2 tokens=1 delims=-r " %%R in ('"svn log -q %file%"') do (
            echo.
            svn log -r %%R %file% >> %report%
            svn diff -c %%R %file% >> %report%
          )

          Friday, January 21, 2011

          Salling Clicker - Windows Mobile

          Salling Clicker is a remote control software. It lets you control popular applications from a mobile phone or handheld computer through a user interface similar to a portable media player.
          You can choose to have the computer take action when you make or receive a phone call or get close to your pc. For instance, Salling Clicker can automatically mute the system volume while you're on the phone or automatically lock the pc while your gone.

          • Control PowerPoint, iTunes, Windows Media Player, and more with your mobile device.
          • Works with all major Bluetooth stacks (no configuration required).
          • Amazingly easy-to-use WiFi connectivity for long-range control.
          • Works with over 300 devices.
          • Easily extend support for other applications using JavaScript or VBScript

          Scripts

          Salling Clicker is installed with a set of default scripts (JavaScript for Windows) to support many different applications (PowerPoint, iTunes, MediaPlayer, etc.). On the forums of Salling Clicker many other custom scripts can be found, created and shared by the community.
          I've created a set of personal scripts, some are base on the official scripts, some are based on the scripts found in the forums and some are completely new. I just list all the scripts I use:
          • De Slimste Mens: as explain in this separate blog post, I've created a complete interface to control the Flemish game "De Slimste Mens".
          • myT Mouse Keyboard: full control for mouse and keyboard. Specially made for Windows Mobile devices with hardware keyboard (tested on Samsung Omnia B7310 and HTC Wizard (Qtek9100)). Use the screen to move mouse, use 'Menu' button to get context menu (mouse right click), use 'Help' button for extra options. To get a good overview of all options, I’ve put some screenshot online.
            Use hardware keyboard to send all keys. The used keys will be displayed on the main screen for easy action tracking.
            The extra option are:
            • switching of Shift/Ctrl/Alt/Win keys
            • sending special characters
            • sending function keys (eg F1-F12, pause, insert, delete, etc)
            • sending media keys (play next song, webbrowser control, etc)
            • sending long text: text input on device
            • open a file on pc: navigate to folder and open a file, recent file history, easy access to favorite locations (eg start menu, 'my documents', etc)
            • Zoom screen using freeware ZoomIt application, all ZoomIt options supported (pen, break, etc)
            • Show a screenshot of the pc on the main screen.
            • Exchange data from pc clipboard to device and/or put text into the pc clipboard
          • PowerPoint: distribuated by Salling Clicker
          • MediaPlayer: distribuated by Salling Clicker
          • MediaPortal: from forum
          • MediaCenter: from forum
          • iTunes: distribuated by Salling Clicker
          • BSPlayer: from forum
          • VLC: from forum
          • WinDVD: from forum
          • MSN Online status: from forum
          • uTorrent: from forum
          • ShutdownControls: shutodown/hibernate/standby/screen on-off/lock
          • Device Info: distiribuated by Salling Clicker
          • Disconnect: distiribuated by Salling Clicker
          • System volume: control pc volume
          • MuteWhileOnPhone: distribuated by Salling Clicker
          • CallNotifier: distribuated by Salling Clicker
          • LockComputer: distribuated by Salling Clicker
          • MonitorAway: distribuated by Salling Clicker
          • Show Message: show message on pc

          Monday, January 17, 2011

          Toshiba Tecra S11

          We recently replaced our old portable Lenovo ThinkPad T61 by the Toshiba Tecra S11, Intel® Core™ i5 M520, 2,40GHz, 4GB Ram.
          Although this new one is certainly not the best device available, as can be read in this technical review, it has some nice new features like a finger print reader, SmartCard reader, webcam, DisplayPort and a larger HDD (320GB).


          Drivers


          When we received the laptop, not all drivers were installed correctly. Additional drivers can be download and should be installed in the provided order:

          Toshiba official software download site: http://aps2.toshiba-tro.de/, 64 bit drivers

          Extras



          • The build-in SmartCard reader can be used to read the Belgian eID cards, and thus also to login on the Tax-On-Web pages. After installation of the SmartCard driver (see above) and a reboot, install the eID software and reboot again.

          • AutoSensitivity allows you to define different mouse sensitivities (speeds) for your touchpad and mouse and automatically switch between them (based on mouse connect / disconnect). This can be useful since the touchpad on this Toshiba is rather slow.

          • Windows Explorer extentions

          Update 22/05/2012: As I moved to Windows 64 bit, I added the link to download 64 bit drivers.

          Wednesday, December 1, 2010

          De Slimste Mens Ter Wereld

          (Nederlandse versie: zie onder)

          Jonathan Huyghe has made a nice little flash tool to let you play the popular Flemish TV show ‘De slimste mens ter wereld’ (The smartest person of the world) at home.
          Because I found it quite complicated to prepare the game, I made a little Excel template that should make it more straightforward to make all preparations for it. It can easily generate the required ‘antwoorden.txt’ file with the correct syntax and it can print out cards with instructions to be used by the host during the game play.

          Update 01/2016: An alternative version (independent of the version discussed below) is now available with full online management of the quiz. It works very well and very easy to create your own quiz's! See: http://deslimstemens.nu/

          User Manual

          1. Download this package containing the original sources of Jonathan Huyghe + Excel template ‘DSM-Voorbereiding.xlt’
          2. Open the file ‘DSM-Voorbereiding’ with Excel and allow macros to run.EnableMacros
          3. Fill in all grey marked fields (names of players, questions, answers). The other fields are protected so no mistakes can be made by accident.
          4. Some questions require .jpg images or .flv flash movies. The names and resolution of the files are put next to the questions. These files should be saved in the same folder next to the DSM .swf flash file manually.
          5. Save the Excel sheet, it is advised to save it in the same folder as the DSM .swf file
          6. Click on the top button ‘Exporteer antwoorden.txt’ to generate (or overwrite) the ‘antwoorden.txt’ file (in the same folder as the Excel file) based on the data provided in the sheet. This file is required by the DSM .swf flash tool.
          7. Click on the top button ‘Print steekkaarten’ to get a print preview of the instruction cards that can be used by the game host. All instructions, questions and answers are clearly put together to print out and use during the play. The cards can be printed out 2 or 4 per page to make it easier to hold them during the game.


          Examples


          I've made two quizzes using the Excel file with questions, images and movies:


          Extra



          • If some changes are required to customize the layout etc, the sheets can be unprotected (no password is used) using the Excel menus.
          • To convert movie files the freeware tools Format Factory and / or Riva FLV encoder can be used.
          • To convert / edit the picture files, the freeware tool Paint.NET can be used.
          • While exporting the 'antwoorden.txt' file, another file 'DSMData.txt' will be created (since v2.0). This 'DSMData.txt' file can be imported on a Windows Mobile pocket pc to get a very user friendly interface to control the flash quiz on a pc. For this, it will be required to install Salling Clicker on the PC and Windows Mobile device. Next this Salling Clicker 'De Slimste Mens' script needs to be added in Salling Clicker. A new item will be available in Salling Clicker on the Windows Mobile device. I've put some screenshots online.



          (Dutch – Nederlands)

          Jonathan Huyghe heeft een mooi flash programmaatje gemaakt om je thuis het populaire Vlaamse TV spel ‘De slimste mens ter wereld’ te laten spelen.
          Omdat ik het nogal omslachtig vond om het spel op te zetten, heb ik een Excel template gemaakt om alle voorbereidingen te vergemakkelijken en wat duidelijker te maken. Deze Excel laat toe om het bestand ‘antwoorden.txt’ te genereren met de juiste syntax. Ook kunnen steekkaarten afgeprint worden met alle instructies, vragen en antwoorden die nodig zijn tijdens het spelen van het spel.

          Update 01/2016: Een alternatieve versie voor het opzetten en spelen van eigen 'De Slimste Mens' (volledig losstaand van deze hierboven beschreven) is nu beschikbaar. Deze is volledig online beschikbaar. Deze kan volledig via de website http://deslimstemens.nu opgesteld en gespeeld worden. Dit werkt zeer vlot en hiervoor dienen dus ook de onderstaande instructies en Excel bewerkingen niet langer voor opgezet worden, volg gewoon de eenvoudige instructies op de website.

          Handleiding:

          1. Download dit zip bestand met alle nodige bestanden van Jonathan Huyghe en de Excel template ‘DSM-Voorbereiding.xlt’.
          2. Open het bestand ‘DSM-Voorbereiding.xlt’ met Excel en sta het uitvoeren van macro’s toe.EnableMacros
          3. Vul al de grijze velden in (namen spelers, vragen, antwoorden). De andere velden zijn normaal beschermd zodat deze niet per ongeluk kunnen gewijzigd worden.
          4. Voor sommige vragen is het nodig om .jpg afbeeldingen en .flv flash filmpjes beschikbaar te maken. De namen en de resoluties die hiervoor moeten gebruikt worden, staan aangegeven naast de vragen. Deze bestanden moeten manueel in de zelfde map als het DSM .swf bestand geplaatst worden.
          5. Sla het Excel bestand op. Belangrijk hierbij: sla het bestand op als een Excel Macro-enabled bestand .xlsm, en niet als een standaard Excel .xlsx bestand, anders zullen de macro’s voor het exporteren verloren gaan. Het is aangeraden om het bestand in dezelfde map als het DSM .swf bestand op te slaan.
          6. Klik op de bovenste knop ‘Exporteer antwoorden.txt’ om het bestand ‘antwoorden.txt’ automatisch aan te maken (of te overschrijven). Dit bestand zal in dezelfde map als het Excel bestand geplaatst worden. Het bestand ‘antwoorden.txt’ is nodig voor de werking van het .swf programma DSM.
          7. Klik op de bovenste knop ‘Print steekkaarten’ om een print voorbeeld te krijgen van de steekkaarten. Deze steekkaarten kunnen tijdens het spel gebruikt worden en geven duidelijk de instructies, vragen en antwoorden aan. De steekkaarten kunnen per 2 of per 4 per blad afgedrukt worden om ze gemakkelijker vast te houden tijdens het spel. Eventueel kan hiervoor de gratis CutePDF printer gebruikt worden om naar PDF te printen met 2 of 4 per blad.
          8. Open het bestand ‘DSM3x4.swf’ met Internet Explorer om het spel te starten, volg vervolgens de instructies op de steekkaarten.

          Voorbeelden


          Zelf heb ik 2 quizzen gemaakt, met de Excel met vragen, afbeeldingen en filmpjes:

          Extra




          • Als er wijzigen nodig zijn in de layout enz. kan het nodig zijn om de bescherming van de Excel tabbladen te verwijderen. Dit kan eenvoudig via de Excel menu’s (er is geen wachtwoord gebruikt in de beveiliging).
          • Voor het omzetten van de filmpjes kunnen de gratis applicaties Format Factory en / of Riva FLV encoder gebruikt worden.
          • Voor het omzetten / bewerken van afbeeldingen, kan de gratis applicatie Paint.NET gebruikt worden.
          • Bij het exporteren van het bestand 'antwoorden.txt', zal nu ook een bijkomend bestand 'DSMData.txt' aangemaakt worden. Dit bestand kan geïmporteerd worden op een Windows Mobile toestel om zo een zeer eenvoudige bediening van het volledige spel toe te laten. Hiervoor moet op de computer en de Windows Mobile PDA wel Salling Clicker geïnstalleerd worden en vervolgens moet dit Salling Clicker 'De Slimste Mens' script toegevoegd worden. Een nieuw item zal beschikbaar zijn in Salling Clicker op het Windows Mobile toestel. Enkele schermafbeeldingen.


          Update 2/12/2010 v1.4: Extra validation added for field lengths. Status bar message for export added. Added import functionality.

          Update 6/12/2010 v1.5: Added example quiz questions.

          Update 17/01/2011 v2.0: Added export for Salling Clicker