red5d / ha-gasbuddy Goto Github PK
View Code? Open in Web Editor NEWUnofficial GasBuddy custom component for Home Assistant
Unofficial GasBuddy custom component for Home Assistant
I added 7 stations around the area and 27 sensors got created. Is there a way we can omit certain grades to minimize the extra sensors?
I'm not sure if this project is still active or not but was wondering if you could add the ability to pull new prices every few hours or so? As of right now it only updates when HA is restarted. Thanks!
Hi, thank you for your time in building this repo, however I am having issues.
I followed the instructions, added and installed the custom repository in HACS, rebooted Home Assistant, then configured the config yaml file as per the instructions, I added the station id, rebooted Home Assistant again, but I go to see if the entity is there, and it isn't...
Does it matter if I am in Canada and I am using a Canadian gas station id? When I went to gasbuddy website it asked me if I was in USA or Canada.
Thanks.
Hi - CTO of GasBuddy here. This module seems to be responsible for an inordinately large number of requests. Please make it a lot more conservative in its fetches or we're going to need to shut it down.
Use station 164086 as an example. This station offers Regular and E85. They could both be considered "regular" but they do have different prices. The sensor created for regular is actually reflecting the price for E85. If E85 exists, can you add E85 as an extra sensor? This same concept could also be used for Diesel DEF.
All of the sensors are showing as unavailable. My log is below.
Logger: homeassistant.components.sensor
Source: custom_components/gasbuddy/sensor.py:31
Integration: Sensor (documentation, issues)
First occurred: April 25, 2022, 8:09:13 PM (11 occurrences)
Last logged: April 25, 2022, 8:09:13 PM
Error while setting up gasbuddy platform for sensor
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 910, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/local/lib/python3.9/site-packages/simplejson/__init__.py", line 525, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.9/site-packages/simplejson/decoder.py", line 370, in decode
obj, end = self.raw_decode(s)
File "/usr/local/lib/python3.9/site-packages/simplejson/decoder.py", line 400, in raw_decode
return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
await asyncio.shield(task)
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/gasbuddy/sensor.py", line 31, in setup_platform
for fuel in r.json()['station']['APIFuel']:
File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 917, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: [Errno Expecting value] <!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en-US"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en-US"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en-US"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en-US"> <!--<![endif]-->
<head>
<title>Attention Required! | Cloudflare</title>
<meta charset="UTF-8" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta name="robots" content="noindex, nofollow" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<link rel="stylesheet" id="cf_styles-css" href="/cdn-cgi/styles/cf.errors.css" />
<!--[if lt IE 9]><link rel="stylesheet" id='cf_styles-ie-css' href="/cdn-cgi/styles/cf.errors.ie.css" /><![endif]-->
<style>body{margin:0;padding:0}</style>
<!--[if gte IE 10]><!-->
<script>
if (!navigator.cookieEnabled) {
window.addEventListener('DOMContentLoaded', function () {
var cookieEl = document.getElementById('cookie-alert');
cookieEl.style.display = 'block';
})
}
</script>
<!--<![endif]-->
<script>
//<![CDATA[
(function(){
window._cf_chl_opt={
cvId: "2",
cType: "interactive",
cNounce: "8933",
cRay: "701b1688bd452f2c",
cHash: "45dffd997a0df47",
cUPMDTk: "\/gaspricemap\/station?__cf_chl_tk=L2jUTw47XIiXTCEBGFfR414NAhEQzFCGdsGZYWpwMpc-1650931749-0-gaNycGzNBz0",
cFPWv: "b",
cTTimeMs: "1000",
cLt: "n",
cRq: {
ru: "aHR0cHM6Ly93d3cuZ2FzYnVkZHkuY29tL2dhc3ByaWNlbWFwL3N0YXRpb24=",
ra: "cHl0aG9uLXJlcXVlc3RzLzIuMjcuMQ==",
rm: "UE9TVA==",
d: "22xY4CrwHod8lpxe1VCEJr4KDciyvkrFbZ2DGAhos9W3YTbPPHbuIcAIR5Nei12e1/sTE+AQzm6RvZHqt+U68Y/ncUSXWRE9+RIafFw4bB8NOiHmbtV0yXsfG+2EORjPVUQ47lh0ka3suioMvMgnddklWdLF1NIrIno5SZeqElBUhqpwT/0S7/wuchZXtZ4B7FPpBqVMVryf+f6XDWDuEctYUwWghxV0RLq0NAzLKZrHdZ8Pd+DLX473M8ysb5ut7enMpRGDt9GJywmbnFgJVUs6CJXUFuHKziLokJqZMYl2/RoXW3m+yMx0u/IhXHis03malscw8E7dbOsDFnFErl3rhMuUo7Vc7Y/9XbxET8eieVK0x5/Ehfms4Ex2jmvt4cAM3WNDtbP/RhJGHGtUUNqtfuhYadwQCUVi2W/TeiAkeE53e76dMkkzEv9j7RdJS2v7XyfeKA35WLrEYyyWMxEmbyLfucXmFf95qjxIwboA/4r/ZM8LAqFf2B7EAjImHr8anDdyo9kHlpxO2j8KCHRF2ttDa/slvn3UiYCLnTbk2aC3gFJcZiQx3i6x5PBmgqE9ofjXZYNV+JTk1mtSEA==",
t: "MTY1MDkzMTc0OS4yNDgwMDA=",
m: "9YadWu0GdqrxlPcLFP6ZTOG3tRTVbqY3ZgpCOG47W1c=",
i1: "w7jYV4SmmS7eogwv6qAZ9w==",
i2: "yoTDS2Wt71becLsnSNlH9A==",
zh: "3VvtlC4+WKi5evBMSwIi9hSSZB4z3/HsO8DXuuvWSx0=",
uh: "JNy/u1JaDY8l68+s834y37Qd6UIzTJLBzCkJPX4t/ps=",
hh: "x6VafZpRbmAJLR11+klCWcvELTPuDfXUFXTFOnlS6lc=",
}
};
}());
//]]>
</script>
<style>
#cf-wrapper #spinner {width:69px; margin: auto;}
#cf-wrapper #cf-please-wait{text-align:center}
.attribution {margin-top: 32px;}
.bubbles { background-color: #f58220; width:20px; height: 20px; margin:2px; border-radius:100%; display:inline-block; }
#cf-wrapper #challenge-form { padding-top:25px; padding-bottom:25px; }
#cf-hcaptcha-container { text-align:center;}
#cf-hcaptcha-container iframe { display: inline-block;}
@keyframes fader { 0% {opacity: 0.2;} 50% {opacity: 1.0;} 100% {opacity: 0.2;} }
#cf-wrapper #cf-bubbles { width:69px; }
@-webkit-keyframes fader { 0% {opacity: 0.2;} 50% {opacity: 1.0;} 100% {opacity: 0.2;} }
#cf-bubbles > .bubbles { animation: fader 1.6s infinite;}
#cf-bubbles > .bubbles:nth-child(2) { animation-delay: .2s;}
#cf-bubbles > .bubbles:nth-child(3) { animation-delay: .4s;}
</style>
</head>
<body>
<div id="cf-wrapper">
<div class="cf-alert cf-alert-error cf-cookie-error" id="cookie-alert" data-translate="enable_cookies">Please enable cookies.</div>
<div id="cf-error-details" class="cf-error-details-wrapper">
<div class="cf-wrapper cf-header cf-error-overview">
<h1 data-translate="challenge_headline">One more step</h1>
<h2 class="cf-subheadline"><span data-translate="complete_sec_check">Please complete the security check to access</span> www.gasbuddy.com</h2>
</div>
<div class="cf-section cf-highlight cf-captcha-container">
<div class="cf-wrapper">
<div class="cf-columns two">
<div class="cf-column">
<div class="cf-highlight-inverse cf-form-stacked">
<form class="challenge-form interactive-form" id="challenge-form" action="/gaspricemap/station?__cf_chl_f_tk=L2jUTw47XIiXTCEBGFfR414NAhEQzFCGdsGZYWpwMpc-1650931749-0-gaNycGzNBz0" method="POST" enctype="application/x-www-form-urlencoded">
<div id='cf-please-wait'>
<div id='spinner'>
<div id="cf-bubbles">
<div class="bubbles"></div>
<div class="bubbles"></div>
<div class="bubbles"></div>
</div>
</div>
<p data-translate="please_wait" id="cf-spinner-please-wait">Please stand by, while we are checking your browser...</p>
<p data-translate="redirecting" id="cf-spinner-redirecting" style="display:none">Redirecting...</p>
</div>
<input type="hidden" name="md" value="3R.vBxVIALEGxexQWAqqzo8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lA5EoWi2TSCc4BwKmHsCu7+oVejTuEZJNrtL3W0/bpEBKBH/5bkbtOfm9Tc5QQVPFJYzV6s1tKDtbTnNoEandMjdKPgvjrRO5Alo2inBIaqRg9rVqdhXu8Mz9OX7GTkpqTiYcnGeV7plWn+pL82i2yLwrmCfwiWOjqPB/e7k/inZhu+eCLgBvU/HtrCTK3YN8GeiSsmnZ5lZdQmqltLYvGYHJIzQWfmj/NTiGlDuJWKUXNYttNSEoiN9W9JfkMSx8DuqUB6EJ00Fh9wXHO5XtJCimDABSBfhAl2qW5HeoSgzjUQim+FtOZzTb3e4OPFumNuL3SogkxfqdyyL3QkopwyMjE+sKmVc9TxaIT3UUatzrKkMP9YE5Yg0Rnfuw2iS4bauYcHBkVCoElb5LAHqDExyj7GsIuxEvbFlht5IsWIgGYkxh+sgjFbWTGjLXfgnih/U6dklO63PYVrqY6eKe6hvvYnuaCVDHjTuP9gN2Ie3jhL6KWKNmilREBPcdpKozhQwDP9LdU7hAYCFLwRMuICiuC4PQ8q23qesExele9i9KQkviV0H1BEWRKCsNwCZ/IRkplg==">
<input type="hidden" name="vc" value="251357afc8678b17458078daae089ea8">
<noscript id="cf-captcha-bookmark" class="cf-captcha-info">
<h1 data-translate="turn_on_js" style="color:#bd2426;">Please turn JavaScript on and reload the page.</h1>
</noscript>
<div id="no-cookie-warning" class="cookie-warning" data-translate="turn_on_cookies" style="display:none">
<p data-translate="turn_on_cookies" style="color:#bd2426;">Please enable Cookies and reload the page.</p>
</div>
<script>
//<![CDATA[
var a = function() {try{return !!window.addEventListener} catch(e) {return !1} },
b = function(b, c) {a() ? document.addEventListener("DOMContentLoaded", b, c) : document.attachEvent("onreadystatechange", b)};
b(function(){
var cookiesEnabled=(navigator.cookieEnabled)? true : false;
if(!cookiesEnabled){
var q = document.getElementById('no-cookie-warning');q.style.display = 'block';
}
});
//]]>
</script>
<div id="trk_captcha_js" style="background-image:url('/cdn-cgi/images/trace/captcha/nojs/h/transparent.gif?ray=701b1688bd452f2c')"></div>
</form>
<script>
//<![CDATA[
(function(){
var isIE = /(MSIE|Trident\/|Edge\/)/i.test(window.navigator.userAgent);
var trkjs = isIE ? new Image() : document.createElement('img');
trkjs.setAttribute("src", "/cdn-cgi/images/trace/captcha/js/transparent.gif?ray=701b1688bd452f2c");
trkjs.id = "trk_captcha_js";
trkjs.setAttribute("alt", "");
document.body.appendChild(trkjs);
var cpo=document.createElement('script');
cpo.type='text/javascript';
cpo.src="/cdn-cgi/challenge-platform/h/b/orchestrate/captcha/v1?ray=701b1688bd452f2c";
window._cf_chl_opt.cOgUQuery = location.search === '' && location.href.indexOf('?') !== -1 ? '?' : location.search;
window._cf_chl_opt.cOgUHash = location.hash === '' && location.href.indexOf('#') !== -1 ? '#' : location.hash;
if (window._cf_chl_opt.cUPMDTk && window.history && window.history.replaceState) {
var ogU = location.pathname + window._cf_chl_opt.cOgUQuery + window._cf_chl_opt.cOgUHash;
history.replaceState(null, null, "\/gaspricemap\/station?__cf_chl_rt_tk=L2jUTw47XIiXTCEBGFfR414NAhEQzFCGdsGZYWpwMpc-1650931749-0-gaNycGzNBz0" + window._cf_chl_opt.cOgUHash);
cpo.onload = function() {
history.replaceState(null, null, ogU);
};
}
document.getElementsByTagName('head')[0].appendChild(cpo);
}());
//]]>
</script>
</div>
</div>
<div class="cf-column">
<div class="cf-screenshot-container">
<span class="cf-no-screenshot"></span>
</div>
</div>
</div>
</div>
</div>
<div class="cf-section cf-wrapper">
<div class="cf-columns two">
<div class="cf-column">
<h2 data-translate="why_captcha_headline">Why do I have to complete a CAPTCHA?</h2>
<p data-translate="why_captcha_detail">Completing the CAPTCHA proves you are a human and gives you temporary access to the web property.</p>
</div>
<div class="cf-column">
<h2 data-translate="resolve_captcha_headline">What can I do to prevent this in the future?</h2>
<p data-translate="resolve_captcha_antivirus">If you are on a personal connection, like at home, you can run an anti-virus scan on your device to make sure it is not infected with malware.</p>
<p data-translate="resolve_captcha_network">If you are at an office or shared network, you can ask the network administrator to run a scan across the network looking for misconfigured or infected devices.</p>
</div>
</div>
</div>
<div class="cf-error-footer cf-wrapper w-240 lg:w-full py-10 sm:py-4 sm:px-8 mx-auto text-center sm:text-left border-solid border-0 border-t border-gray-300">
<p class="text-13">
<span class="cf-footer-item sm:block sm:mb-1">Cloudflare Ray ID: <strong class="font-semibold">701b1688bd452f2c</strong></span>
<span class="cf-footer-separator sm:hidden">•</span>
<span class="cf-footer-item sm:block sm:mb-1"><span>Your IP</span>: 184.19.208.29</span>
<span class="cf-footer-separator sm:hidden">•</span>
<span class="cf-footer-item sm:block sm:mb-1"><span>Performance & security by</span> <a rel="noopener noreferrer" href="https://www.cloudflare.com/5xx-error-landing" id="brand_link" target="_blank">Cloudflare</a></span>
</p>
</div><!-- /.error-footer -->
</div>
</div>
<script>
window._cf_translation = {};
</script>
</body>
</html>
: 0
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.