Monday, December 21, 2020

Adding MQTT to gateway 2.x

MQTT was somehow last step of adding features present in gateways 1.x to gateway 2.x. Now with last version of 1.3 release, already available in GitHub releases, this come to live. For now only publish functions are implemented, but subscribe procedures and skeleton is already prepared. Beware that 1.3 release forces whole configuration to be erased! I suggest to take screenshots of each page before upgrading. I know it is not very convenient, and I will try to implement mechanisms that such future changes will be a bit elegant. That is without the need to reconfigure whole gateway again.

MQTT publish functions are now having their own thread, that is collecting queue of publish request. The thread then pushes one publish a time when system allows it.

The publish structure is a bit different, as it now more relies on given indexes and addresses rather then on names of elements. Main topis is OHS with subtopics:

 /state {On, Off} - Indicates if system is on
 /group
   /{#} - index of group
     /name
     /state {disarmed, arming, armed_home, armed_away, triggered, disarming}
 /zone
   /{#} - index of zone
     /name
     /state {OK, alarm, tamper}
 /sensor
   /{address} - node address like W:2:K:i:0
     /name
     /value

There are other small changes like Nodes tab is now showing value of authentication nodes, that is a name of person who last armed/disarmed this node. Same name is also passed to MQTT sensor value for same node type.

You can test now new 1.3 version with initial MQTT support, but there can be some rough edges.

Wednesday, December 16, 2020

Expansion board

Gateways 2.x have now a slightly reduced numbers of input. This is a little trade off from previous versions 1.x that have 8 analog(balanced) and 4 digital(unbalanced) ports. 2.x gateways have increased the balanced inputs to 10 ports, and also added ability to switch any of this port to be treated as unbalanced one. But there is no digital only port. Instead I started to design new extension board that will allow to add 8 extra ports. These ports will also be hybrid, meaning that they can be switched in software to unbalanced. The board is already in fabrication and should look like picture on right.

I did not yet started coding, so I hope it will be still possible with good old ATmega328P. Also not sure if this application has need for RTOS, or if it is doable only in as standard Arduino sketch.

Anyway it has possibility to expand the zones by 8, and the connection can be established via wire(RS485) or radio(RFM69). It has onboard relay and similar power detection circuit as gateway. There are only 2 free pins left that are taken out to allow some user application like additional relay board.

Gateway firmware is already able to allow 2 such boards to be connected.