flick116 / MMM-Hive

A module for the MagicMirror project (https://github.com/MichMich/MagicMirror) to display inside / outside temperature from your Hive receiver
MIT License
3 stars 0 forks source link
hive magicmirror

MMM-Hive

A module for the MagicMirror project to display inside / outside temperature from your Hive receiver.

Hive has had some changes to the login process and the previous way of logging in no longer works. I believe I have this working now, but there are a number of processes so I may have missed something.

Due to this the installation process is a lot more involved than before.

Text and the inside icon are configurable, and the thermometer icon is dynamic based on the temperature values set in the config file.

With configuration changes to the text and icon:

Target Temperature will change when the inside temperature is equal to / less than 1 °C (I am using this to detect whether Frost Protect mode is enabled as I do not believe there is a specific on/off value).

Installation

Clone this repository in your ~/MagicMirror/modules/ folder ( $ cd ~MagicMirror/modules/ ):

git clone https://github.com/flick116/MMM-Hive

The following will only work when 2FA is disabled in the APP - once complete and you have the populated HiveTokens.json, 2FA can be enabled again.

The following commands are to be run in the terminal one after the other - the assumption is that you are using the pi user, if not then this will need to be changed below as appropriate:

cd /home/pi
sudo apt-get install npm
npm install amazon-user-pool-srp-client --save
npm install axios --save

You will now need to copy the index.js from ~MagicMirror/modules/MMM-Hive/tokenGeneration to /home/pi/node_modules/amazon-user-pool-srp-client overwriting the existing file

cd ~MagicMirror/modules/MMM-Hive/tokenGeneration
cp index.js /home/pi/node_modules/amazon-user-pool-srp-client/index.js

Edit index.js and add your Hive login/password credentials to the end of the file overwriting the existing xxxxx parts (login('xxxx@xxxxxx.com','xxxxxxxxx')):

nano /home/pi/node_modules/amazon-user-pool-srp-client/index.js

Final commands create the file that contains the Hive tokens that are used for logging in:

cd /home/pi/node_modules/amazon-user-pool-srp-client
export CognitoUserPoolUsers=eu-west-1_SamNfoWtf CognitoUserPoolClientWeb=3rl4i0ajrmtdm8sbre54p9dvd9
node /home/pi/node_modules/amazon-user-pool-srp-client/index.js > /home/pi/node_modules/amazon-user-pool-srp-client/HiveTokens.json

If there are any errors relating to tokens, then the above 'Final commands' steps will need to be re-run.

Dependencies

request

Config

Option Required Description
postcode Yes Your post code (no spaces)

Type: string
updateInterval No How often the temperature information is updated.

Type: integer
Default value: 10 * 60000
initialLoadDelay No The initial delay before loading (Milliseconds)

Type: integer
Possible values: 1000 - 5000
Default value: 0
showNext No Whether to display the Target Temperature (true) or not (false)

Type: bool
Possible values: true or false
Default value: true
outsideUrl No Option in case British Gas change the Hive URL

Type: string
insideUrl No Option in case British Gas change the Hive URL

Type: string
loginUrlPlus No Option in case British Gas change the Hive URL, currently '/cognito/login'

Type: string
insideUrlProducts No Option in case British Gas change the Hive URL, currently '/products'

Type: string
insideUrlDevices No Option in case British Gas change the Hive URL, currently '/devices'

Type: string
temperatureSuffix No Text to change the temperature suffix

Type: string
Default value: °C
insideText No Option to change the default 'Inside:' text

Type: string
outsideText No Option to change the default 'Outside:' text

Type: string
targetTempText No Whether to display the Target Temperature row (true) or not (false)

Type: bool
Possible values: true or false
Default value: true
insideIconSet No Option to change the default 'fire' icon, can change to any of the available icons at
font awesome

Type: string
Possible values: fa fa-fire
Default value: fa fa-home
highestTemp No Set the highest temperature value, which when reached will use the 'full thermometer' icon, plus turn the icon red

Type: integer
Default value: 30
highTemp No Set the high temperature value, which when reached will use the 'three quarters full thermometer' icon

Type: integer
Default value: 25
lowTemp No Set the low temperature value, which when reached will use the 'half full thermometer' icon

Type: integer
Default value: 20
lowestTemp No Set the lowest temperature value, which when reached will use the 'quarter full thermometer' icon
(anything below this temperature will use the 'empty thermometer' icon)

Type: integer
Default value: 15
animatedLoading No Whether to display the animated loading icon (true) or just plain text (false)

Type: bool
Possible values: true or false
Default value: true
nodeName No In case of a multi-node setup, you will need to define this setting. If the inside temperature is not being
reported then set this to either Receiver or Receiver 2

Type: string
Default value: Your Receiver
debug No Whether debug is enabled (true) or note (false). When enabled responses from
Hive are output to the console

Type: bool
Possible values: true or false
Default value: true
batteryIcon No Whether to display the Thermostat battery level (true) or not (false) - This setting hasn't been fully tested!

Type: bool
Possible values: true or false
Default value: true

Example of the config.js entry:

        {
            module: "MMM-Hive",
            header: "Hive",
            position: "top_right",
            config: {
                temperatureSuffix: "°C",
                username: "hive@hive.com",
                password: "password",
                postcode: 'P0STC0D3',
                showNext: true,
            },
        },

A massive thanks to the following: