Posts mit dem Label coding werden angezeigt. Alle Posts anzeigen
Posts mit dem Label coding werden angezeigt. Alle Posts anzeigen

2021-10-17

Update: Display TTN-Gateway status

After migrating my TTN gateway to the new The Things Stack Community Edition (see previous blog post) my script to display the gateway status stopped working. The reason behind was, that the new stack does not provide the noc api which was used in the script.

After searching in the TTN forum I found the thread New API for gateway mapping, status and info. Using this API I just need to change one line in my script and now it works again.

-  cmd = "curl -s http://noc.thethingsnetwork.org:8085/api/v2/gateways/eui-b827ebfffe06902a | jq -r '.timestamp'"
+  cmd = "curl -s https://mapper.packetbroker.net/api/v2/gateways/netID=000013,tenantID=ttn,id=eui-b827ebfffe06902a | jq -r '.updatedAt'"
The updated script is available in the github repo.

2020-03-20

Using Cucumber with Gradle with tags

I want to run Cucumber from Gradle with the possibility to specify tags. Here is a build.gradle to do this:


  • gradle cucumber - will run all cucumber scenarios but not these tagged with @Ignore
  • gradle cucumber -P tags=@Smoketest - will run all smoketests but again will ignore these with the tag @Ignore.

2020-01-03

TTN-Gateway in a box

During the last days I worked on the installation of my TTN-Gateway into a case. This is the result:






Beside the LoraWAN hardware I have installed an OLED display and 3 sensors (1x Si7021, 2x DS18B20). The OLED display is connected via I2C, the sensors via 1-wire and I2C.

The sensor data is read by Python3 Script and published with MQTT. The OLED is also controlled by a Python3 script. Both scripts run as systemd-service.

The software is available on github.

2019-04-29

ESP8266 based SensorNode

In last weeks I put together a Sensor-Node based on ESP8266. The software part provides:
  • the standard WiFiMonitor to setup the WiFi credentials
  • a web page to configure the connected sensors
  • a web service to read the configuration and current sensor values
  • the data are published via MQTT in a format to be feed into a influxdb
The following sensors are supported:
  • DS18B20 (multiple)
  • BME280
  • Si7021

SensorNode config page
SensorNode configuration page

I designed a board to be put into a USB port with a temperature and a humidity sensor. 
SensorNode circuit
SensorNodeUSB circuit

SensorNode pcb bottom side
SensorNodeUSB PCB bottom side

SensorNode pcb top side
SensorNodeUSB PCB top side
More information can be found in the GitHub repo SensorNode.




2012-11-04

Infinitest with TestNG 6.8 support

Infinitest is an eclipse plugin which executes after editing files all corresponding unittests. After using infinitest for a while I realize that some features of TestNG 6.8 are not available by infinitest itself (in my case assertNotEquals). And therefor result in a reported problem.

Fortunately the project is availible on github and so I fork the project and change it to support TestNG 6.8. An pull request to the original project is waiting.

If you want to try it on your own risk - you can download it here. To install it in your Eclipse you have to unzip the file in the eclipse/dropins directory. I have test the version on Win7 and OSX with Eclipse 3.7 - and it seems to work ;-) 

2012-10-19

Unittest to verify that static method is called

.. using PowerMock, Mockito, TestNG

In example the class under test (cut) has a method showErrorMessage(msg). This method will call the static method JOptionPane.showMessageDialog(...) to show a error message.

I wrote a unittest to

  1. mock the showMessageDialog call - because otherwise the test will fail with an java.lang.VerifyError (UIManager is not initialized)
  2. verify that showMessageDialog is called + with the right parameter

2010-10-02

Single-Hand Watch - Win7 Gadget

On my wishlist is a single hand watch from BOTTA which not only has only one hand but also has a 24h display - see UNO24.

To check if I able to cope with this sort of watch I make a Windows 7 gadget of such a watch. The picture shows the watch at about 11:30 pm.

The gadget can be downloaded here.
In the source code repository also the svg files are contained, if you want to create your own design.

2010-08-12

Define cucumber environment in .couchapprc

When you set-up a .couchapprc file you can define different databases, hosts ... for different environments (see couchapp doc).
To use these set-up when running cucumber I modify the env.rb mentioned here. It use the test environment defined in .couchapprc for cucumber scenarios.


Example .couchapprc file:

2010-08-01

BrainDump: CouchDB link cheatsheet

Note: "File" and "folder" refer to a couchapp directory structure.

{prefix} = /{db}/_design/{application}
{list_function} = name of file in lists folder (without .js)
{show_function} = name of file in shows folder (without .js)
{view_function} = name of subfolder in views folder

functionality link function Read on
list {prefix}/_list/{list_function}/{view_function} function(head, req) CouchDB book
show {prefix}/_show/{show_function}/{doc_id} function(doc, req) CouchDB book
view {prefix}/_view/{view_function} map: function(doc)
reduce: function(keys, values, rereduce)
intro,
view parameter

2010-07-22

BrainDump: irb - require returns LoadError: no such file to load

Situation:
irb(main):011:0> require 'json'
LoadError: no such file to load -- json
 from (irb):11:in `require'
 from (irb):11
 from :0
irb(main):012:0> require 'rubygems'
=> true
irb(main):013:0> require 'json'
=> true
irb(main):014:0>  

Solution:
Do
require 'rubygem' 
before

2010-07-10

Culerity, Cucumber and Couchapp - Part 2

Some further modifications in the files mentioned here were necessary to get the initial setup runable.
(System configuration: WinXP, JRuby 1.5.1, CouchDB 0.11, couchapp 0.6.2)
  1. step_definitions/common_culerity_steps.rb - add this
    1. def couchapp
    2.   'rem' # enter your couchapp name here
    3. end
  2. support/paths.rb - modify

    Before:
    1.     when /start page/                                            
    2.       "/#{database}/_design/#{database}/index.html"
    3.     else                                                        
    4.  
    After:
    1.     when /start page/
    2.       "/#{database}/_design/#{couchapp}/index.html"
    3.     else
  3. step_definitions/common_culerity_steps.rb - remove ":resynchronize => true," from
    1.     $browser = Culerity::RemoteBrowserProxy.new $server, {
    2.       :browser => :firefox,
    3.       :javascript_exceptions => true,
    4.       :resynchronize => true,
    5.       :status_code_exceptions => true}
    6.  
  4. start_page.feature - modify the example scenario to
    1.   Scenario: go to the start page        
    2.     When I go to the start page          
    3.     Then I should see the text "Generated CouchApp"

After this modifications I got:
E:\projects\privat\rem>jruby -S cucumber --no-color
Feature: start page
  In order to feel welcome
  As a user
  I want to be welcomed on the start page

  Scenario: go to the start page                    # features\start_page.feature:7
2010-07-10 17:01:12 [INFO] Visit your CouchApp here:
http://localhost:5984/hejhej/_design/rem/index.html
    When I go to the start page                     # features/step_definitions/common_culerity_steps.rb:90
    Then I should see the text "Generated CouchApp" # features/step_definitions/common_culerity_steps.rb:119

1 scenario (1 passed)
2 steps (2 passed)
0m8.625s

E:\projects\privat\rem>

2010-07-09

Culerity, Cucumber and Couchapp

Starting a new couchapp application I want to try BDD. I found a small tutorial how to testing couchapps with cucumber and culerity. Unfortunatly I have to deal with WinXP, and so I run into some trouble because the culerity server doesn't start. Finally I can solve it by insert "jruby " in culerity-0.2.10/lib/culerity.rb, line 28.

Before:
def self.run_server
   IO.popen(File.dirname(__FILE__) + "/../bin/run_celerity_server.rb", 'r+').extend(ServerCommands)
end
After:
def self.run_server
   IO.popen("jruby " + File.dirname(__FILE__) + "/../bin/run_celerity_server.rb", 'r+').extend(ServerCommands)
end

2010-01-27

Semantic Versioning

Semantic Versioning defines "a simple set of rules and requirements that dictate how version numbers are assigned and incremented. For this system to work, you first need to declare a public API."
Read on ...