[userModule] Base Module (Updated 2017/01/22)

Tips, Tricks and Scripts to enhance your home automation and workaround known device bugs, limitations and incompatibilities
maros
Posts: 103
Joined: 05 Apr 2014 11:21

[userModule] Base Module (Updated 2017/01/22)

Post by maros » 26 Dec 2015 21:15

This module provides many useful functions for other automation modules. It has no user facing functionality on its own.

If you want to use BaseModule for your own modules, just replace one line from the module initialisation

Code: Select all

inherits(MyModule, BaseModule);
(instead of AutomationModule)

BaseModule helps module authors with these utilities:
  • Logging with prefixes instead of console.log and console.error
  • Timestamp of last real change in every vDev (metrics:modificationTime) - where metrics:level was actually changed
  • Events on real level change (modify:metrics:level)
  • Fetch presence states (via the Presence module)
  • Find devices based on criteria (tags, values, room, type ...)
  • Process devices from list of device IDs
  • Parse time
  • Compare time periods
  • Simplified timeout handling
You will need to install this module prior to installing my Thermostat control, Presence, ConditionSwitch, Motion Trigger, ... modules. Please make sure to instantiate this module.

Tested with Z-Way version v2.2.2
Bug/Issue tracker at https://github.com/maros/Zway-BaseModule/issues
Documentation at https://github.com/maros/Zway-BaseModul ... /README.md
Download at https://github.com/maros/Zway-BaseModule/releases

Installation can be done directly via git or via the the Zway App-Store.
Last edited by maros on 04 Feb 2017 15:23, edited 9 times in total.
Z-Way 2.2.4 on Raspi B | My Zway GitHub repos | Amazon Wishlist to support module development

masque
Posts: 30
Joined: 23 Dec 2015 01:06

Re: [userModule] Base Module

Post by masque » 31 Dec 2015 01:21

I'm very interested in the different modules you developed, based on this BaseModule. Unfortunately I can't get it installed correctly. The module appears as local module just fine. But as soon as I try to create an App I only get " 404 Not Found. Requested data does not exists". As I'm using Version 2.2.0 maybe this is the reason. As I just started with Z-Way I'm not sure where to check for further details. The z-way-Server log file does not say anything when I try to create the app.
Can you give me any hint where to look or do you have any idea why the base module isn't working on V2.2.0 ?
Thanks
Masque

maros
Posts: 103
Joined: 05 Apr 2014 11:21

Re: [userModule] Base Module

Post by maros » 31 Dec 2015 15:30

Either install it via the Z-Wave.me appstore. You'll need to add the 'k1_beta' app token to your app store config.

Otherwise if you install it manually, please make sure that is installed the /BaseModule and NOT in the /Zway-BaseModule folder
Z-Way 2.2.4 on Raspi B | My Zway GitHub repos | Amazon Wishlist to support module development

pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: [userModule] Base Module

Post by pz1 » 31 Dec 2015 17:56

maros wrote: You'll need to add the 'k1_beta' app token to your app store config.
I do have an on-line apps tab in my 2.2.0 installation, but is completely empty. No place where I can store this token
Attachments
Capture.PNG
Capture.PNG (3.87 KiB) Viewed 5362 times

masque
Posts: 30
Joined: 23 Dec 2015 01:06

Re: [userModule] Base Module

Post by masque » 31 Dec 2015 18:04

This has to be put under "Management".
Like in the picture. After doing this, the packages are shown and you can download and install them.
You may also empty your Browser cache. I had issues with that from time to time as well.
Nevertheless the Problem with the BaseModule still exists in 2.2.0. I'm right on to downgrade to 2.1.1 to check if I can get it working there.
Attachments
Appstore.jpg
Appstore.jpg (68.26 KiB) Viewed 5361 times

masque
Posts: 30
Joined: 23 Dec 2015 01:06

Re: [userModule] Base Module

Post by masque » 31 Dec 2015 18:21

unfortunately no luck with v2.1.1 either.
This is a conmplete blank installation. I used the 2.1.2 razpberry img and downgraded to 2.1.1.
Then I manually installed the BaseModule as userModule.
I do see the BaseModule under Apps. I can create an app, which is listed as active. But I get the following errors in the log:

Code: Select all

[2015-12-31 15:13:02.884] [I] [core] Instantiating module 10 from class BaseModule
[2015-12-31 15:13:02.889] [I] [core] --- Starting module Base Module
[2015-12-31 15:13:02.934] [I] [core] Notification: error (core): Cannot instantiate module: BaseModule: TypeError: undefined is not a function
[2015-12-31 15:13:03.019] [I] [core] TypeError: undefined is not a function
    at BaseModule.init (automation/userModules/BaseModule/index.js:35:57)
    at AutomationController.instantiateModule (automation/classes/AutomationController.js:308:22)
    at AutomationController.createInstance (automation/classes/AutomationController.js:504:14)
    at ZAutomationAPIWebRequest._.extend.createInstance (automation/ZAutomationAPIProvider.js:656:40)
    at ZAutomationAPIWebRequest.ZAutomationWebRequest.handleRequest (automation/WebserverRequestRouter.js:258:41)
    at automation/WebserverRequestRouter.js:32:35
    at WebServer.document_root (automation/Webserver.js:27:11)
Attachments
BaseModule.jpg
BaseModule.jpg (53.4 KiB) Viewed 5361 times

maros
Posts: 103
Joined: 05 Apr 2014 11:21

Re: [userModule] Base Module

Post by maros » 31 Dec 2015 19:46

masque wrote:unfortunately no luck with v2.1.1 either.
That is very strange. Looks like the getName method is missing from the AutomationModule base class. The latest master head from github should have a workaround/fix for this issue. Will publish this fix as soon as anybody can confirm that it works properly
Z-Way 2.2.4 on Raspi B | My Zway GitHub repos | Amazon Wishlist to support module development

pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: [userModule] Base Module

Post by pz1 » 31 Dec 2015 21:02

masque wrote:This has to be put under "Management".
Thanks, I did not look there. (In earlier releases there was a non-functional space for it in the image that I posted above.

pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: [userModule] Base Module

Post by pz1 » 31 Dec 2015 21:04

@Maros
maros wrote:Either install it via the Z-Wave.me appstore. You'll need to add the 'k1_beta' app token to your app store config.
How do users get their apps in the appstore? I haven't seen anything about this before.

masque
Posts: 30
Joined: 23 Dec 2015 01:06

Re: [userModule] Base Module

Post by masque » 01 Jan 2016 14:32

maros wrote:Will publish this fix as soon as anybody can confirm that it works properly
Hi maros,
first of all hapy new year and many, many thanks for your fast support.
I checked out the newest version and now I can install and run the Base Module.

Code: Select all

[2016-01-01 11:06:02.375] [I] [core] --- Starting module Base Module
[2016-01-01 11:06:02.413] [I] [core] [BaseModule-10] Init callbacks
From my side I can confirm that it is working now with v2.1.1
Unfortunately most of your other modules do show the same problem.
As well my productive v2.2.0 System still reports a 404 Error when creating the Base App, but I guess I will downgrade to v2.1.1 till V2.2.0 has become more stable. Seams that there are more issues that need to be fixed before v2.2.0 is usable in production.
regards
masque
Attachments
Basev2.2.jpg
Basev2.2.jpg (18.19 KiB) Viewed 5325 times

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest