sensor:
- platform: sql
db_url: !secret hassioslave_db_link ###can be omitted if using default recorder settings
queries:
#....
- name: eth_mined_total_history_24h
query: SELECT * FROM states WHERE entity_id = 'sensor.eth_mined_total' AND created < DATE_ADD(NOW(), INTERVAL -3-24 HOUR) ORDER BY state_id DESC LIMIT 1;
column: 'state'
unit_of_measurement: "ETH"
I saw that but I don’t have a separate database that holds the history from Home Assistant. I’m sorry if that doesn’t make sense. New to this! Would I need to set up a separate database to push the information to?
Hi @krash, that didn’t seem to work. I did as you stated and removed the db_url completely but I get unknown for the total history.
Note: I’m using the unpaid sensor because I haven’t cashed out yet.
- platform: sql
queries:
- name: eth_mined_total_history_1h
query: SELECT * FROM states WHERE entity_id = 'sensor.eth_unpaid' AND created < DATE_ADD(NOW(), INTERVAL -3-1 HOUR) ORDER BY state_id DESC LIMIT 1;
column: 'state'
unit_of_measurement: "ETH"
- name: eth_mined_total_history_6h
query: SELECT * FROM states WHERE entity_id = 'sensor.eth_unpaid' AND created < DATE_ADD(NOW(), INTERVAL -3-6 HOUR) ORDER BY state_id DESC LIMIT 1;
column: 'state'
unit_of_measurement: "ETH"
- name: eth_mined_total_history_12h
query: SELECT * FROM states WHERE entity_id = 'sensor.eth_unpaid' AND created < DATE_ADD(NOW(), INTERVAL -3-12 HOUR) ORDER BY state_id DESC LIMIT 1;
column: 'state'
unit_of_measurement: "ETH"
- name: eth_mined_total_history_24h
query: SELECT * FROM states WHERE entity_id = 'sensor.eth_unpaid' AND created < DATE_ADD(NOW(), INTERVAL -3-24 HOUR) ORDER BY state_id DESC LIMIT 1;
column: 'state'
unit_of_measurement: "ETH"
I did not use the original script as explained in the link.
I created a cron job that runs it every 60 sec as explained above.
It’s been working for weeks now.
Thanks Paulo for your answer, my problem is that I have two GPUS_0. one Nvdia and another ATI. and the TEMP result gives me two values. What I don’t know is how to separate that result.
Hello good morning, when you have ATI and NVIDIA takes them as GPU0.
Here I attach a screenshot of the HiveOS.
I was also able to solve my problem by creating some templates, I leave them in case someone else happens.
These templates are created thanks to the information provided in this post.
{% set t = (states.sensor.hiveos_params.attributes['miner_stats2']['temp'][0]) | float %}
{% set u = (states.sensor.hiveos_params.attributes['miner_stats']['temp'][0]) | float %}
{{ ((t + u)) }}
{% set t = (states.sensor.hiveos_params.attributes['total_khs']) | float %}
{% set u = (states.sensor.hiveos_params.attributes['total_khs2']) | float %}
{{ ((t + u) / 1000) }}
{% set t = (states.sensor.hiveos_params.attributes['miner_stats2']['fan'][0]) | float %}
{% set u = (states.sensor.hiveos_params.attributes['miner_stats']['fan'][0]) | float %}
{{ ((t + u)) }}
Basically what I do I take the values and add them to have a unique reference value.
sorry for my bad english.
I’ve been trying to run monitoring on my rig using your (nice!) guide, but I ran into some issues:
I’ve installed the linux script with modifications, add it to cron, and in mosquitto broker I got:
1628416263: New connection from 192.168.XXX.XXX on port 1883.
1628416263: New client connected from 192.168.XXX.XXX as mosqpub|6916-GTX1060 (p1, c1, k60, u'rig').
1628416263: Client mosqpub|6916-GTX1060 disconnected.
in HA I’ve created sensor.yaml included it in configuration.yaml and fill with the code you posted, but when I check in Developer Tools → States I see there is no data in there
Hey,
It feels like there’s some issue in the config, either in the Linux topic, or in the HA’s mqtt sensor configuration.
I would check the code again and if nothing comes up, try connecting to the broker with an mqtt browser (create a new account and with the mqtt client subscribe to # (everything) to see what the Linux machine is broadcasting)
Those two should help you figure out where the data is going.
I followed the instructions and everything works great!!! Awesome! The problem i have is once i add multiple rigs, i cannot get the gpus to display their proper attributes as they all seem to share the same index #s. Ie: Gpu_0 is the same on all three rigs…
How can i fix this?
Hey, to be honest I never thought about it, as I have 1 rig.
Let me think about it a little
edit:
(ignore my previous answer)
Try appending rig number on the name of the sensors and topics.
You will also need to set a different topic in the hive OS script of each rig hive_mqtt_1, hive_mqtt_2…
And probably different MQTT client user names, in case they try to connect simultaneously and get blocked.
It needs some careful editing, as there’s a lot of code, but i think this is the way.
At least A way, there’s probably a more proper way to get all these stuff but i’m not that experienced
Regarding ethermineInfo, I think you could get better help by asking the author directly, through the forums (I have his name mentioned in the beginning of the post) , or through github (link there too)