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

updating repo #54

Open
wants to merge 53 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 52 commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
1c8fbc2
Add missing space that was causing an error
Cabalist Feb 1, 2019
9e3ca0a
Merge pull request #1 from anmaped/master
medevil84 Mar 7, 2019
2a08a79
AppVeyor support
nschimme Apr 19, 2019
becc907
Add stats about ccache
nschimme Apr 19, 2019
9cb890d
Fix path
nschimme Apr 19, 2019
06397e5
Install ccache
nschimme Apr 19, 2019
93a653a
Use sudo
nschimme Apr 19, 2019
0202e01
docker.md
eteixido1 Aug 7, 2019
1142650
Update troubleshooting.md
eteixido1 Aug 7, 2019
eeac504
Update troubleshooting.md
eteixido1 Aug 7, 2019
c3a39a0
Bin files for MQTT
eteixido1 Aug 27, 2019
61031ac
mqtt.conf example
eteixido1 Aug 27, 2019
14672a9
mqtt-control & mqtt-status autostart
eteixido1 Aug 27, 2019
57e52d7
mqtt-control & mqtt-status autostart
eteixido1 Aug 27, 2019
a81f06e
mqtt-control & mqtt-status controlscripts
eteixido1 Aug 27, 2019
b61fa98
mqtt scripts
eteixido1 Aug 27, 2019
3dacef1
MQTT bin files
eteixido1 Aug 27, 2019
9cdb873
mqtt.conf file
eteixido1 Aug 27, 2019
13fd988
Delete busybox
eteixido1 Aug 27, 2019
7cfd1f9
Delete mosquitto_pub
eteixido1 Aug 27, 2019
2745cf0
Delete mosquitto_pub.bin
eteixido1 Aug 27, 2019
e726ade
Delete mosquitto_sub
eteixido1 Aug 27, 2019
fb7a00b
Delete mosquitto_sub.bin
eteixido1 Aug 27, 2019
590aae1
Delete mqtt-control
eteixido1 Aug 27, 2019
c46fed5
Delete mqtt-status
eteixido1 Aug 27, 2019
a01f7dc
Delete mqtt.conf
eteixido1 Aug 27, 2019
9784e3d
Delete mosquitto_pub-OLD
eteixido1 Aug 27, 2019
41047bd
Delete mosquitto_sub-OLD
eteixido1 Aug 27, 2019
d3ea60c
it's not necessari
eteixido1 Aug 28, 2019
7214fcd
it's not necessary
eteixido1 Aug 28, 2019
f1aad89
20190830-bin
eteixido1 Aug 30, 2019
d6bf737
20190830-autostart
eteixido1 Aug 30, 2019
153fa09
20190830-mqtt.conf
eteixido1 Aug 30, 2019
19d9b30
20190830-controlscripts mqtt-control mqtt-status
eteixido1 Aug 30, 2019
313be8a
20190830-scripts mqtt
eteixido1 Aug 30, 2019
920334b
20190830-script common_function.sh
eteixido1 Aug 30, 2019
58c5b77
mqtt configuration info
eteixido1 Sep 7, 2019
4273393
Delete getimage
eteixido1 Sep 10, 2019
f22df1b
Delete mosquitto_pub.bin
eteixido1 Sep 10, 2019
1599336
Delete mosquitto_sub.bin
eteixido1 Sep 10, 2019
f1b8f1b
Changed mqtt binaries for Openfang existing ones
eteixido1 Sep 10, 2019
9737742
changing binaries needed
eteixido1 Sep 10, 2019
704b75d
Typo fix
deftdawg Sep 18, 2019
81b1a73
Update LICENSE
sundarnagarajan Nov 21, 2019
7578134
Merge pull request #2 from eteixido1/patch-1
Ozzyminted Jan 28, 2020
17e8eca
Merge pull request #4 from Cabalist/master
Ozzyminted Jan 28, 2020
7953783
Merge pull request #5 from deftdawg/patch-1
Ozzyminted Jan 28, 2020
58eeaf8
Merge pull request #6 from eteixido1/patch-2
Ozzyminted Jan 28, 2020
4698794
Merge pull request #7 from eteixido1/master
Ozzyminted Jan 28, 2020
2d7c661
Merge pull request #8 from medevil84/master
Ozzyminted Jan 28, 2020
2311cd5
Merge pull request #12 from sundarnagarajan/master
Ozzyminted Jan 28, 2020
e17c1ae
Merge pull request #11 from nschimme/master
Ozzyminted Feb 9, 2020
f5177a3
Merge pull request #15 from anmaped/master
Ozzyminted Feb 14, 2020
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
53 changes: 53 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
version: '{build}'

