Hi All,
Im struggling to get this work:
This is working, but get the whole output of the API into attributes
- platform: rest
name: "Bitladon ADA"
resource: https://api.bitladon.com/market/ada
scan_interval: 60
value_template: "{{ value_json.value }}"
json_attributes:
- result
info attributes
result:
ticker: ADA
name: Cardano
buyfinal: '0.77776'
sellfinal: '0.74428'
24volume: '587326.08793569'
change24h: '-2.42'
change72h: '2.54'
change168h: '1.01'
lastprice: '0.78088'
description: >-
Buy Cardano at a great price<br /><br />At Bitladon you never have to doubt
whether you are buying Cardano (ADA) or other cryptocurrencies for a fair
price. We are always transparent in our prices and fees. Our platform is
accessible to anyone wishing to buy or sell crypto money securely and simply.
Create an account today and experience just how easy and fast it is
yourself.<br />
links:
explorer: 'https://cardanoexplorer.com/'
website: 'https://www.cardano.org/'
forum: 'https://forum.cardano.org/'
whitepaper: 'https://www.cardano.org/en/academic-papers/'
twitter: 'https://twitter.com/cardano'
reddit: 'https://www.reddit.com/r/cardano/'
facebook: 'https://www.facebook.com/groups/CardanoCommunity'
youtube: 'https://www.youtube.com/channel/UCbQ9vGfezru1YRI1zDCtTGg'
telegram: 'https://t.me/CardanoAnnouncements'
linkedin: 'https://www.linkedin.com/company/cardano-foundation/'
github: 'https://github.com/input-output-hk/cardano-sl/'
wallet: 'https://daedaluswallet.io'
blog: ''
networkfee: '1.00000000'
sendminimum: '4.00000000'
withdrawal: true
withdrawaltag: false
deposit: false
deposittag: false
logo: 'https://www.bitladon.com/img/currency/ADA_groot.png'
logobig: 'https://www.bitladon.com/img/currency/ADA_groot.png'
Only what I want to have in attributes:
ticker: ADA
name: Cardano
buyfinal: '0.77776'
change24h: '-2.42'
And in state:
sellfinal: '0.74428'
This is the API output raw JSON:
{
"apistatus": 1,
"error": false,
"result": {
"ticker": "BTC",
"name": "Bitcoin",
"buyfinal": "43396.14489",
"sellfinal": "42280.12138",
"24volume": "184.67864932",
"change24h": "-0.36",
"change72h": "5.74",
"change168h": "8.70",
"lastprice": "43183.46155",
"description": "Trade Bitcoin at a fair price<br /><br />Bitladon is the place to be to buy and sell Bitcoin, also known as BTC, for a fair market price. We offer a safe and easy-to-use platform for people who wish to trade in cryptocurrency, like Bitcoin or Litecoin. Are you only just starting to trade in Bitcoin or are you an old-hand in it already? Either way, our platform makes trading cryptocurrency easy and convenient. Read on and find out how it works.<br />",
"links": {
"explorer": "https://blockchain.info/",
"website": "https://bitcoin.org/",
"forum": "https://bitcointalk.org",
"whitepaper": "https://bitcoin.org/bitcoin.pdf",
"twitter": "https://twitter.com/btc",
"reddit": "https://www.reddit.com/r/Bitcoin/",
"facebook": "https://www.facebook.com/bitcoinchart/",
"youtube": "",
"telegram": "",
"linkedin": "",
"github": "https://github.com/bitcoin/",
"wallet": "https://wallet.btc.com",
"blog": "https://bitcoin.org/en/blog"
},
"networkfee": "0.00030000",
"sendminimum": "0.00130000",
"withdrawal": true,
"withdrawaltag": false,
"deposit": true,
"deposittag": false,
"logo": "https://www.bitladon.com/img/currency/BTC_groot.png",
"logobig": "https://www.bitladon.com/img/currency/BTC_groot.png"
}
}
I tried some things thats working correct. Get correct info in state:
- platform: rest
name: "Bitladon ADA"
resource: https://api.bitladon.com/market/ada
scan_interval: 60
value_template: "{{ value_json.result.sellfinal }}"
value_template: "{{ value_json.result.name }}"
value_template: "{{ value_json.result. buyfinal }}"
But when I try those in json_attributes I don’t get any information.