El plugin para Homebridge de la marca Yeelight del ecosistema de Mi Home es casi perfecto. Sencillo de instalar y funcional al máximo pero siempre esta en modo "debugging", y en la consola no paran de lanzarse mensajes de la red hablando entre los dispositivos que tienes logando cosas como estas en el estado de Homebridge:
2018-1-24 06:59:07 > send hb to: 0x0000000004521af0
2018-1-24 06:59:07 > {"id":-1,"method":"get_prop","params":["power"]}
2018-1-24 06:59:17 > send hb to: 0x0000000004521af0
2018-1-24 06:59:17 > {"id":-1,"method":"get_prop","params":["power"]}
2018-1-24 06:59:27 > send hb to: 0x0000000004521af0
2018-1-24 06:59:27 > {"id":-1,"method":"get_prop","params":["power"]}
2018-1-24 06:59:37 > send hb to: 0x0000000004521af0
2018-1-24 06:59:37 > {"id":-1,"method":"get_prop","params":["power"]}
2018-1-24 06:59:47 > send hb to: 0x0000000004521af0
2018-1-24 06:59:47 > {"id":-1,"method":"get_prop","params":["power"]}
2018-1-24 06:59:57 > send hb to: 0x0000000004521af0
2018-1-24 06:59:57 > {"id":-1,"method":"get_prop","params":["power"]}
2018-1-24 07:00:00 > {"id":1,"method":"set_power","params":["on","smooth",500]}
2018-1-24 07:00:00 > {"id":1,"method":"set_hsv","params":[30,68,"smooth",500]}
2018-1-24 07:00:00 > {"id":1,"method":"set_hsv","params":[255,68,"smooth",500]}
2018-1-24 07:00:00 > {"id":1,"method":"set_bright","params":[26,"smooth",500]}
La instalación y configuración del plugin es sencilla:
% sudo npm install -g homebridge-yeelight
La confiruración del archivo config.json
{
"platform": "yeelight",
"name": "Yeelight",
"verboseLogging": false,
"transitions": {
"power": 500,
"brightness": 500,
"color": 500
}
A pesar de haberle dicho que no diga muchas cosas en la configuración, no para de "hablar", esa configuración es ideal si estás buscando algún comportamiento en especial, pero si no, definitivamente está molestando.
Para paliar esto debes comentar un par de líneas del archivo "yee.js".
Lo buscamos en nuestro sistema:
% find . -name "yee.js" -print
Y comentamos las líneas:
//console.log("send hb to: " + that.did);
y
//console.log(msg);
Link al fork aquí.
Listos
The post Cuando Yeelight habla demasiado first appeared on Solusan.
Hace muy poco tiempo necesité resolver el nombre y la IP de un servicio de un dispositivo relacionado con el IoT. Se trata de Nature Remo. Un dispositivo capaz de mimetizar cualquier control remoto que trabaje por tecnología de infrarrojos.
En este caso utilicé la instrucción dns-sd. Éste programa no es libre y es el responsable de hacer hablarse entre ellas las máquinas de la manzana (Bonjour).
Esta es la intrucción:
% dns-sd -B _remo._tcp
Browsing for _remo._tcp
DATE: ---Sun 29 Oct 2017---
11:07:03.591 ...STARTING...
Timestamp A/R Flags if Domain Service Type Instance Name
11:07:07.835 Add 2 4 local. _remo._tcp. Remo-XXXXXX
% dns-sd -G v4 Remo-XXXXXX.local
DATE: ---Sun 29 Oct 2017---
11:08:56.804 ...STARTING...
Timestamp A/R Flags if Hostname Address TTL
11:08:56.806 Add 2 4 Remo-1FFDEF.local. 192.168.2.20
Y así finalmente obtenemos la ip qué necesitamos.
En linux tenemos la librería Avahi que podremos instalar así:
$ sudo apt-get install libavahi-compat-libdnssd-dev avahi-utils
Tecleando la instrucción:
avahi-browse -a
Obtendremos un listado de todas las máquinas de la red pero no aparecerá el servicio de dispositivo que estamos buscando, se esconde.
Esta es la manera de averiguar el nombre y posteriormente la IP del dispositivo Nature Remo.
% avahi-browse -tl _remo._tcp
+ eth0 IPv4 Remo-1FFDEF _remo._tcp local
% ping Remo-468D83.local
PING Remo-1FFDEF.local (192.168.2.20) 56(84) bytes of data.
Listos.
The post Cuando dns-sd no está disponible en tu sistema. first appeared on Solusan.
La domótica está en pañales, pero no recién nacida. Un ejemplo de ello es "Nature Remo", definitivamente es uno de los mejores periféricos que permiten controlar cualquier cosa que se deje comandar por un control remoto, pero "Nature Remo" trabaja casi por libre y la mayoría —por no decir todos—, los nexos de unión con algún asistente de control los hace mediante la aplicación IFTTT (If This, Then That). En definitiva, retales que se unen porque funcionan, pero sin algo que tienda a unificar de una forma elegante... o sí. Una de las aplicaciones reinas de la unificación y que permite crear automatismos que hagan la casa más inteligente es HomeKit de Apple, pero muy pocas marcas pueden pagar la certificación (es irrazonablemente cara) y lo hacen encareciendo el producto, entre otras cosas. Así pasa con muchos periféricos de tecnología IoT. "Nature Remo" no se queda atrás en ese aspecto y Homebridge se encarga de enlazar todos los dispositivos inteligentes y dotarlos de las características que tienen los accesorios HomeKit.
Vamos a instalar el servidor Homebridge en un MacOSX y luego añadir la configuración de "Nature Remo". (Parte de la documentación la he conseguido de diversas páginas en japonés puesto que Nature Remo es una start up japonesa que ha llegado a ser una de las oficiales de Google Home).
Sigue este enlace en el que detalla como instalar Homebridge https://github.com/nfarina/homebridge/wiki/Install-Homebridge-on-macOS
Una vez instalado Homebridge, necesitaremos conocer datos de nuestro dispositivo Nature Remo.
% dns-sd -B _remo._tcp
Browsing for _remo._tcp
DATE: ---Sun 29 Oct 2017---
11:07:03.591 ...STARTING...
Timestamp A/R Flags if Domain Service Type Instance Name
11:07:07.835 Add 2 4 local. _remo._tcp. Remo-XXXXXX
## Remo-XXXXXXを確認して置き換えて実行する。
% dns-sd -G v4 Remo-XXXXXX.local
DATE: ---Sun 29 Oct 2017---
11:08:56.804 ...STARTING...
Timestamp A/R Flags if Hostname Address TTL
11:08:56.806 Add 2 4 Remo-1FFDEF.local. 192.168.2.20
En este caso: 192.168.2.20
Después de esto necesitamos encontrar la codificación que utiliza el dispositivo que deseemos registrar en HomeKit. Para ello preguntaremos a Nature Remo mediante la instrucción:
% curl -i "http://192.168.2.20/messages" -H "X-Requested-With: curl"
HTTP/1.0 200 OK
Server: Remo/1.0.62-gabbf5bd
Content-Type: application/json
{"format":"us","freq":36,"data":[4339,4448,...]}
Si no te leyera bien y te diera un error 404, trata de encender y apagar el periférico. Lo mismo con el mando, "on" y "off".
Los resultados de la respuesta que te da en pantalla debes de ponerlos en el fichero de configuración de Homebridge:
Y este es un fichero de ejemplo de configuración:
{
"bridge": {
"name": "Homebridge",
"username": "CC:42:4D:A3:CQ:61",
"port": 51826,
"pin": "034-56-185"
},
"description": "Nature Remo Control",
"accessories": [
{
"name": "Room Nature",
"accessory": "NatureRemo",
"host": "192.168.10.34",
"path": "/messages",
"delayBefore": 0,
"delayAfter": 0,
"timeout": 2000,
"retry_interval": 500,
"retry": 3,
"on": {"format":"us","freq":37,"data":[3732,1946,402,525,418,1470,420,544,400,]},
"off": {"format":"us","freq":36,"data":[3732,1945,403,543,398,1471,420,522,418]},
"command_order": [{ "on": ["on"] }, { "off": ["off"] }]
}
],
"platforms": []
}
Necesitaremos instalar el plugin de Nature Remo con la línea que sigue:
% sudo npm install -g homebridge-nremo
+ homebridge-nremo@0.0.3
Luego podemos ya acceder al registro en HomeKit. (aunque en japonés, la imagen es altamente descriptiva).
Añadimos accesorio escanendo el código que nos da el servidor HomeKit.
Registramos Homebridge.
Nos avisa de que no es un accesorio certificado y le decimos que "a delante".
Una vez añadido, pulsamos "siguiente" hasta completar todos los pasos.
Ya podremos hablar con Siri para que accione los dispositivos que hayamos configurado.
Enlace de interés: https://www.imore.com/how-connect-non-homekit-devices-homekit-using-homebridge
The post Homebridge en MacOSX y Nature Remo first appeared on Solusan.
Un pequeño tip que me sirvió cuando me quedé sin batería (bueno y sin móvil) un día aciago:
Stuck away from home with a dead mobile phone battery, I needed an alarm clock—no sign of it in Date and Time.
The solution: use iCal on the MacBook. Set an event at the time you want the alarm. Set up an alarm action to open a suitably noisy audio file (which will open with iTunes if you have the default setup).
Make sure you set the alarm to go off on date (not 15 minutes beforehand as I first did). Make sure the volume is set high, headphones removed. Leave the lid open and, preferably, power connected. The alarm will wake the laptop from sleep, and play your song.
Update 2009-02-15 In Leopard 10.5.6 the alarm does not wake your computer from sleep In System Preferences >> Energy Saver >> Schedule, set your computer to wake a couple of minutes before the alarm goes off.
If you subscribe to any external calendars, set iCal offline — otherwise any alerts complaining that some calendar is unreachable will prevent the alarm from sounding.
The post Despertador OSX first appeared on Solusan.
Así.. sin valium y sin nada:
Amazon EC2 is among the more potent items in Amazon's web services arsenal. You've probably heard of many of the other services such as S3 for storage and FPS for payments. EC2 is all about the "elastic compute cloud." In layman's terms, it's a server. In slightly less layman's terms, EC2 lets you easily run and manage many instances (like servers) and given the proper software and configurations, have a scalable platform for your web application, outsource resource-intensive tasks to EC2 or for whatever you would use a server farm.
There are three different sizes of EC2 instances you can summon and they're all probably more powerful than the server currently running your blog. Unless you're offloading video processing or something intense to EC2, the default small instance with its 1.7GB of RAM and 160GB disk should be more than fine. It's just nice to know that if for any reason I need a farm of machines each with 15GB of RAM, I can get that easily.
EC2 has been around for a while but has gained interest in the last few weeks as Amazon released an elastic IP feature. One of the larger EC2 issues deals with data persistence on instances. There are many limitations with EC2 that make it difficult to use unless you carefully build around the EC2 architecture and don't just assume that you can move your app to EC2 flawlessly. If an instance crashes and you run it again, you'll loose data and when the instance comes back up it will have a new IP, adding another hurdle with DNS issues. Fortunately, the elastic IP feature lets you assign a static IP address to your instances.
As the title of this article implies, this article is meant to be a beginner's look into tinkering with EC2. Just because you will be able to host a page on EC2 at the end of this article does not mean you should start using it as your only server. Many considerations need to be made when using EC2 to get around the data persistence issue. If your startup is looking to use EC2 as a scalable platform, fortunately there are many services that have already built stable systems on top of EC2, ready for your consumption: WeoCeo, Scalr and RightScale. Enough talk, shall we jump right in?
Note: Most of the information below (and more) is available in the EC2 API doc if you enjoy reading those things.
In order to interact with any EC2 instances, you'll need to install Amazon's command line tools and download your X.509 certificate from Amazon. Let's start with the certificate. Login to your Amazon account and visit the AWS Access Identifiers page. In the X.509 certificate section near the bottom, click Create New. You'll be greeted with a page allowing you to download both the private key file and X.509 certificate. Both of these are very important, download them to your desktop so you don't lose them.
Next up, grab the EC2 command line tools. Extract them and you should be left with a folder named something like ec2-api-tools-1.3-19403. We'll move those to a directory where we will also store the private and public keys.
The commands below assume you are working on an OS X machine in the Terminal.
mkdir ~/.ec2
cd ~/Desktop
mv *.pem ~/.ec2
cd ~/Desktop/ec2-api-tools-1.3-19403/ #depends on ec2 tools folder name
mv * ~/.ec2
This is what your .ec2 folder should have now.
Next up, we'll set some paths in your bash profile so the OS knows where the EC2 tools are located.
sudo vi ~/.bash_profile
Add these lines, replacing "YOURKEYNAME" with the actual file name of your private and public keys, then save.
export EC2_HOME=~/.ec2
export PATH=$PATH:$EC2_HOME/bin
export EC2_PRIVATE_KEY=pk-YOURKEYNAME.pem
export EC2_CERT=cert-YOURKEYNAME.pem
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home/
To get the changes noticed by the OS immediately, run source.
source ~/.bash_profile
Now we can actually use those helpful EC2 command line tools.
Before proceeding, you'll need to grok the concept of AMIs. They are Amazon Machine Images and whenever you create an EC2 instance, an AMI is quickly loaded on the machine. They're essentially images of the OS. If you terminate an instance and bring it up again, your machine will only have the data initially included in the image. That's why lots of work goes into making ("bundling") a good image you will always use that has the configurations and software you need so you don't have to do much whenever you load the image. This article won't delve into creating your own AMIs but fortunately there are many great, public AMIs available for use.
To SSH into the instance we'll create from an AMI we find, we'll need to create a keypair. This is a different key from the one provided to us by Amazon. That was for using the EC2 tools and interacting with the instances in terms of creation and management. To actually SSH into an instance, a separate keypair is required as there are no passwords by default.
cd ~/.ec2 #we pretty much always need to be here
ec2-add-keypair pstam-keypair
That will print out the private key, which you'll need to copy and paste into a file manually.
vi ~/.ec2/id_rsa-pstam-keypair
#now paste the private key and save
sudo chmod 600 id_rsa-pstam-keypair
Now we can find which AMI we want to toss on our yet-to-be-created EC2 instance.
cd ~/.ec2
ec2-describe-images -a
Using the -a option will list all of the AMIs you have access to, and there are a lot. Alternatively you can list just the images Amazon has:
ec2-describe-images -o amazon
I found an AMI that I'll try out.
ami.yyang.info/gentoo-nginx-php-mysql-06feb2008.manifest.xml
It's a Gentoo Linux install with PHP, MySQL and nginx. When looking at AMIs, you need to find the AMI ID. In this case, it's ami-6138dd08.
ec2-run-instances ami-6138dd08 -k pstam-keypair
The instance is now being loaded with the AMI I selected and booting up. It should output some text with "RESERVATION" and "INSTANCE" rows. On the instance row, it will say something like pending pstam-keypair until it has fully booted up. When an instance is ready to go, its URL and internal address will be supplied with the ec2din command below.
ec2-describe-instances
If you try to access the URL in a browser, nothing will happen just yet as the firewall blocks all ports by default. You'll have to open up the ones you need. We'll do port 80 for HTTP and 22 for SSH. If the AMI you are running doesn't have a web server installed, accessing the EC2 URL in a browser won't bring up anything regardless.
ec2-authorize default -p 22
ec2-authorize default -p 80
If you want to undo any port authorizations you've made, you can use ec2-revoke. Now if you access your EC2 URL in a browser you'll get something like a default Apache page, or in the case of the AMI I'm using, a phpinfo() page.
The next step to actually using your new EC2 instance is SSHing into it to get full root access. Run the line below and replace the EC2 URL with the one provided to you by the ec2-describe-images command earlier.
ssh -i id_rsa-pstam-keypair root@ec2-XXX-XXX-XXX-XXX.z-2.compute-1.amazonaws.com
If you run into the problem I did, this won't work and you'll be asked for an EC2 instance password that doesn't exist. I found out this was because I initially created the id_rsa-pstam-keypair file as the root user but ran the ssh command as a regular user which was not able to access that keypair. That was easily fixed with sudo chown Paul id_rsa-pstam-keypair but you won't have this issue if you followed this guide.
Otherwise, you should be logged into your EC2 instance as root over SSH. Now that we're in, we can tinker with the system however we like and even see what kind of hardware we're running on, setup FTP and drop a web app into /var/www/localhost/htdocs or whatever. Having full root access in any OS you wish is one of the boons of using Amazon EC2.
If you plan on running your instance for good, you'll want a static IP. Let's get one for you.
ec2-allocate-address
Now we just need to tie that IP address to the instance ID of the instance you wish to give a static IP. You can grab the instance ID (not to be confused with the ami-* AMI ID) by running ec2-describe-instances.
In the line below, replace XXX.XXX.XXX.XXX with the IP address you were given above and replace i-yourinstance with your actual instance ID.
ec2-associate-address -i i-yourinstance XXX.XXX.XXX.XXX
Give it a few minutes and your instance will be accessible through that new IP in addition to the longer EC2 URL we were previously using. Please note that if you terminate the instance, the IP does not remain tied to the instance, to the best of my knowledge. Terminating an instance seems to be a nuclear option compared to simply rebooting an instance via regular unix commands over SSH.
Now that the instance has an IP you can setup a domain name with it if you want. The easiest way I've found of doing this is through a DNS service like EveryDNS. Just provide your domain name registrar with EveryDNS's domain name servers, create an EveryDNS account, add your domain and create an A record with your newly associated EC2 instance IP address.
The TTL on EveryDNS seems to be fixed at 3600 so it might take a while for propagation, especially if you're used to pushing down TTL to 300 when doing DNS work.
Killing your instance for good can be done, like every other action, through an EC2 command line tool. This time, it's the appropriately named ec2-terminate-instances (ec2kill). Just provide it with the instance ID of your instance (get it from running ec2din).
ec2-terminate-instances i-yourinstance
It should return with a "shutting-down" status but you'll definitely want to check back in a few minutes with ec2-describe-instances to make sure it shutdown successfully and comes up as "terminated". There are a few cases where instances will hang on shutdown and you will continue to be charged for instance hours.
Now that you've successfully launched your first Amazon EC2 instance, you're ready to begin exploring the endless EC2 possibilities. I'm still learning about taking the next step but overall, EC2 really isn't something to mess with unless you have quite a bit of sysadmin and development experience. Actually using EC2 as an elastic compute cloud usually involves setting up an instance as a load balancer and giving that instance access to an array of active EC2 instances which it can hand work to. Other hurdles include providing multiple instances access to the same database, using Amazon S3 as a persistent filesystem and employing highly redundant backup systems given the relatively volatile nature of instances.
The post How To: Getting Started with Amazon EC2 first appeared on Solusan.
Excelente este truco que he encontrado en Tech-Recipes (vía Lifehacker) para obtener la longitud y latitud de cualquier localidad o calle o plaza o edificio… en Google Maps. La fórmula es bien sencilla:
javascript:void(prompt('',gApplication.getMap().getCenter()));
Sencillo, y muy útil. Que te aproveche.
Vía: http://mangasverdes.es/2007/06/09/como-obtener-la-longitud-y-latitud-en-google-maps/
The post Cómo obtener la longitud y latitud en Google Maps first appeared on Solusan.
Configurar iCal:
Ahora toca configurar iCal para que se sincronice con GCal. Abrimos iCal y seleccionamos la opción de menú iCal/Preferencias… y luego Cuentas. Nos aparecerá esta pantalla:
Pulsa en el botón + que apareceabajo a la izquierda. Aparecerá una nueva ventana en la que debemos introducir estos datos:
Vía: http://elmundoesmovil.blogspot.com/2010/05/tutoriales-ipad-calendarios-con.html
The post Sincronizar gCalendar con Mac, iPhone e iPad first appeared on Solusan.
Problema:
Filtras un CD y te aparecen varias catárulas en el navegador de titulos. Es un bug.
Se arregla selecionando todos los temas y en las propiedades (cmd+i) en una de las pestañas te deja marcar el disco como una "recopilación", lo haces y aceptas y después repites el proceso desmarcando esa opción y si el resto de tags son iguales en todo el disco ya debería salir bien, como un solo cd.
Gracias @AluminiuM
The post iTunes varias carátulas un sólo CD first appeared on Solusan.
Pequeño tip para pasar multitud de archivos a minúsculas.
En mi caso fueron 11540 sin problemas.
#!/bin/sh
# Do the directories first, so that the
# path doesn't change
for each in `find . -type d`
do
newname=`echo $each | tr [A-Z] [a-z]`
mv $each $newname
done
# Now to the files...
for eachf in `find . -type f`
do
newnamef=`echo $eachf | tr [A-Z] [a-z]`
mv $eachf $newnamef
done
ソル三。
The post Pasar muchos archivos de mayíusculas a minúsculas first appeared on Solusan.
- Has activado el kernel de tu MacBook en modo 64 bits?
Una breve reseña para activarlo de modo temporal y permanente.
Temporal:
Permanente:
<key>Kernel Flags</key>
<string></string>
<key>Kernel Flags</key>
<string>arch=x86_64</string>
ソル三
The post Kernel a 64 bits en Mac OS X first appeared on Solusan.