Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

Carbon offsetting integration for Home Assistant. Web3 technologies inside

License

Notifications You must be signed in to change notification settings

Multi-Agent-io/carbon-offsetting-web3-integration

Repository files navigation

Compensate your Smart Home's carbon footprint with web3 services.

A Home Assistant integration to compensate CO2 consumed by burning carbon units with the help of a remote agent.

Concept

Each tonn of CO2 emitted into the atmosphere counts, there are some special carbon units representing the CO2 amounts. These units may be burnt to "compensate your carbon footprint". More on that one may find here. Our team has developed an Agent which may burn these units for you for some fee (since there are testing units now, there is no fee). This is an integration providing the ability to request that agent and compensate your home's carbon footprint based on the energy sensors data. The unique identifier of yours is you blockchain account private key. The entire service is as well based on web3 technologies.

Installation

  1. Get integration files:

Using HACS:

  • Install HACS.
  • Navigate to HACS->Integrations and press three dots at the top-right. Select Custom repositories and paste https://github.com/Multi-Agent-io/carbon-offsetting-web3-integration, choose Integration category. Press Add.
  • Click Explore & Add Repositories at the bottom-right and search for Web3 Carbon Footprint Offsetting. Click on it.
  • Click Download at bottom-right, download the integration.
  • Proceed to step 2.

Manually:

  • Clone the repository into the custop_components folder of your Home Assistant config (create one if you don't have it)
  • Navigate to the folder carbon-offsetting-web3-integration and copy the integration files to the custom_components folder of your HomeAssistant:
homeassistant@ubuntu:~/.homeassistant/custom_components$ 

git clone https://github.com/Multi-Agent-io/carbon-offsetting-web3-integration
cp -r carbon-offsetting-web3-integration/custom_components/carbon_offsetting_web3 .
rm -rf carbon-offsetting-web3-integration/

This wierd file structure is due to HACS requirements. Proceed to step 2.

  1. Restart HA to load the integration into HA.
  2. Go to Settings -> Devices & Services -> Integrations and click the 'Add Integration' button. Look for 'Web3 Carbon Footprint Offsetting' and click to add it.

Configuration

For this integration you need an account in Robonomics Network. Save the seed when creating an account, it will be required at integration setup. If you use Robonomics HomeAssistant integration, you may want to use Controller seed.

To set up the integration, you need to select the entities representing total amount of energy your Home consumes, there is a multiple choice selector for that. Similarly, if you have any energy production (e.g. solar panels), pick entities representing them in the production entities selector. You may leave it blank if no production entities.

energy-entities

Input seed of your Robonomics account. The integration use it to sign liability messages when creating liabilities for carbon offsetting agent. This will cost you nothing, and the seed won't be sent anywhere.

Next section is dedicated to the IPFS settings. IPFS is used to store liabilities technics data. All the fields are optional, if you don't specify any gateway, your local one will be used. If you want to use a remote one, paste its URL into the corresponding field and set auth header. This integration supports Web3-auth headers, the ones that require your seed as well. If you use conventional authentication method, paste the login and password.

Note! Use multiaddr format!

ipfs

Use

Once the integration is set, three entities will be created, representing the amount of fossil kWh to compensate, last compensation date and total amount of compensated kWh.

lovelace

They are unknown values yet. To get them, go to Developer Tools->Services and call Web3 Carbon Footprint Offsetting: Get amount of kWh uncompensated. service. It will update your values based on your home parameters.

lovelace-before-compensation

Call Web3 Carbon Footprint Offsetting: Compensate an amount of produced CO2 by burning carbon units to compensate the displayed amount. After that, the values on the lovelace will be updated. You can do this any time you want, all the calculations will be performed automatically.

Troubleshooting

Error "PubSub Timeout" means that the response message was not delivered to your system. That is due to sum issues in Robonomics PubSub technology which is actively developed. In case of requesting amount of kWh to compensate, call the service once again, and when the compensation call timed out, call the Web3 Carbon Footprint Offsetting: Get amount of kWh uncompensated. in case the burn happened, but never reported.

Other errors require the user to check logs of the integration.

To get access to logs, enable debug logs in HomeAssistant's configuration.yml by adding the following:

logger:
  default: warning
  logs:
    custom_components.carbon_offsetting_web3: debug

All the logs are store in home-assistant.log