[Support] Electric Brain Unraid API


Recommended Posts

and my server.yaml

 


#### CUSTOMIZE #################################################################

homeassistant:
  customize_glob:
    sensor.unraid_server:
      templates:
        hs_color: "if (state === 'up') return [115,100];
          else return [360,100];"

glances:
  - host: !secret unraid_server

sensor:
  - platform: template 
    sensors:
      unraid_server:
        entity_id: device_tracker.unraid_server
        friendly_name: Unraid
        icon_template: mdi:nas
        value_template: >
          {% if is_state('device_tracker.unraid_server', 'home') %}
            up
          {% else %}
            down
          {% endif %} 
      server_motherboard:
        value_template: "{{state_attr('binary_sensor.unraid_server', 'motherboard') }}"
      server_cpu:
        value_template: "{{state_attr('binary_sensor.unraid_server', 'cpu') }}"
      server_memory:
        value_template: "{{state_attr('binary_sensor.unraid_server', 'memory') }}"
      server_diskspace:
        value_template: "{{state_attr('binary_sensor.unraid_server', 'diskSpace') }}"      
      server_arraystatus:
        value_template: "{{state_attr('binary_sensor.unraid_server', 'arrayStatus') }}"
      server_arrayprotection:
        value_template: "{{state_attr('binary_sensor.unraid_server', 'arrayProtection') }}"

Link to comment
3 minutes ago, skank said:

no this is my config yaml

 

 


default_config:

homeassistant:
  customize: !include customize.yaml
  packages: !include_dir_named packages


frontend:
  themes: !include_dir_merge_named themes
  
# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
#   base_url: example.duckdns.org:8123

lovelace:
  mode: yaml

customizer:
  custom_ui: local
  
hacs:
  token: !secret hacs_token
  appdaemon: true
  
# Text to speech

tts:
  - platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

sensor:
  - platform: unifigateway
    host: !secret unifi_host
    site_id: !secret unifi_site
    username: !secret unifi_username  
    password: !secret unifi_password
    monitored_conditions:
      - www
      - lan
      - wan
      - wlan
      - vpn
      - alerts
      - firmware
  - platform: template 
    sensors:
      server_motherboard:
        value_template: "{{state_attr('binary_sensor.unraid_server', 'motherboard') }}"
      server_cpu:
        value_template: "{{state_attr('binary_sensor.unraid_server', 'cpu') }}"
      server_memory:
        value_template: "{{state_attr('binary_sensor.unraid_server', 'memory') }}"
      server_diskspace:
        value_template: "{{state_attr('binary_sensor.unraid_server', 'diskSpace') }}"      
      server_arraystatus:
        value_template: "{{state_attr('binary_sensor.unraid_server', 'arrayStatus') }}"
      server_arrayprotection:
        value_template: "{{state_attr('binary_sensor.unraid_server', 'arrayProtection') }}"
        
remote:
  - platform: harmony
    name: Harmony Hub
    host: !secret harmony


  

 

Ah okay, so when you add the API sensors it should be as above?

 

That wouldn't explain the issue with glances anyway.. Does the unraid stuff show up or is both the Glances and unraid stuff missing? 

 

Link to comment

its under packages > server.yaml

 


#### CUSTOMIZE #################################################################

homeassistant:
  customize_glob:
    sensor.unraid_server:
      templates:
        hs_color: "if (state === 'up') return [115,100];
          else return [360,100];"

glances:
  - host: !secret unraid_server

sensor:
  - platform: template 
    sensors:
      unraid_server:
        entity_id: device_tracker.unraid_server
        friendly_name: Unraid
        icon_template: mdi:nas
        value_template: >
          {% if is_state('device_tracker.unraid_server', 'home') %}
            up
          {% else %}
            down
          {% endif %} 
      server_motherboard:
        value_template: "{{state_attr('binary_sensor.unraid_server', 'motherboard') }}"
      server_cpu:
        value_template: "{{state_attr('binary_sensor.unraid_server', 'cpu') }}"
      server_memory:
        value_template: "{{state_attr('binary_sensor.unraid_server', 'memory') }}"
      server_diskspace:
        value_template: "{{state_attr('binary_sensor.unraid_server', 'diskSpace') }}"      
      server_arraystatus:
        value_template: "{{state_attr('binary_sensor.unraid_server', 'arrayStatus') }}"
      server_arrayprotection:
        value_template: "{{state_attr('binary_sensor.unraid_server', 'arrayProtection') }}"