branches:
only:
- master

services:
- docker

image: Ubuntu

environment:
APPVEYOR_SAVE_CACHE_ON_ERROR: true
CCACHE_DIR: /home/appveyor/.buildroot-ccache

cache:
- /home/appveyor/.buildroot-ccache

init:
- echo _NPROCESSORS_ONLN=$(getconf _NPROCESSORS_ONLN)

install:
- ps: $env:package_version = ("$(git rev-parse --short HEAD)").trim()
- ps: Update-AppveyorBuild -Version "$env:package_version-$env:APPVEYOR_BUILD_NUMBER"
- sh: sudo apt install ccache

before_build:
# Enable buildroot ccache
- ccache --set-config=max_size=1.0G
- ccache -s
- sed "s/# BR2_CCACHE is not set/BR2_CCACHE=y/" config/buildroot.config > /tmp/buildroot.config
- mv /tmp/buildroot.config config/buildroot.config
- echo $(grep BR2_CCACHE config/buildroot.config)
# Construct buildroot image
- docker build -f ./Dockerfile -t openfang/container .

build_script:
# Run build within buildroot container
- docker run --name openfang -v /home/appveyor/.buildroot-ccache:/root/.buildroot-ccache openfang/container sh /root/openfang/buildopenfang.sh

after_build:
# Extract artifacts from container for upload
- docker cp openfang:/root/openfang/fs/opt/autoupdate.sh .
- docker cp openfang:/root/openfang/toolchain*.tar.xz .
- docker cp openfang:/root/openfang/images*.tar.xz .

artifacts:
- path: autoupdate.sh
name: Autoupdate Script
- path: toolchain*.tar.xz
name: Toolchain
- path: images*.tar.xz
name: Images
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ RUN \
locales \
lzop \
bc \
libncurses5-dev
libncurses5-dev \
ccache

