Posts

Telsa Powerwall 2 install in Australia - Accessing Data

Image
The Goal Access the house/battery/grid/solar data from my new Telsa Powerwall 2 install to use in my home automation and dashboards. This was pretty straight forward to do, which makes a nice change from accessing my Envoy data which was a lot more complicated. Install Details I've just had this installed on 26 Jun 2019 on the Gold Coast in Australia. Telsa Powerwall 2 Backup Gateway 2 3 phase power The Steps 1. Accessing the local Gateway The Gateway 2 supports a cellular, ethernet and wifi connection. My installers had only setup the cellular connection, so I needed to setup the wifi connection. If the Gateway 2 is using you home wifi already you should be connect directly to it on your home network. Setting up the Wifi connection So I needed to connect the gateway to my home wifi. I used my mobile phone to do this. Connect to the Gateway's wifi point TEG-* I was only prompted for a password - which is displayed inside the Gateway 2 unit, at the top of the technical det

Huawei Modem/Router sending encrypted requests

This relates to my Huawei python API here . I'm adding a dedicated post on this as I expect it may be useful for others. This took me quite a while to get working and I couldn't find any working solutions online. This implements the javascript RSA encryption used for encrypting requests to be sent to the modem's underlying API in python. The javascript code is: function RSAEncrypt(text) { var m = pkcs1pad2(text,(this.n.bitLength()+7)>>3); if(m == null) return null; var c = this.doPublic(m); if(c == null) return null; var h = c.toString(16); if((h.length & 1) == 0) return h; else return "0" + h; } The python code I got working is: import uuid import hashlib import hmac from binascii import hexlify import math import base64 from Crypto.Cipher import PKCS1_v1_5 from Crypto.PublicKey.RSA import construct def rsa_encrypt(rsae, rsan, data): if (data is None or data == ''): return '' N = long(rsan,16) E = long(rsae,16)

Caprice ceiling fan voice control - Part 2 of 2

Image
The Mission To enable voice control for the fans and lights of our new Mercator Caprice ceiling fans. So we can say things like: Alexa turn the office fan on/off Alexa start/stop the office fan Alexa turn the office fan to 80% (The same commands can be used for the fan light) The Steps Step 1. Figure out the radio frequency (RF) commands for the fans Step 2. Set up an RF sender on one of my Raspberry PIs Step 3. Develop a script to control the fan Step 4. Configure voice control via Alexa Step 1 and 2 are covered here . Step 3. Develop a script to control the fan I use two scripts, available here . send_rf.py -- Handles sending the command to the RF sender on the Raspberry Pi rf_control.py -- Receives commands in the format rf_control.py <room> <cmd>. For example: python rf_control.py office light These scripts handle converting the room and command into the string of 0's and 1's, which are then broadcast. Step 4. Configure voice

Caprice ceiling fan voice control - Part 1 of 2

Image
The Mission To enable voice control for the fans and lights of our new Mercator Caprice ceiling fans. The Steps Step 1. Figure out the radio frequency (RF) commands for the fans Step 2. Set up an RF sender on one of my Raspberry PIs Step 3. Develop a script to control the fan Step 4. Configure voice control via Alexa Step 1 - Determine the RF commands I purchased a DVB-T 820T2 radio tuner. Like  this one  on ebay. I used my Windows desktop, and installed the USB dongle and the Universal Radio Hacker (URH) software from here . (These would work on my Raspberry Pi3, but required quite a bit of memory and were a bit slow). 1. Determine fan radio frequency I fired up the URH Spectrum Analyzer. I knew the fans were likely be around 433 MHz or 315 MHz. Once running press a button on the remote, I could see a signal spike. Ok so close to 433 Mhz. 2. Analyse and decode the signals This probably took the longest amount of time, but decoding the signal was pretty fun. This time I

Port Forwarding on Optus 4G B525 router

Image
The port forwarding or "Virtual Server" settings are not available in the Optus customised web UI. However the underlying XML based API of the router still supports the function, at least for my B525s 65a model. So I've documented a couple of ways you can interact with the router API and set up port forwarding. Important!: Port forwarding will only work when the other device can access the private 10.*.*.* Optus IP Address of the router. I use it so my Optus mobile can access my home network. If you wanted to expose a service to the general internet then this likely won't work. Option 1 - Use the python API I've developed at  https://github.com/jinxo13/HuaweiB525Route r For those with scripting or programming experience Option 2 - Use Chrome and the Servistate plugin to interact with the B525's API directly I've provided a step by step guide - no programming experience is required Option 1 - Use the Python API Step 1 - Check the curre

Huawei B525 Python API

Image
As mentioned in my last post I was tinkering with the Optus provided Huawei B525 router features. I've now manged to implement a few commands and MAC filtering via a Python2 API. You can read more here:  https://github.com/jinxo13/HuaweiB525Router So far I'm using it to: Monitor my usage (I have a 500 GB cap) Implement time scheduling for my kids devices Here's my usage display in Grafana. I run OpenHab and persist the data from the Router using the python API into an Influxdb database that Grafana uses. Here's my current Grafana display: The API will work with the following model: B525s-65a And may work with these others: B618s-22d B715s-23c So far I've got MAC filtering implemented and a few API's to get traffic and other information. Currently supported calls: GET Requests ---------- getInfo() => api/device/information getTraffic() => api/monitoring/traffic-statistics getStats() => api/monitoring/month_

Experience with Optus 4G wireless broadband

Image
Some background, where I try not to gripe about NBN... O NBN!, wherefore art thou NBN! That pretty much sums up my experience over the last year, having relocated from Sydney with a decent NBN connection, to an ADSL1 connection in the Gold Coast. I was then left waiting for either an ADSL2 port to free up (not likely to happen) or NBN to finally arrive. NBN was expected here in Dec-18 and is now due in Dec-19.... So with NBN delayed another year, I was well and truly over my current connection. For the record I had 6 Mbps download and 0.3 Mbps upload. So uploading a picture to facebook would kill my internet. It's hard to believe this can be sold in Australia as an adequate service.... right not griping, moving on. Thankfully this is all behind me with the introduction of Optus's 4G wireless broadband plans, which were released in November 2018 replacing the Vividwireless service. Based on our usage of around 380 GB per month, I selected the the $80 500 GB plan. The