Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial contribution to Freebox 2.0 binding #77

Merged
merged 1 commit into from
Mar 23, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
# This file lists all individuals having contributed content to the repository.
# If you're submitting a patch, please add your name here in alphabetical order as part of the patch.
#
# For a list of active project maintainers, see the MAINTAINERS file.
#
# For how it is generated, see `project-orga/generate-authors.sh`.

Dancho Penev <[email protected]>
Gerhard Riegler <[email protected]>
Gaël L'hopital <[email protected]>
Gideon le Grange <[email protected]>
Jochen Hiller <[email protected]>
Kai Kreuzer <[email protected]>
Karel Goderis <[email protected]>
manroh <[email protected]>
Marcel Verpaalen <[email protected]>
Oliver Libutzki <[email protected]>
Thomas Eichstädt-Engelen <[email protected]>
14 changes: 14 additions & 0 deletions addons/binding/org.openhab.binding.freebox/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="lib/httpcore-4.3.jar"/>
<classpathentry exported="true" kind="lib" path="lib/httpclient-4.3.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jackson-core-asl-1.9.13.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jackson-mapper-asl-1.9.13.jar"/>
<classpathentry exported="true" kind="lib" path="lib/freeboxos-client-0.3.5.jar"/>
<classpathentry exported="true" kind="lib" path="lib/httpmime-4.3.1.jar"/>
<classpathentry exported="true" kind="lib" path="lib/json-simple-1.1.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
33 changes: 33 additions & 0 deletions addons/binding/org.openhab.binding.freebox/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.openhab.binding.freebox</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ds.core.builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
resolve.requirebundle=false
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<binding:binding id="freebox"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:binding="http://eclipse.org/smarthome/schemas/binding/v1.0.0"
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/binding/v1.0.0 http://eclipse.org/smarthome/schemas/binding-1.0.0.xsd">

<name>Freebox Binding</name>
<description>The Freebox binding requests your Freebox Revolution Server for various operational informations.</description>
<author>Gaël L'hopital</author>

</binding:binding>
Original file line number Diff line number Diff line change
@@ -0,0 +1,273 @@
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="freebox"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0"
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0 http://eclipse.org/smarthome/schemas/thing-description-1.0.0.xsd">

<thing-type id="server">
<label>Freebox Revolution Server</label>
<description>Provides various informations regarding the status of the Freebox Server</description>

<channels>
<channel id="fwversion" typeId="fwversion"/>
<channel id="uptime" typeId="uptime"/>
<channel id="restarted" typeId="restarted"/>
<channel id="tempcpum" typeId="tempcpum" />
<channel id="tempcpub" typeId="tempcpub" />
<channel id="tempswitch" typeId="tempswitch" />
<channel id="fanspeed" typeId="fanspeed" />
<channel id="reboot" typeId="reboot" />
<channel id="lcd_brightness" typeId="lcd_brightness" />
<channel id="lcd_orientation" typeId="lcd_orientation" />
<channel id="lcd_forced" typeId="lcd_forced" />
<channel id="wifi_status" typeId="wifi_status" />
<channel id="xdsl_status" typeId="xdsl_status" />
<channel id="line_status" typeId="line_status" />
<channel id="ipv4" typeId="ipv4" />
<channel id="rate_up" typeId="rate_up" />
<channel id="rate_down" typeId="rate_down" />
<channel id="bytes_up" typeId="bytes_up" />
<channel id="bytes_down" typeId="bytes_down" />
<channel id="onhook" typeId="onhook" />
<channel id="ringing" typeId="ringing" />
<channel id="call_number" typeId="call_number" />
<channel id="call_duration" typeId="call_duration" />
<channel id="call_timestamp" typeId="call_timestamp" />
<channel id="call_status" typeId="call_status" />
<channel id="call_name" typeId="call_name" />
</channels>

<config-description>
<parameter name="ipAddress" type="text">
<label>Freebox Network Address</label>
<context>network_address</context>
<description>The IP address / FQDN of the Freebox Server (can include port number)</description>
<default>mafreebox.freebox.fr</default>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this some public service everybody can use?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The freebox can have a fixed public address - but I'm not sure I got your question.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My question is whether "mafreebox" is your personal instance or if this is a server that anybody can use (and thus it is a valid default value). If the latter, I even more wonder how authentication is done :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, mafreebox.freebox.fr is always available on the local network as soon as you've got a Freebox. It's provided by the provider itself (added in its DNS server I suppose). Having the ability to change is interesting when you reach your freebox from outside your local network.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, thanks for the explanation!

