Giter VIP home page Giter VIP logo

wii-scale's Introduction

Wii-Scale

Wii-Scale turns your Wii Balance Board into a digital scale. Wii-Scale will automatically find your Wii Balance Board when it is connected to your computer. All you have to do is just stand on it :) No boring console interface, watch your weight being calculated in realtime on a beautiful web insterface.

You can also create multiple users for the whole family and see each members weight history. Wii-Scale runs on Linux and it also runs on a Raspberry Pi.

Wii-Scale

Wii-Scale is based on C++, node.js, AngularJS and communicates over the lightning fast WebSocket protocol.

Usage

Before you can use Wii-Scale, you need to have your balance board paired with your computer and connected. To start, just press the green "Connect" button in Wii-Scale and follow the on-screen prompts in the web interface.

Wii-Scale scanning for Wii Balance Board

The weight is calculated by taking the mean of 50 readings. Wii-Scale will ignore all weights under 30 kg to give you the most accurate reading possible. Oh, and all this will take about 3 seconds.

Installation

Wii-Scale runs most likely only on Linux. Follow these guides to install Wii-Scale on Ubuntu or Raspberry Pi:

To communicate with your Wii Balance Board you'll need a bluetooth 2.0 or 2.1 compatible device. You can find compatible devices here. Wii-Scale is based on the following dependencies Python 2, Python-pip and Node.js with npm and BlueZ bluetooth stack.

Install Wii-Scale

Download latest version of Wii-Scale:

cd <your-directory>/
git clone https://github.com/aelveborn/Wii-Scale.git --recursive --depth 1
cd Wii-Scale/

Allow non-root users to access balance board:

sudo cp wii-scale/70-wii-scales.rules /etc/udev/rules.d/

Run install:

mkdir build && cd build
cmake ../wii-scale && make
npm install --production

Run

npm start

Now the web server and Wii-Scale should be up and running at http://localhost:8080

Configuration (optional)

You can configure a different host, port and calibration.

Access the web interface from other computers

To open up the web server to be accessable from the outside, like if you'll running Wii-Scale on an Raspberry Pi or a server:

npm config set wii-scale:host 0.0.0.0

Web server port

Define a custom port for the webserver (default is 8080):

npm config set wii-scale:port 8080

Webserver host

Define a different host for the webserver (default is localhost):

npm config set wii-scale:host localhost

Calibrate Wii-Scale

If the scales weight is off by any amout you can calibrate it by your own by setting the calibration i Kg. So npm config set wii-scale:calibrate 2will add 2kg to your weight, default is set to 0.

npm config set wii-scale:calibrate 0

Update

To update Wii-Scale, grab the latest version from GitHub:

cd <your-directory>/Wii-Scale
git pull origin master

Update Wii-Scale by running install:

cd build
make
npm install --production

For developers

If you whant to make a code contribution, run a grunt clean-build before you commit and create a pull request.

Developer install

If you are a developer you can install Wii-Scale with all developer dependecies:

sudo python setup.py install
sudo npm install

If you are a developer and whant to contribute to the project, then this is some nice commands to know about.

Run:

npm start

Run all tests:

npm test

Grunt commands:

grunt
grunt build
grunt clean-build

grunt will run grunt watch and build the whole project.

Libraries

Wii-Scale uses the xwiimote, socket.io-client-cpp, glibmm / giomm and libudev libraries.

Licence

Wii-Scale is created and copyrighted by Andreas Älveborn and lincensed under GPL v2.

wii-scale's People

Contributors

aelveborn avatar ribbons 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

wii-scale's Issues

Update Wii-Scale from git

Adding the feature to update the user install from git and promt users when there is a new version out there with a modal popup.

User interface:

  • Promt user with new updates in a modal popup. The promt should have the options to update or remind me later.

The update should:

  • Get the latest version from master branch
  • Update python dependencies
  • Update node dependencies

After the update the server should probably be restarted. This could be the tricky part.

board is connected, but no weight received

I have a problem with my connected wii board. i got no scale results after i got an successfull sync.

is it possible, that my bluetooth is not compatible, although he connect to board?

Dev branch still relevant?

Currently the readme asks users to PR against dev, but dev is very out of date, and all recent merges have been direct to master.

Is there a plan to move to the more standard practice of master as unstable, branch for release - or does dev just need updating?

It the first one, readme needs changing to tell people to PR against master. If it's the second one, dev needs to be synchronised against master, and merges into master from elsewhere but dev need to stop. :)

Thanks to @sahoahfoa for making me notice this, my apologies to you for not realising till I tried the merge for myself!

Bind-setup.py fails to pair device (../scripts/xwiibind.sh: not found)

Hi there,

I'm just trying to get around having to pair each time I use the device by running the bind-setup.py script however I'm getting a script not found on the xwiibind.sh (see below).

