Hue motion sensors + remotes: custom component

Glad thats fixed :+1:

#metoo

anynideas how to get the time representation more readable? preferably time first then year/month?

above shows many 2017, which is not very helpful info -)

In python I would split on the comma character, and take the end. In yaml, I wouldn’t know as I do the bare min in yaml… last_updated: 2017-12-28,15:48:23

timestr = 'last_updated: 2017-12-28,15:48:23'
timestr.split(',')[-1]

'15:48:23'
1 Like

Hi Mark,
Since im learning Python as we speak, and my efforts on the contrary have been more yaml related lately…
where do i place this in the hue_sensor.py?
There’s no timestr as i parse it right now?

If you’re planning on manually editing, the line is here.

I was suggesting you add this formatting in your template sensor however.

You could also use a python_script

Testing the dev-phue version, setup failed until I created a blank file called services.yaml in the custom_components directory, but now all seems to be running fine
Cheers

Thanks for the heads up @jimbob1001. That is interesting as I do not have services.yaml as far as I can see. Is that file in your main config directory? Also how did you know to try adding this file?
Cheers

It was mentioned in a previous post here; prior to adding the services.yaml to the custom_components directory there is an error message in the log about the file being missing.

In custom_components/hue.py (not sensors/hue.py) there is a reference to it from line 213…

    descriptions = load_yaml_config_file(
        os.path.join(os.path.dirname(__file__), 'services.yaml'))
    self.hass.services.register(
        DOMAIN, SERVICE_HUE_SCENE, hue_activate_scene,
        descriptions.get(SERVICE_HUE_SCENE),
        schema=SCENE_SCHEMA)

Can also report that Motion sensor and hue tap are both responding instantaneously

Thats the hue hub component. Clearly will need to look into this further

Hi all, I’ve updated the custom component to be consistent with the hub component in HA 0.61 and above (phue-dev is merged into master and therefore no longer exists, also tested with 0.60 and 0.62 successfully). Please ensure you are up to date on both HA (0.61) and the component. Generally when submitting queries on these forums you should state which version of HA you are on to help debugging. I will however assume from now on that everyone is on 0.61 or above, unless otherwise stated.

Please submit any log errors on Github, unless clearly related to config in which case they belong here on the forums. Hopefully config of the component is so simple there will be none :slight_smile:

Next development is to split out remotes as remotes and have them fire events when buttons are pressed, rather than treating them as sensors. If anyone wants to help out (developing or beta testing) please get in touch.
Cheers

1 Like

HI @robmarkcole

i am slightly confused…:wink:
which file do i need to download and replace in my custom_compnents folder?

at the moment i have:

/custom_components/sensor/hue_sensor.py and hue_sensors.py

hue_sensors.py was your previous version.
You changed names to prevent confusion, or is it a third file we need? And, we still need the hue_sensor.py?

Thanks,
Marius

By default you only need what is in the Github repo.

ONLY If HA has problems installing dependencies, then you need to manually add them as per previous insurrections in this thread.
Cheers

so the 08-10-2017 hue_sensorS.py needs to be replaced with the newer hue.py ?

i ask because on your github it mentions hue_sensor.py…(no trailing S), which makes it all a bit confusing I am afraid. Sorry.

Hi ,you will see that the component has a dependency REQUIREMENTS = ['hue-sensors==1.2']. This can be manually imported by placing hue_sensors.py from here into the sensors custom component folder.

What you have highlighted is the renaming of the main file in an earlier change.

Cheers

HI Rob,

Thanks,

Just to be precise:

in the latest versionology, we still need both

and

your file has been updated and hue_sensor.py has been updated and renamed to hue.py…

That it?

Hi you shouldn’t need both, only if HA kicks up an error about being unable to install the requirement.
Cheers

If you have updated to the latest version of home assistant (0.61) you need to download (and place within your custom_components folder) the files called custom_components/hue.py and custom_components/sensor/hue.py that can be found here here

The first one is simply an edited version of the hue.py that is supplied with homeassistant 0.61

The second one is what allows the sensors to work

1 Like

funny,
different versions if what to do…

it would be very convenient if the naming of the python scripts wouldn’t be so confusing. It was like that in the hue_sensor(s).py situation, and gets even more so in the 2x hue.py situation we have now…

too bad really, because unique file names are real prerequisites in debugging and correct installing.

As it stands, there are at least 3 different versions of what to do… :wink:

Cheers,
Marius

Hi there @Mariusthvdb , all components follow the convention of keeping the same filename for hub and then for ‘component files’. E.g. blink, check out the HA repo.
If you feel the docs are lacking please submit a PR.
Cheers

Not really different versions of what to do, it’s just that home assistant itself was updated several times recently with breaking changes to the hue component, which in turn meant that this custom component had to be refactored each time, so the instructions have had to keep changing.

I think you got confused with what to download from where - it’s just the files from the one repo that are needed, not the things that you linked to in your earlier thread. Just go to this repo download the custom_components files and follow the instructions for adding to your config

Good luck!