Giter Site home page Giter Site logo

rockbin's Introduction

!!!Archived!!!

I have purchased a new vacuum and no longer use this project, and have therefore archived this project. I will not make any new changes to the code, and due to potential future security issues, I would recommend that users find a different alternative. Feel free to fork the repo if you want.

rockbin

building codecov gosec FOSSA Status

This repo contains the code for a simple go based mqtt client which will send the bin status to a mqtt server.

I'm using home assistant, hence the home assistant auto discovery stuff.

The general idea is that the home assistant config is sent every minute, and the bin value is sent when the /mnt/data/rockrobo/RoboController.cfg is modified. The file is only modified after cleaning or returning to the dock. Bin value in RoboController.cfg is named: bin_in_time. This value is expressed in seconds from last cleaning of vacuum bin. After cleaning value is set to 0.

I decided to use a percentage value, in order to use a gauge in home assistant. I'm using 40 minutes as the time that the vacuum needs to be emptied. This can be changed as an input value to the mqtt client. It's also possible to create sensor expressed in minutes - please refer to parameters table.

Contributing

Please contact me first with any suggestied changes, or before opening a PR. The main aim and scope of this project is to get the robot to report the bin status, so please keep this in mind when creating a PR.

Installation and setup.

The client can be started/tested using the following commands.

# copy the binary to the vacuum
scp rockbin root@...:/root/rockbin
# ssh into the vacuum
ssh root@...
# move the binary into the correct location
mv rockbin /usr/local/bin/rockbin
# make the binary executable
chmod +x rockbin
# setup the config file and install the required service script (e.g. /etc/init/S12rockbin). 
# This will overwrite any existing service scripts - please make a backup beforehand. 
rockbin configure
# test the new version
rockbin serve --log_level debug
# If everything seems to be working finish restart the vacuum
reboot now

The above command set will setup the rockbin service and setup the configuration file according to your responses.

Home assistant

An example of sending the vacuum to the rubbish bin is below:

  - alias: 'Send vacuum to the bin'
    trigger: 
      platform: state
      entity_id: vacuum.rockrobo
      
      to: "returning"
      from: "cleaning"
      
      for: "00:00:03"
    condition:
      - condition: numeric_state
        entity_id: sensor.vacuumbin
        above: 100
    action: 
    - service: mqtt.publish
      data: 
        topic: valetudo/rockrobo/command
        payload: "pause"
    - wait_template: '{{ is_state(''vacuum.rockrobo'', ''idle'') }}'
      continue_on_timeout: 'true'
      timeout: 00:00:05
    - service: mqtt.publish
      data: 
        topic: valetudo/rockrobo/custom_command
        payload: "{\"command\":\"go_to\", \"spot_id\":\"bin\"}"
    - service: notify.telegram_user
      data:
        message: "Please empty the vacuum"
        title: "Vacuum going to the bin"

  - alias: 'Go home when bin is empty'
    trigger: 
      platform: numeric_state
      entity_id: sensor.vacuumbin
      below: 1
    action: 
      - service: vacuum.return_to_base
        entity_id: vacuum.xiaomi_vacuum_cleaner

Building for the vacuum

Pre-built binaries are available in the releases.

You can build it on your computer rather than the vacuum using:

GOARM=7 GOARCH=arm GOOS=linux go build 
# or use the taskfile:
task build_vacuum

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.