pi@raspberrypi:~/Development/Wii-Scale $ sudo python wii-scale/bind-setup.py 
Press the red sync button under the battery hatch
Searching for Wii Balance Board...
Found Wiiboard at address [xx:xx:xx:xx:xx:xx]
/bin/sh: 1: ../scripts/xwiibind.sh: not found
Finishing up..
All done!

The result of this script not being found causes node to crash immediately when you click the connect button (see below).

pi@raspberrypi:~/Development/Wii-Scale $ npm start

> [email protected] start /home/pi/Development/Wii-Scale
> node scripts/start.js

Listening on 0.0.0.0:8080
^[[A/home/pi/Development/Wii-Scale/scripts/start-python.js:42
		if (error) throw error;
		           ^

Error: lost sys.stderr
    at PythonShell.parseError (/home/pi/Development/Wii-Scale/node_modules/python-shell/index.js:131:17)
    at ChildProcess.<anonymous> (/home/pi/Development/Wii-Scale/node_modules/python-shell/index.js:67:28)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
    ----- Python Traceback -----
    File "wii-scale/wii-scale.py", line 222, in <module>
      main(sys.argv[1:])
    File "wii-scale/wii-scale.py", line 184, in main
      board.connect(address)
    File "/home/pi/Development/Wii-Scale/wii-scale/wiiboard.py", line 87, in connect
      self.receivesocket.connect((address, 0x13))
    File "<string>", line 5, in connect
  bluetooth.btcommon.BluetoothError: (112, 'Host is down')
  Exception in thread Thread-3 (most likely raised during interpreter shutdown):
  Traceback (most recent call last):
    File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    File "/usr/local/lib/python2.7/dist-packages/socketIO_client-0.6.1-py2.7.egg/socketIO_client/heartbeats.py", line 26, in run
    File "/usr/local/lib/python2.7/dist-packages/socketIO_client-0.6.1-py2.7.egg/socketIO_client/__init__.py", line 25, in wrap
    File "/usr/local/lib/python2.7/dist-packages/socketIO_client-0.6.1-py2.7.egg/socketIO_client/__init__.py", line 163, in _ping
    File "/usr/local/lib/python2.7/dist-packages/socketIO_client-0.6.1-py2.7.egg/socketIO_client/transports.py", line 61, in send_packet
  <type 'exceptions.TypeError'>: 'NoneType' object is not callable
  Unhandled exception in thread started by 
  sys.excepthook is missing

npm ERR! Linux 4.9.24-v7+
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v6.10.3
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `node scripts/start.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script 'node scripts/start.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the wii-scale package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node scripts/start.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs wii-scale
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls wii-scale
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/pi/Development/Wii-Scale/npm-debug.log

I've also tried calling the script manually through ./xwiibind.sh [wii-board-mac-address]

pi@raspberrypi:~/Development/Wii-Scale/scripts $ ./xwiibind.sh [xx:xx:xx:xx:xx:xx]
Cannot find bluez 'bluez-test-device', 'bluez-simple-agent' or 'bluez-test-input' scripts

Just to make sure I'm not going insane I also ran:

pi@raspberrypi:~/Development/Wii-Scale $ sudo apt-get install bluez
Reading package lists... Done
Building dependency tree       
Reading state information... Done
bluez is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 106 not upgraded.

Update [1]

I've modified bind-setup.py on line 39 to now use a different directory (removed ../)
Previous: cmd_wiibind = "../scripts/xwiibind.sh " + address
Edit: cmd_wiibind = "scripts/xwiibind.sh " + address

This changing of directory string seems to now call the scripts/xwiibind.sh script however I still have the issue of:
Cannot find bluez 'bluez-test-device', 'bluez-simple-agent' or 'bluez-test-input' scripts

Update [2]

Got slightly excited that I could add the device as a paired device using the bluetoothctl command line however this doesn't seem to have worked.

sudo bluetoothctl
scan on
trust [xx:xx:xx:xx:xx:xx]

OS & Hardware

Running on Raspberry Pi 3 model B
Raspbian GNU/Linux 8.0 (jessie)
Linux raspberrypi 4.9.24-v7+ #993 SMP Wed Apr 26 18:01:23 BST 2017 armv7l GNU/Linux

Don't know if it's useful to know but it seems that the pi is currently running blueman 1.99.alpha1 as the bluetooth gui.

Python 3 version

Hey there, i was interested to make this project, but my way. I'd like to use the board with flask and thus python 3, not python 2. I searched my a** off to find a library or anything that can help me to connect the board to my raspberry pi, in PYTHON 3. Do you know any libraries / ways to solve this? :(

Pi can pair but Wii Scale cannot connect

Hi, I just got a Pi for this project (cheaper than buying smart scales!) so I'm relatively new to all thing Linux so apologies.
I have followed the instructions, got it all installed, go it to start up on a restart, running "bind-setup" sees the balance board, the Pi itself in Raspbian can also pair to the board, however in the browser clicking connect does see the board, any ideas?

Also, I ran this: npm config set wii-scale:host 0.0.0.0
as well as giving my Pi a static IP and set the port to 8082 (8080 and 8081 are in use on my home network) but I cannot see it outside of the Pi on my Windows or Android devices, am I supposed to be able to?

One more thing, I ran this command: npm config set wii-scale:address 00:00:00:00:00
however I must have got the address wrong as I had 12 characters, not 10 so I tried by removing the first 2 and again with removing the last 2, is there a way to reset this back to default?

And as others have mentioned, pounds would be great rather than kilos (or both?)

Many thanks.

never pairs

I install all but left in this message:
Listening on localhost:8080

Unable to compile with GCC 12.2.0

2)(deck@steamdeck build)$ cmake ../wii-scale && make
CMake Warning (dev) in CMakeLists.txt:
  No project() command is present.  The top-level CMakeLists.txt file must
  contain a literal, direct call to the project() command.  Add a line of
  code such as

    project(ProjectName)

  near the top of the file, but after cmake_minimum_required().

  CMake is pretending there is a "project(Project)" command on the first
  line.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found Boost: /usr/lib64/cmake/Boost-1.80.0/BoostConfig.cmake (found version "1.80.0") found components: program_options 
-- not define build type, set to release
-- Found Boost: /usr/lib64/cmake/Boost-1.80.0/BoostConfig.cmake (found suitable version "1.80.0", minimum required is "1.55.0") found components: system date_time random 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/deck/build/Wii-Scale/build
Consolidate compiler generated dependencies of target sioclient
[  8%] Building CXX object socket.io-client-cpp/CMakeFiles/sioclient.dir/src/sio_client.cpp.o
In file included from /home/deck/build/Wii-Scale/wii-scale/socket.io-client-cpp/lib/websocketpp/websocketpp/frame.hpp:37,
                 from /home/deck/build/Wii-Scale/wii-scale/socket.io-client-cpp/lib/websocketpp/websocketpp/connection.hpp:33,
                 from /home/deck/build/Wii-Scale/wii-scale/socket.io-client-cpp/lib/websocketpp/websocketpp/endpoint.hpp:31,
                 from /home/deck/build/Wii-Scale/wii-scale/socket.io-client-cpp/lib/websocketpp/websocketpp/roles/client_endpoint.hpp:31,
                 from /home/deck/build/Wii-Scale/wii-scale/socket.io-client-cpp/lib/websocketpp/websocketpp/client.hpp:31,
                 from /home/deck/build/Wii-Scale/wii-scale/socket.io-client-cpp/src/internal/sio_client_impl.h:15,
                 from /home/deck/build/Wii-Scale/wii-scale/socket.io-client-cpp/src/sio_client.cpp:8:
/home/deck/build/Wii-Scale/wii-scale/socket.io-client-cpp/lib/websocketpp/websocketpp/utilities.hpp:75:23: warning: ‘template<class _Arg1, class _Arg2, class _Result> struct std::binary_function’ is deprecated [-Wdeprecated-declarations]
   75 | struct ci_less : std::binary_function<std::string, std::string, bool> {
      |                       ^~~~~~~~~~~~~~~
In file included from /usr/include/c++/12.2.0/string:48,
                 from /home/deck/build/Wii-Scale/wii-scale/socket.io-client-cpp/src/sio_client.h:9,
                 from /home/deck/build/Wii-Scale/wii-scale/socket.io-client-cpp/src/sio_client.cpp:7:
/usr/include/c++/12.2.0/bits/stl_function.h:131:12: note: declared here
  131 |     struct binary_function
      |            ^~~~~~~~~~~~~~~
/home/deck/build/Wii-Scale/wii-scale/socket.io-client-cpp/lib/websocketpp/websocketpp/utilities.hpp:78:21: warning: ‘template<class _Arg1, class _Arg2, class _Result> struct std::binary_function’ is deprecated [-Wdeprecated-declarations]
   78 |       : public std::binary_function<unsigned char,unsigned char,bool>
      |                     ^~~~~~~~~~~~~~~
/usr/include/c++/12.2.0/bits/stl_function.h:131:12: note: declared here
  131 |     struct binary_function
      |            ^~~~~~~~~~~~~~~
In file included from /usr/include/c++/12.2.0/bits/alloc_traits.h:33,
                 from /usr/include/c++/12.2.0/ext/alloc_traits.h:34,
                 from /usr/include/c++/12.2.0/bits/basic_string.h:39,
                 from /usr/include/c++/12.2.0/string:53:
/usr/include/c++/12.2.0/bits/stl_construct.h: In instantiation of ‘void std::_Construct(_Tp*, _Args&& ...) [with _Tp = boost::asio::basic_stream_socket<boost::asio::ip::tcp>; _Args = {reference_wrapper<boost::asio::io_context>}]’:
/usr/include/c++/12.2.0/bits/alloc_traits.h:635:19:   required from ‘static void std::allocator_traits<std::allocator<void> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = boost::asio::basic_stream_socket<boost::asio::ip::tcp>; _Args = {std::reference_wrapper<boost::asio::io_context>}; allocator_type = std::allocator<void>]’
/usr/include/c++/12.2.0/bits/shared_ptr_base.h:604:39:   required from ‘std::_Sp_counted_ptr_inplace<_Tp, _Alloc, _Lp>::_Sp_counted_ptr_inplace(_Alloc, _Args&& ...) [with _Args = {std::reference_wrapper<boost::asio::io_context>}; _Tp = boost::asio::basic_stream_socket<boost::asio::ip::tcp>; _Alloc = std::allocator<void>; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’
/usr/include/c++/12.2.0/bits/shared_ptr_base.h:971:16:   required from ‘std::__shared_count<_Lp>::__shared_count(_Tp*&, std::_Sp_alloc_shared_tag<_Alloc>, _Args&& ...) [with _Tp = boost::asio::basic_stream_socket<boost::asio::ip::tcp>; _Alloc = std::allocator<void>; _Args = {std::reference_wrapper<boost::asio::io_context>}; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’
/usr/include/c++/12.2.0/bits/shared_ptr_base.h:1712:14:   required from ‘std::__shared_ptr<_Tp, _Lp>::__shared_ptr(std::_Sp_alloc_shared_tag<_Tp>, _Args&& ...) [with _Alloc = std::allocator<void>; _Args = {std::reference_wrapper<boost::asio::io_context>}; _Tp = boost::asio::basic_stream_socket<boost::asio::ip::tcp>; __gnu_cxx::_Lock_policy _Lp = __gnu_cxx::_S_atomic]’
/usr/include/c++/12.2.0/bits/shared_ptr.h:464:59:   required from ‘std::shared_ptr<_Tp>::shared_ptr(std::_Sp_alloc_shared_tag<_Tp>, _Args&& ...) [with _Alloc = std::allocator<void>; _Args = {std::reference_wrapper<boost::asio::io_context>}; _Tp = boost::asio::basic_stream_socket<boost::asio::ip::tcp>]’
/usr/include/c++/12.2.0/bits/shared_ptr.h:1009:14:   required from ‘std::shared_ptr<typename std::enable_if<(! std::is_array< <template-parameter-1-1> >::value), _Tp>::type> std::make_shared(_Args&& ...) [with _Tp = boost::asio::basic_stream_socket<boost::asio::ip::tcp>; _Args = {reference_wrapper<boost::asio::io_context>}; typename enable_if<(! is_array< <template-parameter-1-1> >::value), _Tp>::type = boost::asio::basic_stream_socket<boost::asio::ip::tcp>]’
/home/deck/build/Wii-Scale/wii-scale/socket.io-client-cpp/lib/websocketpp/websocketpp/transport/asio/security/none.hpp:171:64:   required from here
/usr/include/c++/12.2.0/bits/stl_construct.h:119:7: error: no matching function for call to ‘boost::asio::basic_stream_socket<boost::asio::ip::tcp>::basic_stream_socket(std::reference_wrapper<boost::asio::io_context>)’
  119 |       ::new((void*)__p) _Tp(std::forward<_Args>(__args)...);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/boost/asio/basic_socket_streambuf.hpp:25,
                 from /usr/include/boost/asio/basic_socket_iostream.hpp:24,
                 from /usr/include/boost/asio.hpp:40,
                 from /home/deck/build/Wii-Scale/wii-scale/socket.io-client-cpp/lib/websocketpp/websocketpp/common/asio.hpp:65,
                 from /home/deck/build/Wii-Scale/wii-scale/socket.io-client-cpp/lib/websocketpp/websocketpp/transport/asio/base.hpp:31,
                 from /home/deck/build/Wii-Scale/wii-scale/socket.io-client-cpp/lib/websocketpp/websocketpp/transport/asio/connection.hpp:31,
                 from /home/deck/build/Wii-Scale/wii-scale/socket.io-client-cpp/lib/websocketpp/websocketpp/transport/asio/endpoint.hpp:32,
                 from /home/deck/build/Wii-Scale/wii-scale/socket.io-client-cpp/lib/websocketpp/websocketpp/config/asio_no_tls_client.hpp:32,
                 from /home/deck/build/Wii-Scale/wii-scale/socket.io-client-cpp/src/internal/sio_client_impl.h:29:
/usr/include/boost/asio/basic_stream_socket.hpp:304:3: note: candidate: ‘template<class Protocol1, class Executor1> boost::asio::basic_stream_socket<Protocol, Executor>::basic_stream_socket(boost::asio::basic_stream_socket<Protocol1, Executor1>&&, typename boost::asio::constraint<(std::is_convertible<_Iter, _Iterator>::value && std::is_convertible<_Ep, _Dp>::value)>::type) [with Executor1 = Protocol1; Protocol = boost::asio::ip::tcp; Executor = boost::asio::any_io_executor]’
  304 |   basic_stream_socket(basic_stream_socket<Protocol1, Executor1>&& other,
      |   ^~~~~~~~~~~~~~~~~~~
/usr/include/boost/asio/basic_stream_socket.hpp:304:3: note:   template argument deduction/substitution failed:
/usr/include/c++/12.2.0/bits/stl_construct.h:119:7: note:   ‘std::reference_wrapper<boost::asio::io_context>’ is not derived from ‘boost::asio::basic_stream_socket<Protocol1, Executor1>’
  119 |       ::new((void*)__p) _Tp(std::forward<_Args>(__args)...);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/boost/asio/basic_stream_socket.hpp:248:3: note: candidate: ‘template<class ExecutionContext> boost::asio::basic_stream_socket<Protocol, Executor>::basic_stream_socket(ExecutionContext&, const protocol_type&, const native_handle_type&, typename boost::asio::constraint<std::is_convertible<ExecutionContext&, boost::asio::execution_context&>::value>::type) [with Protocol = boost::asio::ip::tcp; Executor = boost::asio::any_io_executor]’
  248 |   basic_stream_socket(ExecutionContext& context,
      |   ^~~~~~~~~~~~~~~~~~~
/usr/include/boost/asio/basic_stream_socket.hpp:248:3: note:   template argument deduction/substitution failed:
/usr/include/c++/12.2.0/bits/stl_construct.h:119:7: note:   candidate expects 4 arguments, 1 provided
  119 |       ::new((void*)__p) _Tp(std::forward<_Args>(__args)...);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/boost/asio/basic_stream_socket.hpp:204:3: note: candidate: ‘template<class ExecutionContext> boost::asio::basic_stream_socket<Protocol, Executor>::basic_stream_socket(ExecutionContext&, const endpoint_type&, typename boost::asio::constraint<std::is_convertible<ExecutionContext&, boost::asio::execution_context&>::value>::type) [with Protocol = boost::asio::ip::tcp; Executor = boost::asio::any_io_executor]’
  204 |   basic_stream_socket(ExecutionContext& context, const endpoint_type& endpoint,
      |   ^~~~~~~~~~~~~~~~~~~
/usr/include/boost/asio/basic_stream_socket.hpp:204:3: note:   template argument deduction/substitution failed:
/usr/include/c++/12.2.0/bits/stl_construct.h:119:7: note:   candidate expects 3 arguments, 1 provided
  119 |       ::new((void*)__p) _Tp(std::forward<_Args>(__args)...);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/boost/asio/basic_stream_socket.hpp:158:3: note: candidate: ‘template<class ExecutionContext> boost::asio::basic_stream_socket<Protocol, Executor>::basic_stream_socket(ExecutionContext&, const protocol_type&, typename boost::asio::constraint<std::is_convertible<ExecutionContext&, boost::asio::execution_context&>::value, boost::asio::defaulted_constraint>::type) [with Protocol = boost::asio::ip::tcp; Executor = boost::asio::any_io_executor]’
  158 |   basic_stream_socket(ExecutionContext& context, const protocol_type& protocol,
      |   ^~~~~~~~~~~~~~~~~~~
/usr/include/boost/asio/basic_stream_socket.hpp:158:3: note:   template argument deduction/substitution failed:
/usr/include/c++/12.2.0/bits/stl_construct.h:119:7: note:   candidate expects 3 arguments, 1 provided
  119 |       ::new((void*)__p) _Tp(std::forward<_Args>(__args)...);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/boost/asio/basic_stream_socket.hpp:119:12: note: candidate: ‘boost::asio::basic_stream_socket<Protocol, Executor>::basic_stream_socket(ExecutionContext&, typename boost::asio::constraint<std::is_convertible<ExecutionContext&, boost::asio::execution_context&>::value>::type) [with ExecutionContext = std::reference_wrapper<boost::asio::io_context>; Protocol = boost::asio::ip::tcp; Executor = boost::asio::any_io_executor; typename boost::asio::constraint<std::is_convertible<ExecutionContext&, boost::asio::execution_context&>::value>::type = int]’ (near match)
  119 |   explicit basic_stream_socket(ExecutionContext& context,
      |            ^~~~~~~~~~~~~~~~~~~
/usr/include/boost/asio/basic_stream_socket.hpp:119:12: note:   conversion of argument 1 would be ill-formed:
/usr/include/c++/12.2.0/bits/stl_construct.h:119:7: error: cannot bind non-const lvalue reference of type ‘std::reference_wrapper<boost::asio::io_context>&’ to an rvalue of type ‘std::reference_wrapper<boost::asio::io_context>’
  119 |       ::new((void*)__p) _Tp(std::forward<_Args>(__args)...);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/boost/asio/basic_stream_socket.hpp:269:3: note: candidate: ‘boost::asio::basic_stream_socket<Protocol, Executor>::basic_stream_socket(boost::asio::basic_stream_socket<Protocol, Executor>&&) [with Protocol = boost::asio::ip::tcp; Executor = boost::asio::any_io_executor]’
  269 |   basic_stream_socket(basic_stream_socket&& other) BOOST_ASIO_NOEXCEPT
      |   ^~~~~~~~~~~~~~~~~~~
/usr/include/boost/asio/basic_stream_socket.hpp:269:45: note:   no known conversion for argument 1 from ‘std::reference_wrapper<boost::asio::io_context>’ to ‘boost::asio::basic_stream_socket<boost::asio::ip::tcp>&&’
  269 |   basic_stream_socket(basic_stream_socket&& other) BOOST_ASIO_NOEXCEPT
      |                       ~~~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/include/boost/asio/basic_stream_socket.hpp:226:3: note: candidate: ‘boost::asio::basic_stream_socket<Protocol, Executor>::basic_stream_socket(const executor_type&, const protocol_type&, const native_handle_type&) [with Protocol = boost::asio::ip::tcp; Executor = boost::asio::any_io_executor; executor_type = boost::asio::any_io_executor; protocol_type = boost::asio::ip::tcp; native_handle_type = int]’
  226 |   basic_stream_socket(const executor_type& ex,
      |   ^~~~~~~~~~~~~~~~~~~
/usr/include/boost/asio/basic_stream_socket.hpp:226:3: note:   candidate expects 3 arguments, 1 provided
/usr/include/boost/asio/basic_stream_socket.hpp:182:3: note: candidate: ‘boost::asio::basic_stream_socket<Protocol, Executor>::basic_stream_socket(const executor_type&, const endpoint_type&) [with Protocol = boost::asio::ip::tcp; Executor = boost::asio::any_io_executor; executor_type = boost::asio::any_io_executor; endpoint_type = boost::asio::ip::basic_endpoint<boost::asio::ip::tcp>]’
  182 |   basic_stream_socket(const executor_type& ex, const endpoint_type& endpoint)
      |   ^~~~~~~~~~~~~~~~~~~
/usr/include/boost/asio/basic_stream_socket.hpp:182:3: note:   candidate expects 2 arguments, 1 provided
/usr/include/boost/asio/basic_stream_socket.hpp:139:3: note: candidate: ‘boost::asio::basic_stream_socket<Protocol, Executor>::basic_stream_socket(const executor_type&, const protocol_type&) [with Protocol = boost::asio::ip::tcp; Executor = boost::asio::any_io_executor; executor_type = boost::asio::any_io_executor; protocol_type = boost::asio::ip::tcp]’
  139 |   basic_stream_socket(const executor_type& ex, const protocol_type& protocol)
      |   ^~~~~~~~~~~~~~~~~~~
/usr/include/boost/asio/basic_stream_socket.hpp:139:3: note:   candidate expects 2 arguments, 1 provided
/usr/include/boost/asio/basic_stream_socket.hpp:103:12: note: candidate: ‘boost::asio::basic_stream_socket<Protocol, Executor>::basic_stream_socket(const executor_type&) [with Protocol = boost::asio::ip::tcp; Executor = boost::asio::any_io_executor; executor_type = boost::asio::any_io_executor]’
  103 |   explicit basic_stream_socket(const executor_type& ex)
      |            ^~~~~~~~~~~~~~~~~~~
/usr/include/boost/asio/basic_stream_socket.hpp:103:53: note:   no known conversion for argument 1 from ‘std::reference_wrapper<boost::asio::io_context>’ to ‘const boost::asio::basic_stream_socket<boost::asio::ip::tcp>::executor_type&’ {aka ‘const boost::asio::any_io_executor&’}
  103 |   explicit basic_stream_socket(const executor_type& ex)
      |                                ~~~~~~~~~~~~~~~~~~~~~^~
make[2]: *** [socket.io-client-cpp/CMakeFiles/sioclient.dir/build.make:76: socket.io-client-cpp/CMakeFiles/sioclient.dir/src/sio_client.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:155: socket.io-client-cpp/CMakeFiles/sioclient.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

Measuring weight by substraction

Let's say you want to weigh your dog or your small kids, you'd need to have a function to take a first measurement where someone is standing with the pet or kid in their arms, and a second one without - so that weights under 30 kg can be measured accurately.

Would you consider adding this kind of thing ?

Install fails with error - build process needs an update!

zzz@glados ~/Projects/wiiscale/build $ cmake ../wii-scale/ && make-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Boost version: 1.58.0
-- Found the following Boost libraries:
--   program_options
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Checking for module 'giomm-2.4'
--   Found giomm-2.4, version 2.46.3
CMake Error at CMakeLists.txt:26 (add_subdirectory):
  The source directory

    /home/zzz/Projects/wiiscale/wii-scale/socket.io-client-cpp

  does not contain a CMakeLists.txt file.


-- Configuring incomplete, errors occurred!
See also "/home/zzz/Projects/wiiscale/build/CMakeFiles/CMakeOutput.log".

I've managed to install nodejs, xwiimote-dev, libboost-program-options-dev, libglibmm-2.4-dev but for the life of me I can't fix this one by mashing my face against apt. Currently, socket.io-client-cpp is empty,

Cloning from git: ribbons/socket.io-client-cpp into wiimote/socket.io-client-cpp fixes it, this should be added to the instructions (or automated by the config script).

Exporting data to CSV

Would be great if you can add such a function so that the data can be used in other software as well!

Raspbian Stretch feedback

Hello I've just had a play at this but use the current RaspberryPi Raspbian Stretch (desktop) version release, which is two distributions newer than the instructions.
I also used a Pi3 as it has built in Bluetooth as does the smaller Pi0W.

Anyway
this worked for me (I don't know NodeRed at all )
I skipped the install of nodered (as it comes with rasbian desktop)

sudo apt update
sudo apt install python-bluez

(same as normal here)
in a terminal window
created a folder, moved into it.
cloned the git
git clone https://github.com/aelveborn/Wii-Scale.git
cd into folder

sudo python setup.py install
now
sudo npm install --production
failed with no npm, a quick look at https://nodered.org/docs/hardware/raspberrypi
and all I did was
sudo apt-get install npm
not the rest of it
sudo npm install --production
worked fine
followed by

npm config set wii-scale:host 127.0.0.1
npm start

and opened chromium and pointed to
http://127.0.0.1:8080

hit the sync and pressed the red button and it worked
I say worked, I had to remove the BalanceBoard (Nintendo RVL-WBC-01) as a device from the Bluetooth icon in the taskbar. (since I had added it as a new device) otherwise it cannot find it.

Default User, remember last, or cookie/local-storage based user memory

Currently, when reconnecting, the user always returns to Guest. I could just USE Guest, but it would be nice to have one of the above. To my mind, the default user and cookie-based are the most useful, as the former would let you set the default in the one-user, whatever-pc-is-closest user case (mine), and the latter would allow a family full of iPhones to each have their user come up by default.

Wii-Scale only connects to a board that is in pairing mode, even if it's paired and trusted

I was under the impression, that pairing the board and making it trusted would get rid of the need to put the board into pairing mode.
After some fumbling I finally settled for using bluetoothctl, a nice CLI tool for bluez, and got the board paired and set to trusted. I can also use it to connect to the board after pressing the power button on the board and while its LED is blinking. When connected the power LED turns solid until disconnected
I've set the board address in the settings:
npm config set wii-scale:address 00:25:A0:38:12:34

However, Wii-Scale will always terminate with a python backtrace - unless the board has been put into pairing mode.

Listening on 0.0.0.0:8080

/home/dm8tbr/src/wii-scale/scripts/start-python.js:42
                if (error) throw error;
                                 ^
Error: bluetooth.btcommon.BluetoothError: (112, 'Host is down')
    at PythonShell.parseError (/home/dm8tbr/src/wii-scale/node_modules/python-shell/index.js:131:17)
    at ChildProcess.<anonymous> (/home/dm8tbr/src/wii-scale/node_modules/python-shell/index.js:67:28)
    at ChildProcess.emit (events.js:98:17)
    at Process.ChildProcess._handle.onexit (child_process.js:820:12)
    ----- Python Traceback -----
    File "wii-scale/wii-scale.py", line 222, in <module>
      main(sys.argv[1:])
    File "wii-scale/wii-scale.py", line 184, in main
      board.connect(address)
    File "/home/dm8tbr/src/wii-scale/wii-scale/wiiboard.py", line 87, in connect
      self.receivesocket.connect((address, 0x13))
    File "<string>", line 5, in connect

Running the python script manually and then starting Wii-Scale produces similar backtraces while connecting:

$ wii-scale/wii-scale.py -a 00:25:A0:38:12:34
Wii-Scale started
Traceback (most recent call last):
  File "wii-scale/wii-scale.py", line 222, in <module>
    main(sys.argv[1:])
  File "wii-scale/wii-scale.py", line 184, in main
    board.connect(address)
  File "/home/dm8tbr/src/wii-scale/wii-scale/wiiboard.py", line 87, in connect
    self.receivesocket.connect((address, 0x13))
  File "<string>", line 5, in connect
bluetooth.btcommon.BluetoothError: (111, 'Connection refused')

Both errors 111 and 112 will happen, depending on if the board turned off before being connected.

This is on: Ubuntu 16.04; kernel 4.4.0-24-generic i386; bluez 5.37-0ubuntu5

I'd try to debug this further, but I'm not well versed in node.js and python interaction.

Front end graph stop drawing after a few months of stored data.

I´m an intensive user of the system, my wife to be more concrete, and after a few months the graph stop drawing. It happened to me before and the only workaround it's to create a new user and start again but you lose all data.

@aelveborn can you check on the issue please?

Just for the record I attach below a screen capture of the issue.

screen shot 2017-06-21 at 19 14 40

The RPi install guide should explain that you need to be in the `input` group

Connecting fails with a confusing permission denied error if you're not. I also had to add

  <allow send_interface="org.freedesktop.DBus.ObjectManager"/>
  <allow send_interface="org.freedesktop.DBus.Properties"/>

to a group I was a member of in /etc/dbus-1/system.d/bluetooth.conf in order to make connecting and disconnecting from within the app work.

Node-red Integration

It would be amazing if you can add integration into node-red https://nodered.org/docs/creating-nodes/first-node .

I don't know much about python or node.js yet but this seems like it would not take much effort since it's already node.js , and it would add a lot of functionality to user's smarthome setups.

Also support for using pounds would be good for us U.S users.

build failing with boost 1.67

[ 8%] Building CXX object socket.io-client-cpp/CMakeFiles/sioclient.dir/src/sio_client.cpp.o
In file included from /home/IITaudio/Scm/Git/Wii-Scale/wii-scale/socket.io-client-cpp/lib/websocketpp/websocketpp/transport/asio/endpoint.hpp:32:0,
from /home/IITaudio/Scm/Git/Wii-Scale/wii-scale/socket.io-client-cpp/lib/websocketpp/websocketpp/config/asio_no_tls_client.hpp:32,
from /home/IITaudio/Scm/Git/Wii-Scale/wii-scale/socket.io-client-cpp/src/internal/sio_client_impl.h:29,
from /home/IITaudio/Scm/Git/Wii-Scale/wii-scale/socket.io-client-cpp/src/sio_client.cpp:8:
/home/IITaudio/Scm/Git/Wii-Scale/wii-scale/socket.io-client-cpp/lib/websocketpp/websocketpp/transport/asio/connection.hpp: In member function ‘std::error_code websocketpp::transport::asio::conne
ction::init_asio(websocketpp::transport::asio::connection::io_service_ptr)’:
/home/IITaudio/Scm/Git/Wii-Scale/wii-scale/socket.io-client-cpp/lib/websocketpp/websocketpp/transport/asio/connection.hpp:426:38: error: no matching function for call to ‘make_shared<template class boost::asio::strand>(std::reference_wrapperboost::asio::io_context)’
lib::ref(*io_service));

It's working with boost 1.60 and with 1.65.1

Increase the reading precision

First, I just want to say thank you to the dev, really like the project.
Just want to know how to modify the weight number from 1 decimal place to 2 or even 3 decimal places.
Thanks in advance for any help.

Date/Time being handled wrong (12hr/24hr conversion?)

The following entries were made on my app today, but the datetime is being handled kind of wrong.

2018-06-17T00:34+0100 displays as 12:34
2018-06-17T10:16+0100 displays as 10:16
2018-06-17T19:08+0100 displays as 07:08

It looks like there's some sort of mangled conversion into 12 hour time going on - the values (12:30, 10:20, 7:10) are correct in 12 hour time, but they're then displayed as 24 hour times.

My preference would be to remove the conversion and just display them as 24 hour times, or build it in as a per-user option. What does everyone else think?

wii-scale:calibrate not working with negative values

$ npm config set wii-scale:calibrate -5
$npm start

> [email protected] start /home/oangelo/sandbox/Wii-Scale
> node scripts/start.js

Listening on localhost:8080
terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injectorboost::program_options::invalid_command_line_syntax >'
what(): the required argument for option '--calibrate' is missing

Users

Create different users with a history for each user. Default user should be "Guest".

Error.

Hi, I'm getting this error. I included the debug log.

> [email protected] start /home/forbi/Wii-Scale
> node scripts/start.js

Listening on 0.0.0.0:1991
lokijs loadDatabase : Database not found
/home/forbi/Wii-Scale/scripts/start-python.js:42
		if (error) throw error;
		           ^

Error:   File "wii-scale/wii-scale.py", line 96
    print "wii-scale.py -h <host> -p <port> -c <calibration kg> -a <mac-addres>"
                                                                               ^
SyntaxError: Missing parentheses in call to 'print'

    at PythonShell.parseError (/home/forbi/Wii-Scale/node_modules/python-shell/index.js:138:17)
    at ChildProcess.<anonymous> (/home/forbi/Wii-Scale/node_modules/python-shell/index.js:67:28)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)

npm ERR! Linux 4.8.13-1-ARCH
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "start"
npm ERR! node v7.4.0
npm ERR! npm  v4.1.1
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `node scripts/start.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script 'node scripts/start.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the wii-scale package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node scripts/start.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs wii-scale
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls wii-scale
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/forbi/Wii-Scale/npm-debug.log

npm-debug.txt

Wii Balance Board Connection

Hi,
I am running Raspberry Pi 3 I had an issue when using the green connect button in the web app.
Sometimes it would require me to click the connect button two to three times to get it to work.
I created a fork and add a 20 second interval where it will continually connect to the Wii balance board.
Once the 20 seconds is reach it will display connection timedout in the web app if it can't connect.

It connects fine with the bluetoothctl program by simply using the "scan on" command.
I was wondering if anybody had this same issue or if it was something with the balance board or some other issue.
Either way the 20 second interval seems to be more reliable for now.

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.