Link to comment

Oh cool I didnt know you could add packages like that, thanks! I had been using !include for each thing but my sensors and other files were getting a bit large so this would be a good way to break them up.

 

But Im afraid I really don't know what the problem is sorry! The only thing I can thing of is that the template is creating a sensor with the same name as a glances one, though I thought that would just append a _2 to the id. 

Link to comment
2 hours ago, ElectricBrainUK said:

Oh cool I didnt know you could add packages like that, thanks! I had been using !include for each thing but my sensors and other files were getting a bit large so this would be a good way to break them up.

 

But Im afraid I really don't know what the problem is sorry! The only thing I can thing of is that the template is creating a sensor with the same name as a glances one, though I thought that would just append a _2 to the id. 

ur welcome :p

damn so im on my own ? :(

 

Link to comment

or should i delete the template sensors i created from the binary sensor

and enter the entity "binary sensor" in the card and then point to the attributes?

 

How did you do this here?

https://github.com/ElectricBrainUK/UnraidAPI/wiki/Lovelace-Config

 

See also

https://github.com/custom-cards/entity-attributes-card

 

It also keeps saying the binary sensor is unavailble

 

the first time under development options i could look at the binary sensor and see the attributes, now i cannot anymore

 

1.JPG.ffbd7bfa32328396f4a269b9ec74d1e4.JPG

 

Hopefully this will all be fixed once you have a HA addon :p

Edited by skank
Link to comment
14 minutes ago, skank said:

or should i delete the template sensors i created from the binary sensor

and enter the entity "binary sensor" in the card and then point to the attributes?

 

How did you do this here?

https://github.com/ElectricBrainUK/UnraidAPI/wiki/Lovelace-Config

 

See also

https://github.com/custom-cards/entity-attributes-card

 

It also keeps saying the binary sensor is unavailble

 

the first time under development options i could look at the binary sensor and see the attributes, now i cannot anymore

 

1.JPG.ffbd7bfa32328396f4a269b9ec74d1e4.JPG

 

Hopefully this will all be fixed once you have a HA addon 😛

The person that added that is Ezra a member of our community but as I said best to reach out to him on the discord server as he is not active here, here is the invite link: https://discord.gg/Qa3Bjr9

Link to comment
2 hours ago, chip said:

What other type info can be displayed/pulled with API?

 

Some stats that interest me are  - Can this info be pulled?

uptime of system

Unraid Version running

Apps running/installed

 

 

 

Most major things are listed here: https://github.com/ElectricBrainUK/UnraidAPI/wiki/Home-Assistant-Integration

 

Uptime isn't explicitly but it will report when it turns on so if you're using home assistant that would know uptime. I'll add it to the list though

 

Unraid version isn't there yet but I'll also add that to the list.

 

If by apps you means dockers/ VMS that is there, nothing for plugins though

Link to comment
19 hours ago, ElectricBrainUK said:

Most major things are listed here: https://github.com/ElectricBrainUK/UnraidAPI/wiki/Home-Assistant-Integration

 

Uptime isn't explicitly but it will report when it turns on so if you're using home assistant that would know uptime. I'll add it to the list though

 

Unraid version isn't there yet but I'll also add that to the list.

 

If by apps you means dockers/ VMS that is there, nothing for plugins though

Apps I meant plugins.

 

Would be great on those other items. Thanks!

Link to comment
  • 3 weeks later...

I use your plugin at my unraid server and have connect it with my Home Assistant. But when i check the state of a container in Home Assistant, is shows always off but the container is running for sure at my unraid server. In your webinterface it shows also running but in HA it's shows off. Can you help me?

Link to comment
1 hour ago, ElectricBrainUK said:

Sounds like there is a problem with the mqtt connection, can you confirm if you see the mqtt messages being sent when container states change? Also is there anything unusual in the logs? 

Forget my post ;-) It was a setting which i found at your site. after a restart works now perfect since i add MQTTRefreshRate and MQTTCacheTime to the unraid api docker. Thx for your reply

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.