Coder Social home page Coder Social logo

freedomotic / freedomotic Goto Github PK

View Code? Open in Web Editor NEW
405.0 50.0 488.0 143.17 MB

Open IoT Framework

Home Page: https://www.freedomotic-platform.com

License: Other

XSLT 0.87% Java 87.63% C++ 0.28% Processing 0.25% CSS 2.29% HTML 0.11% JavaScript 8.13% Shell 0.24% Batchfile 0.01% Dockerfile 0.19%
iot iot-platform java framework home-automation mqtt arduino raspberrypi open-source opensource

freedomotic's Introduction

Freedomotic Open IoT Framework

Official website is https://www.freedomotic-platform.com

Freedomotic is an open source, flexible, secure Internet of Things (IoT) application framework, useful to build and manage modern smart spaces. It is targeted to private individuals (home automation) as well as business users (smart retail environments, ambient aware marketing, monitoring and analytics, ...)

Freedomotic can run also on Raspberry Pi and can easily interact with DIY Arduino projects.

Starting from 2 Feb 2014, this is the Freedomotic mainstream repository. Previous repository was hosted on googlecode http://code.google.com/p/freedomotic

Requirements:

  • Java Open JDK version 11+ or another JDK (to install on Ubuntu: sudo apt-get install openjdk-11-jdk)
  • Maven version 2 or 3 (to install on Ubuntu: sudo apt-get install maven)
  • Any OS with Java support (Linux, Windows, Mac, Solaris ...)

Development status:

  • Current released version: 5.6.0 'Commander RC4' (released on 16 Aug 2017)
  • Version in development (HEAD of this repository): 5.6.0 'Commander'

Quick Start

Follow these instructions if you want to compile Freedomotic from source (eg: to develop your own plugins). If you just want to try it, just download the precompiled binaries you can find at the official download page https://sourceforge.net/projects/freedomotic/

1) Fork Freedomotic on GitHub

git clone https://github.com/YOUR-GITHUB-USERNAME/freedomotic.git

Now the repository is ready to work with.

2) Enter the new local folder

cd freedomotic

3) Install the jar loader on local Maven repository

In order to compile the code you need to add the agent with a custom classloader (for loading jars at runtime in Java 9+). This file called freedomotic-jar-loader-0.0.1.jar is included inside third-party-libs folder.

So enter this folder

cd third-party-libs

and execute

mvn install:install-file -Dfile=freedomotic-jar-loader-0.0.1.jar -DgroupId=com.freedomotic -DartifactId=freedomotic-jar-loader -Dversion=0.0.1 -Dpackaging=jar

4) Compile Freedomotic with Maven

mvn clean install

5) IMPORTANT!!!! THIS IS REQUIRED: Copy the example-data folder into freedomotic-core/data. If you miss this step Freedomotic won't start

cp -r data-example/ framework/freedomotic-core/data

6) Run Freedomotic

java -javaagent:third-party-libs/freedomotic-jar-loader-0.0.1.jar -jar framework/freedomotic-core/target/freedomotic-core/freedomotic.jar

As an alternative you can start freedomotic-core project from your favourite IDE.

Getting help

Having trouble with Freedomotic? We’d like to help!

Contributing

Want to help us? It's very simple and funny. Here how to do.

License

Freedomotic is an Open Source software released under the GNU GPLv2 license.

Partners

This project is supported by:

freedomotic's People

Contributors

abollaert avatar appzer avatar atanasg avatar bestmazzo avatar bkruczyk avatar btrajkovski avatar delbertlegg avatar dependabot[bot] avatar dmitraver avatar enriconicoletti avatar flowdalic avatar fratteflorian avatar gpannullo avatar gpulido avatar jasper-vandemalle avatar jingma87 avatar jmf-tls avatar matheusmuriel avatar mcicolella avatar milindalaknath avatar nitram509 avatar ohadleshno avatar potapczuk avatar rsocrates avatar sebast26 avatar sudo-jaa avatar the7th avatar tminussi avatar ubaldop avatar wolframtheta avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

freedomotic's Issues

Split freedomotic-api from freedomotic-core

Move the api on an project on their own. Freedomotic-core should not have dependencies from the api. Plugins can add freedomotic-api as a dependency instead of using freedomotic-core.

freedomotic-api will be composed by the Api.java interface and ApiStandarImpl.java class

Create base test suite for Things

We should have a test suite to use against Things (being base ones or user customized) in order to check their desired behaviors.

Several bugs related to the lack of association between objects and triggers/commands/reactions

