Skip to content

Release Upgrade Paths

coldfire84 edited this page Jan 5, 2020 · 38 revisions

See Feature Roadmap for detail of roadmap/ release progress.

Release 0.11

  • Add .env file, details in "Deploy Your Own" wiki section.
  • Add .ghomejwt.json, details in "Deploy Your Own" wiki section.

Convert user.superuser attribute to boolean (from number):

db.accounts.updateMany(
	{superuser: 1}, 
	[{"$set": {"superuser": true }}]
);
db.accounts.updateMany(
	{superuser: 0}, 
	[{"$set": {"superuser": false }}]
);

Copy mqttPass attribute to password attribute:

db.accounts.updateMany(
    {}, [{"$set": {"password": "$mqttPass" }}]
);

Update all user accounts to be 'active' - this is part of a planned release for user account management.

sudo docker exec -it mongodb /bin/bash
mongo mongodb://localhost --authenticationDatabase admin -u '\<admin user\>' -p '\<password\>'

use users

db.accounts.update({},
{$set : {"active":true}},
{upsert:false, multi:true}
)

Add indexes on username for accounts and devices collections, this will ensure performance remains acceptable as user and device count grows beyond several thousand. With ~1,000 users and 3,000 devices the execution of the aggregation command dropped from 11,640ms to 160ms!

sudo docker exec -it mongodb /bin/bash
mongo mongodb://localhost --authenticationDatabase admin -u '\<admin user\>' -p '\<password\>'

use users

db.accounts.createIndex( { username: 1 } )
db.devices.createIndex( { username: 1 } )

Release 0.8/ 0.9

  • Add AWS CloudWatch / JSON file, details in "Deploy Your Own" wiki section.
  • Update MQTT topics to include 'message/<username>/#' as outlined here.
  • Use vCurrent (at time of writing 0.4.48)

Release 0.7

Upgrade steps/ path:

  • For the hosted instance, simply update Node-RED nodes then change your mqtt and web API hostnames to:

    • Web API hostname: red.cb-net.co.uk
    • MQTT hostname: mq-red.cb-net.co.uk
  • For your own instance, you need to:

    • Update the AWS Lambda code
    • Update web app/ API container and the Node-RED nodes.
    • Uncomment '/admin/update-schema' router and browse to this location as superuser, this will prepare schema / copy data to new elements to support Google Home.
    • Create a new Google Service OAuth Application via '/admin/services'
    • Setup your Google Action with correct OAuth account linking endpoints (same as Alexa Config)

Release 0.6

  • Rate-limiting now in-place on more API and Web endpoints
  • Revised TOS and Privacy Policy in-place, with new links on login and register pages
  • Web-UI usability enhancements; tool-tips on device capabilities, banner on landing page notifying user of need to contact for extension of the beta

Code changes:

Release 0.5

  • Admin interface extensions (useful if you are hosting)
  • New capabilities (require node-red-contrib 0.4.14 onwards):
    • ChannelController capability added (supporting number and name, not SkipChannels)
    • PercentageController
    • Speaker interface
    • TemperatureSensor
  • Introduce rate limiting on getstate API (requires new redis server)
  • "Dummy" state data generated on device creation, to improve usability/ adoption of state reporting
  • "<Device Name> doesn't support that" feedback now provided on unsupported command/ directive

Code changes:

sudo mkdir -p /var/docker/redis/data
sudo docker create --name redis \
--net nr-alexav3 \
-v /var/docker/redis/data:/data \
--restart always \
redis

Release 0.4

This version offers State Reporting of your smart devices, meaning you can see whether a light, smart plug etc. is ON or OFF, the temperature a thermostat is set to, the colour temperature or colour of a smart bulb is set to from within the Alexa App itself.

Alexa App Room View

If you're using the hosted instance skip to "Re-install Node-RED Add-on" - that's all you'll need to do.

If you deployed release 0.3 (which had no state reporting capability/ node) you need to update the database schema to support WebAPI version 0.4.

In this release mosquitto/ mosquitto-auth plugin remain as-is from previous release.

Extend Mongo Schema

The MongoDB Devices schema must be updated to support the "reportState" boolean element and the "state" mixed object:

sudo docker exec -it mongodb /bin/bash
mongo mongodb://localhost --authenticationDatabase admin -u '\<admin user\>' -p '\<password\>'

use users
show collections

db.devices.update({},
{$set : {"state":{}}},
{upsert:false,
multi:true}) 

db.devices.update({},
{$set : {"reportState":false}},
{upsert:false,
multi:true}) 

Web App/ API Upgrade

The remaining changes are "back-end" NodeJS code changes that will be pulled when you refresh the service containers:

  1. Stop the nr-alexav3-web container
  2. Remove the nr-alexav3-web container
  3. Recreate the nr-alexav3-web container

Node-RED Upgrade

Re-install Node-RED Add-on

Pull files from GitHub, uninstall and re-install the add-on using the commands:

npm uninstall /<path to files>/alexa-smart-home-v3
npm remove /<path to files>/alexa-smart-home-v3
npm install /<path to files>/alexa-smart-home-v3

Note, the add-on is not published in NPM.

Reconfigure Alexa Home Skill Account

You will also need to reconfigure your account config in Node Red, setting the MQTT and Web API server endpoints. For the hosted version these are:

  • MQTT: mq-alexav3.cb-net.co.uk
  • Web API: nr.alexav3.cb-net.co.uk

Add State Nodes to Flows

Drag in the new "state" node, set the target device for state updates to be applied to and, at the very least, connect the Node-RED Alexa Home Skill output node for the same device. There is built-in logic to handle the output from the Alexa Home Skill v3 nodes.

If using your own input to these nodes, the Alexa Smart Home v3 State nodes expect inbound messages to include relevant elements, formatted as below:

        msg {
            acknowledge: true,
            payload {
               state { 
                   "power": ON/ OFF,
                   "brightness": 0-100,
                   "colorHue": 0-360,
                   "colorSaturation": 0-1,
                   "colorTemperature": 0-10000, 
                   "input": string,
                   "lock": LOCKED/ UNLOCKED,
                   "playback": playback,
                   "thermostatMode": HEAT/ COOL,
                   "thermostatSetPoint" : temp in celsius or farenheit
               }
            }
        }

Review Response Nodes

The new release is compatible with the "Response" node (used to establish, via your own logic, whether the command was actually successful).

You will need to change your logic/ command validation to use msg.acknowledge instead of msg.payload.

Review MQTT Interpretation Requirements

Every environment is different. So nothing pre-canned here.

You need to capture POWER/ POWER1/ POWER2 /POWER3 and other events, mangle them into the correct msg.payload.state format and send them into a correctly configured State Node. As above.

Ensure you include a "msg.acknowledge : true" element as well, otherwise your state update will be dropped.

Device Changes

Edit all of your devices that you want state reporting on via the Web App - once completed ensure you scan for devices via the Alexa App.

Alexa App Room View