<required>false</required>
</parameter>

<parameter name="appToken" type="text">
<label>Application token</label>
<description>Token generated by the Freebox server</description>
<required>true</required>
</parameter>

<parameter name="refreshInterval" type="integer">
<label>Refresh Interval</label>
<description>The refresh interval in seconds which is used to poll given Freebox Server.</description>
<default>30</default>
<required>false</required>
</parameter>

<parameter name="refreshPhoneInterval" type="integer">
<label>Phone Refresh Interval</label>
<description>The refresh interval in seconds which is used to poll given Freebox Server for phone informations.</description>
<default>2</default>
<required>false</required>
</parameter>

</config-description>
</thing-type>

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might want to flag many of the channels as "advanced", so that only the most important ones appear in the UI prominently. See https://github.com/eclipse/smarthome/blob/master/docs/sources/architecture/thing-definition.md#channels about the "advanced" flag.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

<channel-type id="fwversion" advanced="true">
<item-type>String</item-type>
<label>Firmware Version</label>
<description>Version of the Freebox Server Firmware</description>
<state readOnly="true" />
</channel-type>

<channel-type id="uptime" advanced="true">
<item-type>Number</item-type>
<label>Server uptime</label>
<description>Time since last reboot of the Freebox Server</description>
<state readOnly="true" pattern="%d s"/>
</channel-type>

<channel-type id="restarted" advanced="true">
<item-type>Switch</item-type>
<label>Just restarted</label>
<description>Has the Freebox server have restarted during the last poll period</description>
<category>Alarm</category>
<state readOnly="true" />
</channel-type>

<channel-type id="reboot">
<item-type>Switch</item-type>
<label>Reboot Freebox</label>
<description>Reboots the Freebox server</description>
<category>Switch</category>
</channel-type>

<channel-type id="tempcpum" advanced="true">
<item-type>Number</item-type>
<label>CPUm Temperature</label>
<description>Actual measured CPU Marvell temperature of the Freebox Server</description>
<category>Temperature</category>
<state readOnly="true" pattern="%d °C"/>
</channel-type>

<channel-type id="tempcpub" advanced="true">
<item-type>Number</item-type>
<label>CPUb Temperature</label>
<description>Actual measured CPU Broadcom (xDSL) temperature of the Freebox Server</description>
<category>Temperature</category>
<state readOnly="true" pattern="%d °C"/>
</channel-type>

<channel-type id="tempswitch" advanced="true">
<item-type>Number</item-type>
<label>Switch Temperature</label>
<description>Actual measured switch temperature of the Freebox Server</description>
<category>Temperature</category>
<state readOnly="true" pattern="%d °C"/>
</channel-type>

<channel-type id="fanspeed" advanced="true">
<item-type>Number</item-type>
<label>Fan Speed</label>
<description>Actual measured fan speed (rpm) of the Freebox Server</description>
<state readOnly="true" pattern="%d rpm"/>
</channel-type>

<channel-type id="lcd_brightness" advanced="true">
<item-type>Number</item-type>
<label>Screen Brightness</label>
<description>Brightness level of the screen in percent</description>
<category>DimmableLight</category>
<state pattern="%d %%"/>
</channel-type>

<channel-type id="lcd_orientation">
<item-type>Number</item-type>
<label>Screen Orientation</label>
<description>Screen Orientation in degrees</description>
<state pattern="%d °">
<options>
<option value="0">Horizontal</option>
<option value="90">Turned left</option>
<option value="180">Turned right</option>
<option value="270">Reversed</option>
</options>
</state>
</channel-type>

<channel-type id="lcd_forced" advanced="true">
<item-type>Switch</item-type>
<label>Forced Orientation</label>
<description>Indicates whether the screen orientation forced</description>
<category>Switch</category>
</channel-type>

<channel-type id="wifi_status">
<item-type>Switch</item-type>
<label>Wifi Enabled</label>
<description>Indicates whether the wifi network is enabled</description>
<category>Switch</category>
</channel-type>

<channel-type id="xdsl_status">
<item-type>String</item-type>
<label>xDSL Status</label>
<description>Status of the xDSL line</description>
<state readOnly="true" />
</channel-type>

<channel-type id="line_status">
<item-type>String</item-type>
<label>Line Status</label>
<description>Status of network line connexion</description>
<state readOnly="true" />
</channel-type>