Objects normally create triggers and commands (e.g. When object is clicked), but when those objects are deleted, the triggers and commands remain. This brings several problems.

Suggestion
Add a "owner" / "creator" field to triggers and commands, which should be set upon creation. However, this requires changing every object, from GenericSensor and ElectricDevice to the more specific objects like Thermometer or Light.
Alternatively, use the object name in the statements more strictly to do this job.

Problem1
Create 2 objects of the same type (e.g. Thermometer and Thermometer-1):

  • Thermometer-1 shows reactions related only with it
  • Thermometer shows its reactions and also those for Thermometer-1. ReactionsPanel (line 138) has a check statement.getValue().contains(object.getPojo().getName())
    (the name Thermometer-1 contains "Thermometer")
    This could be changed to .equals() but statements containing @ or = in the beginning of "object.name" wouldn't work.

Problem2

  1. create an object
  2. create a reaction for it (e.g. when object clicked THEN close kitchen door)
  3. delete the object but triggers, commands and reactions associated with it are not removed
  • after the 3 steps, if you restart Freedomotic, the reaction is persisted and causes error on start (the object doesn't exist anymore and its triggers/commands, used in that reaction, are not recreated)
  • after the 3 steps, if you recreate the same object with same name: triggers, commands and reactions already exist; reaction doesn't work (only works if freedomotic is restarted or reaction is recreated)
    When deleted, objects should remove the triggers and commands they created; after that, reactions based only on those triggers/commands should be removed too

Marketplace tools: manage package lists update more efficiently

In freedomotic-drupal-marketplace (aka marketplace-tools), the list of available packages are held both globally, at Marketplace level (that holds the complete list of plugin packages), and even inside every MarketPlaceCategory. This is good, but problems may arise when updating, e.g.:

  • Retrieve the total list of plugins: when calling FreedomoticMarketPlace#updateAllPackageList() only the global list of plugins is updated.
  • Retrieve list of plugins for a single category: the list is updated only inside the Category (so no change is made to global list)

Of course we could update the two lists separately, but this is bandwidth and time consuming because infact we retrieve the same data twice.
As a proposal we could think about:

  • when updating global list of plugins, clean and repopulate even categories' plugins list.
  • when updating a single category list of plugins, merge the new list with the global

Add windows objects to base-objects

Windows objects are conceptually an extension of the StepperMotor object. We must have clear indications on how to implement this before procede. What is needed is a brief document with behaviors names, types, allowed values and expected relationships between behaviors.

Create wiki page for P2P config and scenarios

Since P2P is a one of our 'jewel of the crown' we should explain its usage (scenarios and related config) in a dedicated page.
This would help people better understand its power and deploy the best solution of their aims.

Remove the distinction between real things and virtual things

Now is possible to mark a Thing as "virtual".
The aim of this feature is to simulate the behavior of an object not connected to real sensors or actuators. We can achieve the same result automatically mapping any object to commands that always respond "true" as we already do with the "Successful test" plugin.

Linking an object to a dummy plugin allows us to provide a common machinery avoiding to the unuseful complication of virtual vs real devices. The user can always reconfigure an Thing to use a protocol plugin (eg: KNX) instead of the dummy plugin.

Extend logical expression in triggers

Now only "AND" is supported.
It should be better to allow this type of expressions:
IF (property1=X) OR (property2=Y AND property3=Z) THEN set value=W

Adapt i18n to the new plugins package name

Three possible solutions:

  1. Creating a dictionary between plugins' packages and plugin directory
  2. Passing to I18n.msg() a Plugin object parameter from which - through the Plugin.getFile() method - find the right folder
  3. Trying a new approach: on plugin load, create a dictionary of all strings it defines, and let all strings (core and plugin related) be accessed with a common method that doesn't care about the string belonging to a plugin nor the main application. The simplest way to achieve it is to keep all strings in memory, so I think this could be the only drawback, unless we find a better solution.

Current method for finding translation files:
plugin_dir / data / i18n / plugin_latest_java_package_part _XX_YY.properties
We could use plugin_short_name instead of plugin_latest_java_package_part ; related code changes are easy to make.

Track the user which performed an action

We should also add info about which user performed an action, and log it:
E.g.: Kitchen Light removed from Kitchen by admin | Mauro | username

This implies a big enhancement in the current events system to track the user which generated the request (if any).

Enhance Gate object with start/stop feature

The gate object currently has only open, close and set openess actions.
Most of doors and windows automation system has a start/stop feature which is missing in the current object definition.
We should allow to associate a start (+ direction) and stop action to protocol commands, otherwise the gates cannot be mapped to real hardware.

Same name allowed for different rooms

Now it's possible to assign the same name to two different rooms/zones of a same environment. When you rename a room using an used name the operation is executed without asking user a confirmation or reporting that.
Maybe we should think if it's good to allow the same name for different zones.

POSSIBLE SOLUTIONS
This should be enforced at core level.
The simplest way is: if the same room name is used, the system should append a number to make it different. Than the user can rename it again if needed.
E.g. we have already "kitchen" and try to rename a different zone as "kitchen". The last should be renamed as "kitchen-1".

From 8ad084f Zones have an unique UUID but it can't be used as a primary key if the user needs to point a specific zone using its name in Automations.

behaviorValue variable in triggers is not compliant with coding style guidelines

In hardware triggers we use a variable called "behaviorValue" to set the new behavior value. This is not compliant with coding style rules.
The variable should be something like "behavior.value" or a more meaningful name.
We should evaluate if changing from "behaviorValue" to "behavior.value" breaks something in trigger/commands scripting (probably not but it should be checked first).
We should add a specific item in ReactionConverter.

Add position to User thing

A "position" behavior could be useful to track users in environments and create some automations as
IF admin is in the Kitchen THEN ....
or
IF there are more than 3 persons in the Kitchen THEN ......
and other when it's important to know where an user is located.
This behavior should have an available zone as value (Kitchen, Bathroom etc) and "none" as default for example.

Specify correct privilege requirements in every plugin manifest

Every plugin now has some default privilege "*" assigned, but such assignment is deprecated and will be removed, sooner or later.
Every plugin should specify exact privilege requirements inside its manifest, with the property permissions containing a comma separated list of permissions.
A list of available permission types is available in config/permission.list
I'd be great if we could find a way of executing the plugin in a test environment where we can collect every privileged access and automatically create a list of required permissions. Any idea?

Activemq settings in config file

Now active connectors (stomp, websocket) and their port numbers are set statically in code. If we need to change the port number (for any reason, eg. a conflict with another service) we must recompile the framework. A possibility could be moving these values to config.xml, for example KEY_STOMP_PORT=66666
KEY_ENABLE_STOMP=true

So we could enable/disable/configure services (eg.mqtt) on demand.
The only concern is about security.

Keep tuples ordered in plugin manifests

So far we are managing marshalling of manifest files and contained tuples as unordered map.
Keeping that map ordered could ease reading and modifying manifests.

Create a changelog for Commander

Main topics:
Revamped P2P
RestAPI v3
Library version updates
Enhanced overall stability
Switched from JUL to SLF4j
Extended extra conditions in Reactions (aka Automations)
Updated javadoc

Extra packaging:
Snappy App
Docker

Behind the scenes:
Enforced dependency injection
Enforced adoption of internal API for core and plugins
Enabled coherent access methods to repositories

New plugins:
MQTT (Broker and Client)
MySensors
Push Notifications
...

New Things:
Air Conditioner
Thermostat
...

Localizations:
New languages added

Auth: 3rd party logon

Make it possible to register a user through 3rd party SSO services, like Facebook, OpenID, Gmail, Twitter, Linkedin and so on.

For OpenID there is a library for java
A sample consumer https://code.google.com/p/openid4java/wiki/SampleConsumer

Another interesting library to analyze:
socialauth
Java Library for authentication, getting profile, contacts and updating status on Google, Yahoo, Facebook, Twitter, LinkedIn, and many more providers
https://code.google.com/p/socialauth/

Jfrontend: only images in resources folder are set as background

When you try to set a new background image the system proposes "resources" folder to make your choice.
You can move to any other folder on your system, outside of Freedomotic installation, but in this case the background is not set and only a log message is reported.
Possible solutions

  1. disable UpFolderButton in GUI
  2. notify user with a visual message when the image is not set
  3. other ...

Ref. https://github.com/freedomotic/freedomotic/blob/master/plugins/devices/frontend-java/src/main/java/com/freedomotic/jfrontend/MainWindow.java (method mnuBackgroundActionPerformed (java.awt.event.ActionEvent evt))

ActiveMQ error message at shutdown

Reported error

ERROR [pool-9-thread-1] - ID:mauro-9326-1425838119102-4:1:8:1 failed to delivered acknowledgements
javax.jms.JMSException: Transport disposed.
at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:72)
at org.apache.activemq.ActiveMQConnection.doAsyncSendPacket(ActiveMQConnection.java:1320)
at org.apache.activemq.ActiveMQConnection.asyncSendPacket(ActiveMQConnection.java:1312)
at org.apache.activemq.ActiveMQSession.asyncSendPacket(ActiveMQSession.java:1914)
at org.apache.activemq.ActiveMQSession.sendAck(ActiveMQSession.java:2080
)
at org.apache.activemq.ActiveMQMessageConsumer$4.run(ActiveMQMessageConsumer.java:764)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: org.apache.activemq.transport.TransportDisposedIOException: Transport disposed.
at org.apache.activemq.transport.vm.VMTransport.oneway(VMTransport.java:79)
at org.apache.activemq.transport.MutexTransport.oneway(MutexTransport.java:68)
at org.apache.activemq.transport.ResponseCorrelator.oneway(ResponseCorrelator.java:60)
at org.apache.activemq.ActiveMQConnection.doAsyncSendPacket(ActiveMQConnection.java:1318)
... 9 more
INFO [ActiveMQ ShutdownHook] - Apache ActiveMQ 5.9.0 (9a370747-f3aa-4503-a215-7
94c6a7a6774, ID:mauro-9326-1425838119102-0:2) uptime 49.016 seconds
INFO [ActiveMQ ShutdownHook] - Apache ActiveMQ 5.9.0 (9a370747-f3aa-4503-a215-7
94c6a7a6774, ID:mauro-9326-1425838119102-0:2) is shutdown

