Announcement

Collapse
No announcement yet.

Request for new device - Value

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • spud
    replied
    ooops sorry for the typo
    I had checked that a value was set to the "balance USD", but not that this value was correct.

    Leave a comment:


  • TechHA
    replied
    Thank you very much!

    At first I couldn't get the answer to be correct...I kept looking at the script and finally found the typo.

    This line:
    hs.SetDeviceValueByRef(balanceUSDRef, balance * BTCUSDRef, true);

    Needs to be:
    hs.SetDeviceValueByRef(balanceUSDRef, balance * BTCUSD, true);

    Once that was fixed it works perfect!

    Thanks again!

    Leave a comment:


  • spud
    replied
    create a "Balance USD" device like this one:
    Click image for larger version

Name:	balanceusd.jpg
Views:	1
Size:	52.9 KB
ID:	1174455

    then create an event like below that will update the "Balance USD" device value everytime the Bitcoin balance or exchange rate is updated:

    Click image for larger version

Name:	balanceusdevent.jpg
Views:	1
Size:	50.3 KB
ID:	1174456

    here is the content of bitcoin_balance_usd.cs

    Code:
    public object Main(object[] Parms)
    {
        int balanceUSDRef = hs.GetDeviceRefByName("Balance USD");
        int balanceRef = hs.GetDeviceRefByName("Balance");
        int BTCUSDRef = hs.GetDeviceRefByName("BTC/USD");
        double balance = hs.DeviceValueEx(balanceRef);
        double BTCUSD = hs.DeviceValueEx(BTCUSDRef);
        
        hs.SetDeviceValueByRef(balanceUSDRef, balance * BTCUSDRef, true);
        return 0;
    }

    Leave a comment:


  • TechHA
    started a topic Request for new device - Value

    Request for new device - Value

    First, thanks for another great plug-in! A nice convenience to see my Bitcoin balance without logging in to a website.

    Would it be possible to get another device created to display the actual value of the Bitcoins? Or, could you show me how to put it into a script to display the Value in a device? That way we can see the actual dollar amount in whatever currency we are tracking, in my case US Dollars.

    Right now I have: Balance and BTC/USD
    I would like: Value (BTC/USD * Balance)

    Thanks
Working...
X