• G

    Yes, indeed. It’s an sonoff s20 with espeasy installed.

    posted in Rules and Scripts read more
  • G

    Maybe some of you got one of those fancy vacuum robots while they where on sale? The Xiaomi Mi Robot is currently on sale for 257€ (gearbest.com) - I thought I share my setup to let the robot clean my home without using the chinese app at all.


    First of all, I used mirobo to control the robot via wifi. I disabled internet access for the robot (via my router), so it can’t dial out to it’s chinese friends, but can still be managed remotely.

    For me easy handling and auto shutdown was essential, so the charger won’t stay on 24/7. I use pimatic rules to control the robot. So whenever I leave the house and want it to be cleaned, I press a button before leaving, indicating for the robot to do it’s job while I am gone. It will wait for everyone to leave the house and start cleaning, charge again until the battery is full and then shutdown the charger, resulting in a clean home and no energy wasted.

    1. Install mirobo https://github.com/rytilahti/python-mirobo and discover your robot. Note your IP and Token. Also block internet access to the robot once discovered.

    2. Using a simple shell script to query the robot for status

    # Author georg90@github.com
    trim() {
        local var="$*"
        # remove leading whitespace characters
        # remove trailing whitespace characters
        echo -n "$var"
    # Set robot ip
    ROBOT = ''
    TOKEN = '12345678765432234'
    ping -q -c2 $ROBOT > /dev/null
    if [ $? -eq 0 ]
        echo "Robot is online"
        mapfile -t lines < <(sudo mirobo --ip $ROBOT --token $TOKEN status | cut -d ":" -f2)
        # state
        state=$(trim ${lines[0]})
        battery=$(trim ${lines[1]})
        fanspeed=$(trim ${lines[2]})
        #in cleaning
        incleaning=$(trim ${lines[4]})
        echo "Robot is offline"
        state="Turned off"
    echo $state
    echo $battery
    echo $fanspeed
    echo $incleaning
    # Update variable in pimatic (example)
    curl -X PATCH --header "Content-Type:application/json" --data '{"type": "value", "valueOrExpression": "'"$incleaning"'"}' --user "user:pass" http://$ROBOT:8080/api/variable-incleaning
    1. Using pimatic rules, you can control your robot even more


    Frontend controls


    Any ideas to improve the setup? What do you think?

    posted in Rules and Scripts read more
  • G

    I am cucrrently trying to learn some more JavaScript, so I’ll try to implement this as a plugin.

    At the moment I cannot afford to buy the set, but once I have the set I’ll start working on this.

    posted in Plugins read more
  • G


    I wonder if anyone is already working on implementing the Mi Smart Home eco system into pimatic?

    Sensors are very cheap and use Zigbee!

    It’s seems not too much trouble, since there is already a package for npm: https://www.npmjs.com/package/mijia or https://www.npmjs.com/package/miio.

    Also FHEM and OpenHAB have an implementation running: https://github.com/T0RST3N/fhem-XiaomiSmartHome/wiki / http://docs.openhab.org/addons/bindings/mihome/readme.html

    Anybody interested in this? Implementation should be similar to pimatic-max (with the Mi gateway as controller). Also the yeelight plugin could be a starting point.

    Since I don’t have the skill / time to do it alone, I would be more than happy if someone picks it up.

    posted in Plugins read more
  • G

    Using a DIY smart home system I imagine people need to look into other technical topics as well… Most of documentation, blogs and forums are in English. So I guess it is wise to speak at least a little bit of English (in general!)
    I as a German don’t like this sub section, which will lead to all questions into one sub and split the community even more.

    But I guess people asking for a German sub forum is just a very German thing to do - Why go the extra mile if you are “the majority of people” as @noxx puts it…

    I am confident people can use Google Translate to understand mostly everything and use it to ask further questions or ask one of their fellow Germans to translate / help further. If the language keeps you from doing something, maybe other missing skills will, too?

    posted in Announcements read more
  • G

    Thanks for the reply!

    Yeah, I was referring to the submodule, which needs >4.3.
    I am installing 4.8 right now and will try if this fixes my problems with pimatic-hap.

    Thanks for the quick help!

    posted in pimatic v0.9 read more
  • G

    Hi @mwittig!

    Are you sure about 4.6? Can I use 4.8 (latest LTS?)?
    Some of the submodules of the pimatic-hap plugin require node 4.3, I only have 4.2.6 installed.

    Sorry for hijacking :(

    posted in pimatic v0.9 read more
  • G

    Since I wasn’t happy with the ddos/login protection given by pimatic itself, I added some “fake” security to it using fail2ban. I am calling this fake security, since you don’t prevent attacks, you just deal with it by banning the attacker for a given time.

    I am assuming you have fail2ban ready and setup. Since pimatic isn’t logging failed logins we need another service to log those failed logins. apache2 is our friend! I am using different subdomains on my local server, one for pimatic (eg. smarthome.mydomain.com) and others (cloud.mydomain.com) and have a error/access logfile for each of them.

    My pimatic vhost looks like this:

    #### Smart Home (smarthome.mydomain.com) #####
    <VirtualHost *:443>
    ServerName smarthome.mydomain.com
    ####Configuration for SSL #####
    Header always add Strict-Transport-Security "max-age=15768000"
    SSLEngine on
    SSLHonorCipherOrder on
    SSLProtocol all -SSLv2 -SSLv3
    SSLCompression off
    # Let's encrypt ssl files
    SSLCertificateFile /etc/letsencrypt/live/mydomain/cert.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/mydomain/privkey.pem
    Include /etc/letsencrypt/options-ssl-apache.conf
    SSLCertificateChainFile /etc/letsencrypt/live/mydomain/chain.pem
    ProxyVia On
    ProxyRequests off
    ProxyPreserveHost On
    <Proxy *>
        Order allow,deny
        Allow from all
    ProxyPass /
    LogLevel warn
    ErrorLog /var/log/apache2/smarthome.mydomain.com-error.log
    CustomLog /var/log/apache2/smarthome.mydomain.com-access.log common

    As you can see pimatic is running on port 8080 and all connections coming to smarthome.mydomain.com are getting redirected to pimatic.

    For fail2ban we’ll need a custom filter and jail:

    pimatic.conf in /etc/fail2ban/filter.d/

    # Fail2Ban pimatic filter
    #log entry looks like this:
    # - - [20/Jan/2017:11:32:00 +0100] "POST /login HTTP/1.1" 401 621
    failregex = <HOST> - - .* .*(POST|GET) .*(\/login|/api/.*) HTTP.* 401 .*$
    ignoreregex =

    This will catch failed logins (http error 401) for the webinterface & api requests.

    custom jail

    enabled = true
    port = https
    filter = pimatic
    logpath = /var/log/apache2/smarthome.mydomain-access.log
    maxretry = 3
    bantime = 1800

    reload fail2ban & check if it’s working:

    $ fail2ban-regex --print-all-matched /var/log/apache2/smarthome.mydomain.log /etc/fail2ban/filter.d/pimatic.conf
    Running tests
    Use   failregex filter file : pimatic, basedir: /etc/fail2ban
    Use         log file : /var/log/apache2/smarthome.mydomain-access.log
    Use         encoding : UTF-8
    Lines: 202 lines, 0 ignored, 7 matched, 195 missed [processed in 0.10 sec]

    Hope this helps someone :)

    posted in Rules and Scripts read more

Looks like your connection to pimatic forum was lost, please wait while we try to reconnect.