Custom Sensor with multiple outputs

I am trying to make a custom sensor. I based it on the example:
This kind of works. Next step is to add more functionality. First I want to add more parameters. My sensors has multiple parameters as output with different units of measurements. Where can I find how to do this? Secondly is there a way to set the update rate? Do I need to do anything in my custom python code? Or is there a standard refresh/update parameter in the configuration.yaml that I can add?

Hi phsdev,

This can be done by adding a function to your sensor like this:

    def device_state_attributes(self):
        """Return the state attributes. The format should be a dict with kay/value pairs. """

Several sensors in the official repo have this (eg the plex sensor). Have a look!