Spin remote and why it just doesn’t work

So i ordered one of these gadgets, in the movies it all looks flashy and shiney. It does this too when all is connected and freshly installed. But as many home automation owners know, there is 1 thing a gadget must obey.. the WAF factor (Wife Acceptance Factor) so she comes into the kitchen and i tell her that it can do something with the speakers. She peaks it up and says its shiney. But it just blinks red, because the connection is cone on IOS (yet again) this is a known issue with ios but then don’t sell it as that good. Anyways, even when it is connected it takes some time to reconnect if it is in the background. If you click on it and it doesn’t respond straight away.. the misses will throw it out.

If the Wife clicks on “Print page” and she has to click on it 2x, maybe 3x she will just get upset. Same applies here. For Infrared devices it is a nice addition but the whole point is that you should be able to do more and without line of sight. I would rate this gadget as a 8 on design. A 1 on WAF factor. Useability a 3.

.. if it looks to good to be true, it usually is. (and yes i wrote this article out of frustration of trying to get it to work properly and it just didn’t)

Doorbird in place, with custom front plate.

Doorbird is a nice little gadget i would say that can let you see and hear the people in front of your door. Not only that, you can actually turn on infrared if its too dark although i would have imagined it would auto switch to infrared but it doesn’t (or i am missing some setting, found one but have not seen it actually flip in the night)

It has a extra option that you can open the door, you can use wires or adjust the notifications in the device to send a api request to your device of liking. I prefer the last one because if someone rips this of your wall and you have 2 wires that can open the door, would be kind of silly.

Still use Fibaro at home so i just call my scene that opens the door for me when i press the button, still adjusting the IR motion to trigger the lights in front of the door, that way i don’t need IR turned on since its enough light because of that (and i can trigger the light only when its dark)

Below is an example image, you can see open door, turn on IR or start to talk. I do have the option turn on for confirmation, since if you show this to someone and they go ‘what does this key button do?’ and click on it.. well that is not handy if your not home. Now you get a confirmation. Sadly this confirmation is also for the IR and talk part. I only want a confirmation for the door.

And here a nice picture of my custom made doorbird frame. Looks rather sharp no? 😉

SIP will be in the future, i wonder if some form of SIP will be supported with Fibaro. Although the need is not high since we can use a seperate app but it would be easier to have 1 app do all. We shall see what the future will hold.

There is a topic on the Fibaro Forum on how to integrate the camera, and a device so you can manage the IR and Door, but that is only handy if you need it in a automated way i would say. If your interested to know what it can do API wise, check out the docs about it.

Solar Power here i come too..

So it was my turn to get some solar power. Now powering 26 panels with 300wp each. This should get me around 6000 kwh a year! Now i should reduce my footprint a bit more and break even 😉

Next is to get it integrated a bit more. You can attache pretty much all those data collectors to a system called pvoutput just like you had Seti back in the days and join a team. I have Enphase and it has an api too. So you can collect your data from there and read it into fibaro. See https://developer.enphase.com/docs/quickstart.html which works for me. I’ll see if i can get some metrics about how much was produced the current day into Fibaro. I’ll update the post when i do.

QR Codes ING Ideal payments?

Some background, the ING (bank) app can generate QR codes for payments. Let someone scan and no more typing that irritating long IBAN number.

Ever since i’ve seen the QR codes i though it would be nice to use this on forms/paperwork and other kind of stuff. So at some point i looked into it and it was pretty straightforward. But you can’t just take pictures of your mobile phone with the QR Code. So there must be something online somewhere? Well long story short, there is none. So i took the needed details, whipped a qr-code library around it and https://ideal.bytework.eu/ was born. Since its mostly used in .nl, its in dutch.. but you get the idea. Could create an API for it, but i don’t think that should be my job, this was just for fun to see how it works. Grab the code from https://github.com/riemers/ing-ideal-qr-generator

Royal TS API Server

If you don’t know Royal TS, read my older post.

https://github.com/riemers/royalts-api on here you can find the API i created in order to create your own documents for royal ts. In large company’s (i work for one) you might be administrating multiple systems (rdp/ssh/whatever) and these days all is about automation and zero touch. Still things break down and if you have an application that has 40 servers you don’t want to add 40 servers to a royal document. So i automated the process. I just create my own custom json string (which can be seen in the readme, pretty straightforward and simple) and it will create a .rtsz file for you to use instantly with Royal TS itself. If you want to see it for yourself, or play around just go here: https://royalts.bytework.eu/

Just paste your json in it, and click on the “Give me my document now thingy” 🙂

Just make sure the json is correct json format, otherwise it will break. But since all is automated on my end, there is not much breakage either. Find any issues? Feel free to point it out

