Git Product home page Git Product logo

amber_parser's Introduction

Amber_Parser

Parser for Amber Electric JSON electricity pricing data found at https://api.amberelectric.com.au/prices/listprices

https://www.amberelectric.com.au/

Amber is an Australian Electricity Retailer passing through real-time wholesale pricing. This allows IoT enabled devices to switch on and off energy hungry loads based on price signals from the market. For example, I am using it to control charging of an Electric Vehicle.

Example output:

# ./amber -p 5000 -i
JSON File Parser
Amber Electric
Current NEM Time 		2021-03-08 12:28:25
Postcode 			5000
Network Provider 		SA Power

Daily Charges:
Fixed Network Charge		51.24 c/day
Basic Metering Charge		0.00 c/day
Additional Smart Meter Charge	41.56 c/day
Amber Price			32.88 c/day
Total Daily Price		125.67 c/day

Per kWh unit Charges:
Network Charges			15.158 c/kWh
Market Charges			2.678 c/kWh
100 percent Green Power Offset  4.247 c/kWh
Carbon Neutral Offset		0.110 c/kWh
Total 				17.946 c/kWh

Renewables			104 percent
Loss Factor			1.10606

Wholesale Spot Market Price	2.42 c/kWh
Total Price			20.6 c/kWh
All prices include GST


Code is written in C and designed with the intention be transferred to embedded MCU such as the ESP32: https://github.com/craigpeacock/ESP32_DINTimeSwitch

Dependencies

This code uses the following libraries

Install OpenSSL

$ wget https://www.openssl.org/source/openssl-1.1.1i.tar.gz
$ tar -xzf openssl-1.1.1i.tar.gz
$ cd openssl-1.1.1i/
$ ./config
$ make
$ sudo make install

Install cURL

$ wget https://curl.se/download/curl-7.74.0.tar.gz
$ tar -xzf curl-7.74.0.tar.gz
$ cd curl-7.74.0.tar.gz
$ make
$ sudo make install

Install cJSON

$ wget https://github.com/DaveGamble/cJSON/archive/v1.7.14.tar.gz
$ tar -xzf curl-7.74.0.tar.gz
$ cd curl-7.74.0/
$ make
$ sudo make install

Potential errors

Error loading shared libraries

If you get the following error message

error while loading shared libraries: libcjson.so.1: cannot open shared object file: No such file or directory

execute

$ ldconfig -v

Unsupported protocol

If you get this message

curl_easy_perform() failed: Unsupported protocol

It may be because curl hasn't been compiled with SSL. Run

$ curl -V

and check if https is listed as a protocol.

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.