<channel-type id="ipv4" advanced="true">
<item-type>String</item-type>
<label>IP Address</label>
<description>Public IP Address of the Freebox Server</description>
<state readOnly="true" />
</channel-type>

<channel-type id="rate_up" advanced="true">
<item-type>Number</item-type>
<label>Upload Rate</label>
<description>Current upload rate in byte/s</description>
<state readOnly="true" pattern="%d b/s"/>
</channel-type>

<channel-type id="rate_down" advanced="true">
<item-type>Number</item-type>
<label>Download Rate</label>
<description>Current download rate in byte/s</description>
<state readOnly="true" pattern="%d b/s"/>
</channel-type>

<channel-type id="bytes_up" advanced="true">
<item-type>Number</item-type>
<label>Uploaded</label>
<description>Total uploaded bytes since last connection</description>
<state readOnly="true" pattern="%d bytes"/>
</channel-type>

<channel-type id="bytes_down" advanced="true">
<item-type>Number</item-type>
<label>Downloaded</label>
<description>Total downloaded bytes since last connection</description>
<state readOnly="true" pattern="%d bytes"/>
</channel-type>

<channel-type id="onhook">
<item-type>Switch</item-type>
<label>On-hook</label>
<description>Indicates whether the phone is on hook</description>
<category>Switch</category>
<state readOnly="true" />
</channel-type>

<channel-type id="ringing">
<item-type>Switch</item-type>
<label>Ringing</label>
<description>Is the phone ringing</description>
<category>Alarm</category>
<state readOnly="true" />
</channel-type>

<channel-type id="call_number">
<item-type>String</item-type>
<label>Phone Number</label>
<description>Callee number for outgoing calls. Caller number for incoming calls</description>
<state readOnly="true" />
</channel-type>

<channel-type id="call_duration">
<item-type>Number</item-type>
<label>Duration</label>
<description>Call duration in seconds</description>
<state readOnly="true" pattern="%d s"/>
</channel-type>

<channel-type id="call_timestamp">
<item-type>String</item-type>
<label>Timestamp</label>
<description>Call creation timestamp</description>
<state readOnly="true" />
</channel-type>

<channel-type id="call_status">
<item-type>String</item-type>
<label>Call Type</label>
<description>Call Type (ingoing, outgoing, missed)</description>
<state readOnly="true">
<options>
<option value="ingoing">Ingoing call</option>
<option value="outgoing">Outgoing call</option>
<option value="missing">Missed call</option>
</options>
</state>
</channel-type>

<channel-type id="call_name">
<item-type>String</item-type>
<label>Caller name</label>
<description>Callee name for outgoing calls. Caller name for incoming calls</description>
<state readOnly="true" />
</channel-type>
</thing:thing-descriptions>
33 changes: 33 additions & 0 deletions addons/binding/org.openhab.binding.freebox/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Freebox Binding
Bundle-SymbolicName: org.openhab.binding.freebox;singleton:=true
Bundle-Vendor: openHAB
Bundle-Version: 2.0.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ClassPath: .,
lib/json-simple-1.1.jar,
lib/httpmime-4.3.1.jar,
lib/freeboxos-client-0.3.5.jar,
lib/jackson-core-asl-1.9.13.jar,
lib/jackson-mapper-asl-1.9.13.jar,
lib/httpclient-4.3.1.jar,
lib/httpcore-4.3.jar
Import-Package: com.google.common.collect,
org.apache.commons.logging,
org.eclipse.smarthome.config.core,
org.eclipse.smarthome.config.discovery,
org.eclipse.smarthome.core.common.registry,
org.eclipse.smarthome.core.library.types,
org.eclipse.smarthome.core.thing,
org.eclipse.smarthome.core.thing.binding,
org.eclipse.smarthome.core.types,
org.openhab.library.tel.items,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This import is actually not required and should be removed, right?
If you like to use the CallItem, feel free to create a PR to add it as a new item type in the CoreItemFactory in ESH.

org.osgi.framework;version="1.8.0",
org.slf4j
Service-Component: OSGI-INF/*
Export-Package: org.openhab.binding.freebox,
org.openhab.binding.freebox.handler
Require-Bundle: com.google.guava;bundle-version="15.0.0",
org.apache.commons.io;bundle-version="2.2.0",
org.apache.commons.codec;bundle-version="1.6.0"
Loading