log4j errors at startup

Reported:
log4j:ERROR Could not find value for key log4j.appender.default.file
log4j:ERROR Could not instantiate appender named "default.file".

Cleanup RestAPI v3 endpoint

Restapi v3 now exposes different endpoint that accomplish the same purpose
e.g. find Things inside Environments, manage marketplace plugins etc
We should decide which endpoint should be kept and which one we'd better remove.

Return a sorted list of Triggers

Now findAll() method in TriggerRepositoryImpl class returns an unsorted list of triggers.
It should be better to have them sorted by name.

Notify the user when Freedomotic can't load

If there is any problem at startup (due to a bad configured environment), FD stops without notifying the user, so he just think that FD doesn't work.
We need to offer the info to the user in a nice way.

Finetune log mechanism to improve user's feedback analysis

There are two mayor aspects about that:
a) log starts at an advanced boot stadium so if something happens at early startup the only way of getting information is looking at console messages
b) log should be easily appended to issue reports

Some tips for log system
http://www.setfirelabs.com/freedomotic/freedomotic-logging-for-development-and-debugging
http://www.setfirelabs.com/freedomotic/freedomotic-logging-for-development-and-debugging-part-2

Update maven archetype code to match latest freedomotic version and best practices

We have verified that the devices maven archetype on maven central is working. It was created starting from the hello-world plugin. We should review the code that is generated with this archetype to match latest freedomotic version and best practices (eg: error handling example). We could think to enrich the generated code adding also commands and triggers.