Don’t want to use an API? But create your own little gadget? No problem either. The creation of the document is separated into a npm package. You can always check the API package for examples on how to make a document. This is only for node packages though. Have fun.

Royal TS & Why i like it so much

Royal TS is an application which replaces the one that i used many years, Putty. Since i almost never reinstall my pc/mac/whatever i usually keep al my hosts in there. If you had to reinstall you would loose your settings unless you do some fancy registry or %appdata% stuff in order to maintain them. I no longer have that issue and also have a integrated scp with it too, something Putty also does not have.

Lets give an example use case, one i actually use it privately for. I have multiple clients which i administer there machines for, this could be any type of service (rdp/ssh/services) but mainly its just ssh for me (royal does support more, even vmware stuff) so you have a list of servers say 10 of them. But that is client A. You also have client B which has 15 servers. You do not want to combine these in 1 big document, you could.. but i just don’t like that. The client also has access to the servers and if he adds a server or i add a server we both have to update the document. So in this particular case i use dropbox and share it with the client. You can set a master password on that particular document. So to sum up my setup as example.

Customer A – 10 servers ssh (dropbox share customer A)
Customer B – 15 servers ssh (dropbox share customer B)
Customer C – 5 rdp servers? (dropbox share customer C)

And all these documents can be loaded all at once in royal ts. You can even save the credentials for all your logins per document. But it gets better, you can also have your own account on these servers, you don’t want the client to login under your account so you can even say that the credentials used will be from the parent. Your parent could be the root folder of all those documents and could be a credential called “Unix” Now we only have 1 more document to load in, which is our private one which holds all our private stuff (including Unix credential) and we have a complete separation of Customers and Passwords (with either encrypted or passworded files on top, in case you don’t trust dropbox)

And where to begin there? You have a complete plugin system, so there are even more options to go from. One to always get is also the file transfer plugin. Easily click on the plugin once connected with ssh and it will open up a file transfer window with the same credentials. Can’t get any easier right?

You want to just run a certain command, but you do it all the time? Make a sequence for it! You want to run the same command on all servers? Sure no problem. You want to just run command ad-hoc on all servers? No problem too.

Sure some tools out there have overlap, but since it comes for mac and windows and only costs a few bucks (yes i know putty is free, but development is pretty much stopped there) some do more, some have multi windows too (which it does fine too) but do they also have rdp? remote windows services? vmware remote? file transfer?

And another nice one is that you can save documents in “share” mode. That means if your working all in the office sharing 1 file and working on it, it will alert you to reload to document if someone saved something new. It will just add the data to the file so it will always be current for all.

I loved it so much, that i even wrote a API for it (you can host it on its own) which takes json and creates a document for you. But you should read the other post on that.

Any questions/remarks, feel free to ask.

npm build with proxy failures (WARN retry will retry, error on last attempt: Error: tunneling socket could not be established, cause=connect EINVAL)

Just because i always forget this stuff. If you ever have above error message and you use a proxy with npm to download files. Just make sure that your environment or proxy related settings include “http or https” at the start.

So HTTP_PROXY=http://<yourproxy>:<port> same implies for https_proxy etc etc

If you forget this, build could still run correctly. In my case i had a internal repo for npm (sinopia) so when a package wanted to download something from github it failed because of this.

Kodi & Synology & Tvheadend & Oscam & Ziggo & picons & hdhomerun & Smargo/Smartreader

Kodi is a mediacenter, Synology is a NAS, Tvheadend is a piece of server software for things like television and oscam is a cardreader client/server. Put this all together and you have a PVR client. This basicly allows you to have TV from your own provider, in my case Ziggo. Together with some nice logo’s which is referred too as picons. (i don’t use a physical tv card but instead i use hdhomerun)

This is not your standard cup of tea. I thought it might be a click and go but its not.

  1. Install hdhomerun
  2. Install tvheadend
  3. Install usb drivers
  4. Install oscam
  5. Configure CAS (card sharing)
  6. Configure picons
  7. Setup Tvheadend (Kodi)
  8. Leftovers

Things to know before you start. If you use a Synology disk station and you want to install something that might not come from a repository make sure you have the right package. You can find what architecture you need from http://forum.synology.com/wiki/index.php/What_kind_of_CPU_does_my_NAS_have in my case a DS415+ which is a avaton.

1. Just download the latest package from hdhomerun website. I do have a windows client with me so i can just run that one. After doing so it will automaticly update your version to the latest which is a good thing. Follow the instructions, its pretty straightforward. You should be able to watch free to air with the right client (you can test that if you get stuck later on to make sure its not this issue)