RUN locale-gen --no-purge en_US.UTF-8
RUN git clone https://github.com/anmaped/openfang/ /root/openfang
COPY . /root/openfang/
WORKDIR /root/openfang
899 changes: 282 additions & 617 deletions LICENSE

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions buildopenfang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ rm -r "$WDIR"/package/libtirpc # use updated package version instead
#rm -r "$WDIR"/package/uclibc # use updated package version instead
cp "$CPW"/buildroot/* . -rf

BUILDROOT_CHANGED=$(git diff --name-only "$CPW"/config/buildroot.config)
[ -n "$BUILDROOT_CHANGED" ] || make oldconfig
make

#
Expand Down
6 changes: 6 additions & 0 deletions doc/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ Docker is well known among software developers. Even if you are not familiar wit

## Build openfang using pre-built docker image (recommended)

! Some users have problems compiling Openfang with GCC 2.28 and M4 (Ubuntu 18 or later ). We recomend Ubuntu 16.04.6 LTS to deploy Openfang docker. Make sure that you have the following packages in the system:
Copy link
Owner

Choose a reason for hiding this comment

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

I couldn't understand this note! Please remove it or turn it more explicit. Note that the docker image contains the available toolchain.


```
sudo apt install gcc g++ python make m4 zip unzip lzop
```

The next set of commands will retrieve the image from dockerhub and compile it. To do so, use the following commands:

```
Expand Down
13 changes: 12 additions & 1 deletion doc/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,19 @@ Just use `su` and set your password using `passwd` tool.

The deafult user/password is admin/admin.

### 6. How can I reset to Factory ?

### 6. [Dafang-Hacks](https://github.com/Dafang-Hacks/rootfs) seems like a very similar effort to [Openfang](https://github.com/anmaped/openfang/). Which one should I choose to flash and contribute to?
Connect via ssh to device and use the following commands:
```
nvram clear rtdev
nvram commit

reboot
```
This will factory reset the device!


### 7. [Dafang-Hacks](https://github.com/Dafang-Hacks/rootfs) seems like a very similar effort to [Openfang](https://github.com/anmaped/openfang/). Which one should I choose to flash and contribute to?

Openfang is more flexible towards future/other devices and (currently) the most active, although being based on some original efforts made with the Dafang-hacks.

Expand Down
Binary file added fs/opt/bin/busybox
Binary file not shown.
2 changes: 2 additions & 0 deletions fs/opt/config/autostart/mqtt-control
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
/opt/controlscripts/mqtt-control
2 changes: 2 additions & 0 deletions fs/opt/config/autostart/mqtt-status
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
/opt/controlscripts/mqtt-status
42 changes: 42 additions & 0 deletions fs/opt/config/mqtt.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
############################################################
# edit this file and move it to /opt/config/mqtt.conf #
############################################################

export LD_LIBRARY_PATH='/thirdlib:/lib:/opt/lib'

# Options for mosquitto_sub & mosquitto_pub
USER=mosquitto-user
PASS=mosquitto-pass
HOST=mosquitto-host-broker
PORT=1883

# Define a location
LOCATION="Home"

# Define device name
DEVICE_NAME="mijia-open-1"

# Define the base topic used by the camera
# send a message to myhome/openfang/set with the payload help for help.
# Results will be placed in myhome/openfang/${command} or topic/openfang/error - so please subscribe topic/openfang/# for testing purposes
TOPIC="$LOCATION/$DEVICE_NAME"

# Define an autodiscovery prefix, if autodiscovery is desired:
# AUTODISCOVERY_PREFIX="homeassistant"

# Define additional options for Mosquitto here.
# For example --cafile /opt/config/DST_Root_CA_X3.pem --tls-version tlsv1
# or use a special id to connect to brokers like azure
MOSQUITTOOPTS=""

# Add options for mosquitto_pub like -r for retaining messages
MOSQUITTOPUBOPTS=""

# Send a mqtt statusupdate every n seconds
STATUSINTERVAL=30

# Publish and update the light dependant resistor (LDR) status or not. The
# default value if the variable is not set is to send it. This might be useful
# for owners of devices that lack the hardware sensor to avoid publishing
# rubbish.
SENDLDR="true"
51 changes: 51 additions & 0 deletions fs/opt/controlscripts/mqtt-control
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/sh
PIDFILE="/run/mqtt-control.pid"

if [ ! -f /opt/config/mqtt.conf ]; then
echo "You have to configure mqtt first. Please see /opt/config/mqtt.conf.dist for further instructions"
fi

status()
{
pid="$(cat "$PIDFILE" 2>/dev/null)"
if [ "$pid" ]; then
kill -0 "$pid" >/dev/null && echo "PID: $pid" || return 1
fi
}

start()
{
if [ -f $PIDFILE ]; then
echo "MQTT Control already running";
else
. /opt/config/mqtt.conf
if [ -z ${AUTODISCOVERY_PREFIX+x} ];
then echo "MQTT autodiscovery is not enabled";
else
echo "MQTT autodiscovery is enabled - now publishing initial configurations";
/opt/scripts/mqtt-autodiscovery.sh
fi
echo "Starting MQTT - Control"
/opt/bin/busybox nohup /opt/scripts/mqtt-control.sh &>/dev/null &
echo "$!" > "$PIDFILE"
fi
}

stop()
{
pid="$(cat "$PIDFILE" 2>/dev/null)"
if [ "$pid" ]; then
kill "$pid" && rm "$PIDFILE"
killall mosquitto_sub 2>/dev/null
killall mosquitto_sub.bin 2>/dev/null
fi
}

if [ $# -eq 0 ]; then
start
else
case $1 in start|stop|status)
$1
;;
esac
fi
42 changes: 42 additions & 0 deletions fs/opt/controlscripts/mqtt-status
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/sh
PIDFILE="/run/mqtt-status.pid"

if [ ! -f /opt/config/mqtt.conf ]; then
echo "You have to configure mqtt first. Please see /opt/config/mqtt.conf.dist for further instructions"
fi

status()
{
pid="$(cat "$PIDFILE" 2>/dev/null)"
if [ "$pid" ]; then
kill -0 "$pid" >/dev/null && echo "PID: $pid" || return 1
fi
}

start()
{
if [ -f $PIDFILE ]; then
echo "MQTT-Status already running";
else
echo "Starting MQTT-Status"
/opt/bin/busybox nohup /opt/scripts/mqtt-status-interval.sh &>/dev/null &
echo "$!" > "$PIDFILE"
fi
}

stop()
{
pid="$(cat "$PIDFILE" 2>/dev/null)"
if [ "$pid" ]; then
kill "$pid" && rm "$PIDFILE"
fi
}

if [ $# -eq 0 ]; then
start
else
case $1 in start|stop|status)
$1
;;
esac
fi
Loading