I have the rule below that collects the current available share prices for me. It does the job, however I get an error each time the rule runs. Does anyone have any ideas why?
Fromthe structure of the list there is something wron with the LLOY shares. As @rossko57 wrote, just add log lines to see the data at each step. And show us your items maybe there is a problem.
Nothing unusual about the LLOY share by the looks of it, however I moved the order and now VOD doesn’t update. I also removed LLOY from the list and don’t get an error. Another ideas?
2019-08-19 16:01:00.144 [INFO ] [e.smarthome.model.script.org.openhab] - Shares: Obtaining the latest prices.
2019-08-19 16:01:01.781 [INFO ] [e.smarthome.model.script.org.openhab] - Shares: TW has a price of 145.5500p
2019-08-19 16:01:01.783 [INFO ] [e.smarthome.model.script.org.openhab] - Shares: Updating TW.
2019-08-19 16:01:03.306 [INFO ] [e.smarthome.model.script.org.openhab] - Shares: TCG has a price of 8.9780p
2019-08-19 16:01:03.307 [INFO ] [e.smarthome.model.script.org.openhab] - Shares: Updating TCG.
2019-08-19 16:01:05.810 [INFO ] [e.smarthome.model.script.org.openhab] - Shares: SLA has a price of 243.4000p
2019-08-19 16:01:05.811 [INFO ] [e.smarthome.model.script.org.openhab] - Shares: Updating SLA.
2019-08-19 16:01:08.689 [INFO ] [e.smarthome.model.script.org.openhab] - Shares: RMG has a price of 199.3000p
2019-08-19 16:01:08.690 [INFO ] [e.smarthome.model.script.org.openhab] - Shares: Updating RMG.
2019-08-19 16:01:10.327 [INFO ] [e.smarthome.model.script.org.openhab] - Shares: BARC has a price of 141.2200p
2019-08-19 16:01:10.329 [INFO ] [e.smarthome.model.script.org.openhab] - Shares: Updating BARC.
2019-08-19 16:01:11.609 [INFO ] [e.smarthome.model.script.org.openhab] - Shares: LLOY has a price of 49.9650p
2019-08-19 16:01:11.610 [INFO ] [e.smarthome.model.script.org.openhab] - Shares: Updating LLOY.
2019-08-19 16:01:11.890 [ERROR] [ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule 'Get The Latest Share Prices': 2
You’ve hit the nail on the head there @rossko57. Searched the documentation and found it, with the free key your limited to 5 calls per minute. So I’ve now added a small delay between calls to ensure I only ever make 5 calls per minute.
Now that my issue has been solved, there an additional aspect I’d like to cover. I’m not expecting much, but hopefully this information will be of use to others and may even help someone create a binding.
Alpha Avantage also have a GitHub repository, here.
With in the java section I found this example. Is there a way to convert this so that it works with OH? This is in the repository names; patriques82/ alphavantage4j