2. Add to your package center the following repository: http://syno.dierkse.nl/ after that you will find your tvheadend-testing. I did have one issue that a certain version (latest) didn’t work for me. I picked 1 version lower and installed it manually. Strange thing is that i could upgrade it and then i would still have the latest. (if you browse to the url you can still find the correct one too)

Once done you should be able to go to http://<ip>:9981/ in there go to “Configuration -> DVB Inputs -> TV Adapters” You should see 4 adapters right now for hdhomerun already. (this is the easy part) Go to the next tab “Networks” click on “Add” and select DVB-C (important) Add a name (in my case Ziggo) and leave the defaults it should be good. Now go back to the TV Adapters tab and select the 4 tuners. There you have the select the network is Ziggo which you just defined. Network id should be “5555” for ziggo, leave the rest as it is again. At this point it should create 4 muxes int he tab “Muxes” but it doesn’t do much this is because its not running on the correct mhz. For Ziggo this is 474000000. (Information like 5555 and 474 can be find here at the providers page here) so change all 4 muxes to point to the correct 474 range and then go back to the TV adapter and select all interfaces (edit -> enable -> select network you just created) it should show active muxes and services. On the Services tab it should start to populate the channels. Depending on how things are done you can always google around, this part didn’t cost me that much time.

Last thing here to do is to “map” the channels, as long as you don’t map them it wont show anywhere! So on the “Configuration -> DVB Inputs -> Services” you can just make the list bigger by clicking in the right bottom corner. Then just select all channels you want and then click the “Map Selected” (you can do Map All but i don’t want the crap) DONT forget to mark the “include encrypted channels” otherwise it will skip them out of the selection.

3. As far as i know there are 2 ways to install it (i found that out later) but the one that worked for me was using the ipkg from http://ipkg.nslu2-linux.org/feeds/optware/syno-i686/cross/unstable/syno-i686-bootstrap_1.2-7_i686.xsh Just download it, chmod +x it and sh <file> run it. After that you have ipkg working and can get the drivers for most smart card readers (ipkg install usbutils) Or like i stated the other way. I do believe http://jadahl.dscloud.me/sspks/packages/UsbSerialDrivers_3.0.2.spk should also just work (it picks the correct architecture for you)

4. Oscam, download it manually. I could not get it via repo but its at http://oscam.myqnapcloud.com/oscam/ or https://packages.fastxl.nl/index.php?fulllist=true so in my case i had to get the avaton one. Now this one is a real “pain” so many manuals say what you have to do, some of them tell you to do a lsusb to get the bus and device numbers which might just work for you but it didn’t for me. Even if you go to oscam at http://<ip>:8888/ and go to readers and scan usb it didn’t show me anything. In the end i just typed in “dmesg” on my nas after i plugged in the device and saw /dev/ttyUSB0. I am using this right now because i don’t have a better solution. Just remember that this device name can change pretty quick on reboots!

Now for the settings, go to files and just fill in all this info:

oscam.conf

</pre>
[global]
logfile = /usr/local/oscam/var/oscam.log

[cache]

[newcamd]
port = 10000@0604:000000
allowed = 127.0.0.1,192.168.1.0-192.168.1.255
key = 000102030405060708090A0B0C0E
keepalive = 1

[webif]
httpport = 8888
httpallowed = 127.0.0.1,0.0.0.0-255.255.255.255

oscam.user

</pre>
[account]
user = <username>
pwd = <password>
au = 1
group = 1
ident = 0604:000000
cccignorereshare = 1
cccstealth = 1

oscam.server

</pre>
[reader]
label = Ziggo
description = Ziggo
protocol = mouse
device = /dev/ttyUSB0
caid = 0604
boxkey = 1122334455667788
rsakey = 3C8633AAC0D367533DEC7BB2EEEDEB8CA3ADA52E58B99BB34672783277A1DAAC3B6106AD0909774E031B2A6E30195B437683AD0FC599B87D08CEA47BE1B6C76A
detect = cd
mhz = 600
cardmhz = 600
group = 1
emmcache = 1,3,2,0
blockemm-u = 1

Things that could be different for providers: Caid, boxkey, rsakey, ident. The “key” that is used in oscam will be used later in tvheadend. Now that all these things are in place, make sure you set the reader to mouse and the usb device you found with “dmesg”. Normally you could set instead of mouse “smartcardreader” or something like that and use the device/bus but like i said, i could not get that to work. Now go to the Readers-> Reload Readers. You should see something in the Live Logs. At some point it will say Success. Just keep in mind that if you play around with this thing and you get weird error messages that if you “overload” your card you have to reinsert the card and try again. You will only see the overload message in “dmesg” so pay attention to that too. Also if you want EMM (updates off the card every month so you don’t have to re-activate it each time) you need the “cccXXXXX” stuff in the oscam.user. Otherwise you will get: “Will not forward EMMs (not allowed by server)” error message in tvheadend.

