Skip to content

Instantly share code, notes, and snippets.

View tomasinouk's full-sized avatar

Tomas Blaha tomasinouk

View GitHub Profile
@tomasinouk
tomasinouk / conel-enable-disable-wireless.md
Last active November 3, 2017 14:45
How to enable and disable wireless (cellular, wifi) on Conel, SmartWorkx routers. This is more for v2 routers as v3 does have more options, such as entering power saving mode.

Solution to disable and enable radio interfaces on Conel, SmartWorkx routers based on time.

Solution is to change the setting of the router enable/disable and reboot the router for the setting to be used by router.

I used two time constants:

  • On timer - TIME_ON
  • Off timer - TIME_OFF

Script to copy paste into Configuration -> Start-up Script setting of the Conel router.

@tomasinouk
tomasinouk / parse_conel_smartworkx_gps.py
Last active October 27, 2016 22:29
Takes GPS and Cellular metrics from Conel, SmartWorkx router and write *.csv file. I used different method for parsing of each metrics as an exercise. Running Python from USB stick and writing file to a USB stick.
# run that in start-up script
# echo "Time UTC (GPS);Latitude;Longtitude;Altitude;Satellites;Fix;Speed over ground;Course over Ground;Date (GPS);Date (router);Time (Router)" > location_report.csv
import csv
import time
import datetime
import os.path
import os
csv_header_text = "Time UTC (GPS);Latitude;Longtitude;Altitude;Satellites;Fix;Speed over ground;Course over Ground;Date (GPS);Date (router);Time (Router); Cell Technology;Cell ID;Signal Strength;Signal Quality\n"
@tomasinouk
tomasinouk / conel,smartworkx-sms-email-alarm.md
Last active October 27, 2016 22:28
Conel, Smartworkx start-up script - alarm sms and email based on Input status

Installation

  1. Copy&paste into Start-up Script in the Conel router menu.
  2. Fill in your email and mobile number.
  3. Apply.
  4. Reboot the router.

Modification

Please refer to offical Conel documentation Commands&Scripts_v2_v3_EN

Script reads BIN0 (binary input 0) on the Conel, SmartWorkx router and displaying it in a console. Can be looged in systemlog as well. Little modification can be done to log it into the file, in CSV format.

#!/bin/ash

OLD0="-1"
SLEEP_TIME=1

while true
@tomasinouk
tomasinouk / battery_capacity_nodemcu
Last active August 3, 2016 17:36
Reading battery capacity nodeMCU - lua
id=0
-- represent actually PIN on nodeMCU such as
-- D7 and D5 in this case
-- GND needs to be connected
sda=7 -- GPIO13
scl=5 -- GPIO14
-- initialize i2c, set pin1 as sda, set pin2 as scl
i2c.setup(id,sda,scl,i2c.SLOW)
@tomasinouk
tomasinouk / extract-rename-files.py
Created June 23, 2016 06:17
recursively search for files in directories and copy them to new location with modified name
import shutil
import os
import re
source = os.walk("~/Downloads/camera/")
destination = "~/Downloads/mobotix-pic/"
# for files in source:
for root, dirs, files in source:
# print(files)
for _file in files:
@tomasinouk
tomasinouk / cybertec-snmp-get.py
Created May 4, 2016 01:06
Retrieve Tx, Rx metrics from cellular interface on Cybertec routers via SNMP and print out data.
from pysnmp.hlapi import *
import time
import datetime
# seconds between polls
interval = 60
# IP address of the Cybertec router
ip_address = '10.10.10.10'
# while True:
@tomasinouk
tomasinouk / RDC-BlueSolar-charger.md
Created January 31, 2016 22:02
Reconfigure BlueSolar solar charger to work with RDC

Modify setting of the Blue Solar regulator from Victron for smooth operation with RDC, if not already done by Madison Technologies.

Blue Solar - RDC charger

Detail instructions

How to connect to the regulator are here: https://www.victronenergy.com/live/ve.direct:mpptprefs

##Short version:

  1. Download the MMPTPREFS program here
@tomasinouk
tomasinouk / Westermo-SNMP-SHDSL.md
Last active November 18, 2015 01:44
Westermo SNMP SHDSL

Speed of SHDSL(1):

IF-MIB::ifSpeed.4096 = Gauge32: 15288000

  • OID: snmptranslate -On IF-MIB::ifSpeed.4096 -> .1.3.6.1.2.1.2.2.1.5.4096

SHDSL IN:

IF-MIB::ifInOctets.4096 = Counter32: 10923350

  • OID snmptranslate -On IF-MIB::ifInOctets.4096 -> .1.3.6.1.2.1.2.2.1.10.4096
-- control 2 first neopixels via RGB
--ws2812.writergb(2, string.char(100,255,0,255,0,0))
-- control 8 neopixels with same RGB color
-- ws2812.writergb(2, string.char(100,255,0):rep(8))
-- -- control 8 neopixels with same RGB color - turn off
ws2812.writergb(2, string.char(0,0,0):rep(8))