Source code
https://github.com/freedomotic/freedomotic/tree/master/tools/freedomotic-device-maven-archetype

Wiki page
https://github.com/freedomotic/freedomotic/wiki/Create-a-new-plugin

Add measure units to sensors behaviors

Now when a sensor shows a value (temperature, luminosity, humidity etc) no measure unit is present.
It should be better to add a unit for each type:
temperature - C for celsius, F for fahreneit
pressure - Pa for pascal, bar
humidity, luminosity - %
voltage - V
current - A
energy - W

Possible solution
Add a parameter for each numeric behavior

How to manage this behavior?

  1. consider as a DataBehavior setting it in the notified event
  2. consider it as ListBehavior with all available values so user must set it

Anyway a default value is required

p2p as base for clustering systems

Just an idea: p2p feature can be considered as a base for "clustering" systems. Not only a solution for load balancing (a great feature of course) but also for fault tolerance.
For example if we use a single board ( e.g. raspi or a pc) and it fails (for software/hardware problems) the entire system fails. If we use a cluster (2 or more boards) an instance can substitute another working as a RAID system.
Also a statistical data reporting could be useful for users: it should report the load with a single instance and the balanced load between more instances, showing clearly the advantages of this solution.

Test "testNoSimilarCommand()" fails

When running
"mvn clean compile" or "mvn test" against HEAD, the test " testNoSimilarCommand" fails because the function "nlpCommand.computeSimilarity" returns a List of 7 objects where only 1 is expected
Maybe there an injection problem so that the CommandRepository is not empty when running the tests?! (Otherwise it's not possible imho that the Repository contains 7 commands because only 1 is added)

I tested this with JDK8 and OpenJDK8 (both with MAven2 and Maven3) on Ubuntu
The same also happens with a build on Travis CI

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.