5. Assuming it works you need to add this oscam server to tvheadend. Go to “Configuration -> CAS -> Add” and fill in the details from above (from oscam.user & newcamd) so port in this example is 10000 and userid/pwd is the one you filled in for oscam.user and the DES key is the key from newcamd. (And also mark the update EMM options) so in the future if tvheadend has an encrypted channel it will use this CAS server to get the keys from the card from your smartreader. A small note for Ziggo card users, you might need to go to the ziggo website and choose smartcards and click the “reset” button or whatever it is called if you have some issues. Best thing -> install it in a tv, make sure it works, then use it.

6. This is straight forward, go to “Configuration -> General -> Picon” Select prefer picons. In the Channel and picon path i just fill in “http://picons.bytework.eu/” Credit where credit is due, found those at https://www.sat4all.com/forums/topic/344764-nieuw-07-02-2015-ziggo-radio-tv-xpicons-metal-look/?p=2288286 so you need to find the correct pictures for your provider and upload them somewhere for ease of use (you can do it locally on the synology too but if you share your setup externally it wont work)

7. Kodi setup tvheadend: http://kodi.wiki/view/PVR/Backend/Tvheadend its pretty clear, setup PVR, choose tvheadend, use the username/pwd you used to enter tvheadend or create your own. Pictures will show up too eventually same for EPG (usually takes some time)

8. At some point i got a lot of crap error messages like “viasat_baltic: invalid checksum (len 183, errors 106)” etc etc, turns out the EPG Grabber has the “over-the-air-grabbers” turned on for Viasat, Opentv, UK etc. Just disable that and your good to go clean.

Update: Turns out you can set the protocol to “smartreader” and use the tool on your NAS, in my case its located in “/volume1/@appstore/oscam/bin” and doing “./list_smargo” gave me this output:

iNas> ./list_smargo
Looking for smartreader compatible devices...
bus 002, device 004 : 0403:6001 Smartreader2 plus (type=SRv2, in_ep=02, out_ep=81; insert in oscam.server 'device =
SRv2;Serial:smartzig')

So it even tells you what you need to add to oscam.server 🙂

Fast Caching facts ansible

Using certain options already improved speed for ansible. Gathering facts is still something that can consume some extra time. In order to improve this on a lot of machines if you use them often is to cache the facts. On the original docs they suggest that you install redis. On ubuntu that would be redis-server. Don’t forget to install the redis python module as such.

pip install redis

Then you would have to add the settings to ansible.cfg in the default section.

gathering = smart
fact_caching = redis
fact_caching_timeout = 86400

Only to find out that you get an error back

File "/usr/local/lib/python2.7/dist-packages/redis/connection.py", line 574, in read_response
raise response
redis.exceptions.ResponseError: NOAUTH Authentication required.

Turns out as also stated on the documentation that port/password is not yet supported. Although i did find a page that uses a host/port in the config for ansible.cfg.

Anyways, edit your redis.conf file and find the word “requirepass” and comment it out. Restart redis after it.
And there you go, error resolved 🙂

For reference on the gathering option in ansible:

# smart - gather by default, but don't regather if already gathered
# implicit - gather by default, turn off with gather_facts: False
# explicit - do not gather by default, must say gather_facts: True

Ansible & roles_path

So you have some nice roles and a great playbook. Your getting bigger (hence my post, same story) and you want to split up certain parts into say playbooks for “db”, “web”, “app” and such. So you create a folder called playbooks/app/ and have a main.yml in there. Only thing is that you also add a role again in that main.yml. Default behavior of Ansible is to look at the PATH entry’s you have but in my case i don’t want it to look in my path just my local folders in my “roles” directory since i download them locally rather then placing them “globally” which normally requires Root (which i think is not so good way of adding roles because for all we know, you don’t have root) Long story short you need to add something to ansible.cfg. Like the ssh connection options to improve speed, this however had me a bit confused. You can read up on the docs but it doesn’t really say it.

I had this in my ansible.cfg:

[ssh_connection]
pipelining=True

Then i added “roles_path=roles” and nothing happened. Well if you look closely you would notice its underneath the “ssh_connection” part and it would fall under that. I didn’t know you had to add it to [default] for it to work. Perhaps that is the default if you don’t set anything but for me it took some time. So i ended up with:

[ssh_connection]
pipelining=True

[defaults]
roles_path=roles

And that did the trick (assuming you do have all your roles in the “roles” folder)