Photons for Home Assistant

Is there any thought for a Photons Integration in Home Assistant as an addon or HACS integration? I would love a simple, intuitive way to control the individual zones in my Tiles and Candle Color through Home Assistant, but I'm really struggling to find any possible way to do so without actually creating an integration for it (which with my little Python knowledge seems out of the realm of possibility for me).
Home Assistant currently has very poor support for LIFX Tiles and Candle Color (it has zero ability to control individual zones), so there's very little room for customization outside of single, static colors and the morph and flame effects (currently only achievable by using REST commands and the LIFX HTTP API). Photons obviously has fantastic support for the Tiles - and presumably Candle Color - but with very little Python knowledge I have no way to connect Photons to Home Assistant.

Hi
I also think photons would be a good companion to Home Assistant. I think the easiest way to do that would be to make a plugin to home assistant that talks http to photons interactor. That does mean the user would have to make interactor work, but I think that shouldn't be too much of a problem given they have to do that for Home Assistant anyway.
The problem becomes is that I do not have the time. My mental health took a dramatic nosedive last year and I'm still recovering. That recovery includes being a bit more deliberate with how I manage my time and workload and the side projects just don't have priority; and Home Assistant integration isn't something I need for the private copy of Photons.
Also, I've never used Home Assistant and so there's an extra learning cost for something I don't use myself.
I'm sure there will be a point in the (far) future where I find the time for doing this, but until then it'd have to be done by someone else.

Very understandable. Hopefully someone else with more python knowledge than me can figure out a way to get Photons (or at least some method of controlling Tiles/Candle Color zones...) in Home Assistant someday.

yeah. Also if you speak http to photons interactor, then the home assistant part doesn't have to be in Python. HTTP is in all the languages!

yeah, for sure.

I like to run photons interactor in docker, then just send commands via the rest integration. Here is an example of one of sending the morph effect to my tiles though photons
rest_command:
 morph:
    url: 'http://<IP_ADDRESS>:6100/v1/lifx/command'
    method: "put"
    payload: '{"command":"effects/run", "args":{"matcher":{"label":"Tiles"},"matrix_animation": "MORPH","transform": {"power": "on"}}}'
    verify_ssl: false

I have lots of similar commands that i just trigger though automatons or button cards. Takes some effort to get setup, but in the end it works well.
With the candle, you could try having a look at creating scenes in photons then just calling them by a http request again. I haven't tried this though.
Here are some screenshots of the scene_capture and the scene_apply commands that should help craft a scene to call.

https://photons.delfick.com/apps/interactor/index.html

To add to my comment, i have just tried scenes in photons and wow they work well. Great job delfick
Here is a curl command i sent when all my lights  were in the state i wanted. (You will probably want to add matcher so its just the candle)
curl -XPUT http://<IP_ADDRESS>:6100/v1/lifx/command \
  -HContent-Type:application/json \
  -d '{"command":"scene_capture", "args":{"uuid": "myuuid", "label": "myscene"}}'

then to apply it
curl -XPUT http://<IP_ADDRESS>:6100/v1/lifx/command \
  -HContent-Type:application/json \
  -d '{"command":"scene_apply", "args":{"uuid": "myuuid"}}'

So i could remember the uuid, i just used the uuid from the scene in the lifx app, gotten from here

Scene capture will create a uuid for you if you don't specify it and then scene_info can be used to find uuids for the labels you've given your scenes. Probably best to try and not get confused between scenes in interactor and scenes in the LIFX Cloud

I like to run photons interactor in docker, then just send commands via the rest integration. Here is an example of one of sending the morph effect to my tiles though photons
rest_command:
 morph:
    url: 'http://<IP_ADDRESS>:6100/v1/lifx/command'
    method: "put"
    payload: '{"command":"effects/run", "args":{"matcher":{"label":"Tiles"},"matrix_animation": "MORPH","transform": {"power": "on"}}}'
    verify_ssl: false

I have lots of similar commands that i just trigger though automatons or button cards. Takes some effort to get setup, but in the end it works well.
With the candle, you could try having a look at creating scenes in photons then just calling them by a http request again. I haven't tried this though.
Here are some screenshots of the scene_capture and the scene_apply commands that should help craft a scene to call.

https://photons.delfick.com/apps/interactor/index.html

I'm running Home Assistant (HassOS) off a RPi4, so I don't think - and I may be wrong here - that I have the ability to run the interactor in docker, as I don't have access to a command line. Sending REST commands seems easy enough aside from that though...that's what I currently use (the LIFX HTTP API) to send flame/morph effect commands to Tiles/Candle.

Just tested it on hassos, as i don't use hassos personally. You seem to be able to download and access the things you need by installing the portainer addon through supervisor. This can be used to run photons. After installing it and opening the web ui, click on the "containers" tab on the side and click on 'add container'. Enter the config you see in this screenshot.

Click on deploy and wait.
When it is finished it should say starting.

Exit out of that and download the ssh addon, if you cannot see it, enable advanced mode from your profile (bottom left). After starting that you can click on the open web ui. From there you should be able to run the commands i showed above for creating and testing the scenes. Heres an example of the help command.

Also, i forgot to post my home assistant config for the scenes, here it is.
rest_command:
  my_scene:
    url: 'http://<IP_ADDRESS>:6100/v1/lifx/command'
    method: "put"
    payload: '{"command":"scene_apply", "args":{"uuid": "put the uuid of the created scene here"}}'
    verify_ssl: false

Hope this helps!

Thanks for the writeup, but I am a noob so I have questions... Why is your port in your URL 6100? Do I need to use that, and if so, is there anything else I need to do to use it? Also, as you've said, you use rest commands to send animations/scenes to your Tiles... I am wondering if it's possible to send rest commands for custom animations like the Pac Man animation. I'm not 100% sure if the Pac Man animation was part of Photons or another library I'm thinking of, but I would like to send a rest command to my tiles to put that animation (or other cool custom animations onto my Tiles, but I've got very little experience doing this stuff.

All good! Happy to help. The port is just the port used by photons interactor, no need to change that. The only thing in the url you need to change is the IP address. This should be the IP of the machine your home assistant is running on.
With the animations, yes pacman is apart of photons. Heres an example of the config for that
rest_command:
  pacman:
    url: 'http://put.ip.here:6100/v1/lifx/command'
    method: "put"
    payload: '{"command":"animation/start", "args":{"matcher":{"label":"name of your tiles"},"animations": "pacman","transform": {"power": "on"}}'
    verify_ssl: false

Just remember to change {"label":"name of your tiles"}, you only need to change the "name of your tiles" part  in there and the IP in the URL.

So the way I understand it, the only reason this rest command works is because we installed Photons through Portainer, right? So the SSH commands are really just for testing, I don't need it for anything concrete in terms of automations, scripts, etc?

That's correct, the ssh addon was simply for testing. Its was just a simple way of sending the web requests. Once the rest commands are set up, the only thing you need to run is Photons. All Portainer did was install photons for us, so it shouldn't need to run after the install. Portainer  after the install would only really be good to see the status of the photons service if something stops working ( if has crashed etc.)

Makes sense. So I'm trying to incorporate that Pac Man Rest Command into Home Assistant using my own URL, but I'm getting an "Error URL status code 400" when I call this rest command:
# LIFX PacMan Effect pacman:   url: 'http://<IP_ADDRESS>:6100/v1/lifx/command'   method: "put"   payload: '{"command": "animation/start", "args":{"label":"Tiles"}, "animations": "pacman", "transform": {"power: "on"}}'
Hopefully if I can get this Pac Man animation working then I can tinker with the rest of the animations and all will be good. But I'm not sure what I'm doing wrong...

@Kackerlacka you've copied in the payload wrong.
Also, @Final-Hawk, transform isn't an option to animation/start :)

So what you want is
{"command":"animation/start", "args": {"animations": "pacman"}}

And by not specifying a matcher, it'll run it on all the tiles it can find.

Also, @Final-Hawk, transform isn't an option to animation/start :)
Oops Thanks for catching that

Thank you!! It works! Sort of...calling the Pac Man rest command just randomly flashes all my tiles at 100% brightness with no sign of pac man, but the fact that I've gotten Photons in HA to work with my Tiles at all speaks volumes for me! Is there a list of animations I can replace {"animations": pacman} with?
And this may be a huge longshot, but is there an easy way to control the Tile/Candle zones using a rest command? Again I apologize, I am NOT even close to being a programmer, but I would love to be able to set specific Tile zones to colors so I can make custom scenes/animations.
Thanks, guys for your help - I really appreciate you being understanding of my incredible lack of knowledge with everything lol.

what happens if you just do {"command": "animation/start"} ?

Awesome! The flashing happens when the tiles are on one of the built in firmware effect, so just change back to plain colour mode and it should work. You will also need to create a animation stop command so it will stop sending the data.
As with the zones on the candle and tiles, I'm not sure about an exact command to send the zone data to them but as I was showing before the simplest way (I think) to do that would be though scenes

For controlling candle/tile with a command, it seems @Final-Hawk is right the only way currently is via a scene. I'd have to add a command that lets you set candle/tile zones directly.

So in terms of scenes with Photons, is there really any difference between creating a special scene in the app and importing that into home assistant vs. using Photons?
Honestly I really just want to be able to re-create the "Animate" effect that's available in the app, using Photons. That and changing the color of the "flame" effect from red to blue/green!

So in terms of scenes with Photons, is there really any difference between creating a special scene in the app and importing that into home assistant vs. using Photons?

Speed and internet. Photons doesn't require internet and is a lot faster then using the cloud. That does it for me.

Though, you could use the Set64 message directly I suppose (note also that width is different on a candle):
{
  "matcher": {
    "cap": "matrix"
  },
  "pkt_type": "Set64",
  "pkt_args": {
    "length": 1,
    "tile_index": 0,
    "width": 8,
    "colors_count": 2,
    "x": 0,
    "y": 0,
    "colors": [
      {
        "hue": 20,
        "brightness": 1,
        "saturation": 1,
        "kelvin": 3500
      },
      {
        "hue": 200,
        "brightness": 1,
        "saturation": 1,
        "kelvin": 9000
      }
    ]
  }
}

Scenes in photons interactor is essentially the same thing as in the LIFX ecosystem but stored in a completely different place and specified in a completely different way :) A scene is a snapshot of your devices at some point.
For MORPH with blue/green you'd want
{"matcher": {"cap": "matrix"}, "matrix_animation": "MORPH", "matrix_options": {"palette": ["blue", "green"]}}
But the firmware on the candle and tiles doesn't look at palette for the FLAME effect and you can't change the colours for that one.

it should be easy to add a command specifically for setting zones on a tile/candle. I'll see when I can find time to do that.

Photons doesn't implement most of the effects in the app. When I rewrote the tile animation code last year I made it possible to add the ability to send commands to devices that aren't tiles but have never found the time to do that. Once that happens then it's a bit more possible to add most of the effects in the app.
Also, with your tiles, I recommend following this https://photons.delfick.com/apps/arranger/index.html

So in terms of scenes with Photons, is there really any difference between creating a special scene in the app and importing that into home assistant vs. using Photons?

Speed and internet. Photons doesn't require internet and is a lot faster then using the cloud. That does it for me.

Agreed with the speed aspect. But from my undertanding sending a REST command to Photons would have just as much latency as sending a REST command using the normal LIFX HTTP API right? Or am I wrong there?  Does sending a REST command to Photons enact some LAN-only stuff that executes super quickly compared to HTTP? I was under the impression that the REST API in general is an HTTP-based thing...but what do I know.
And delfick, to answer your question, just running {"command": "animation/start"} does the same thing as running the pacman animation - my Tiles flash random 100% brightness colors like green and blue. Could be that I have to change it to a palette color instead of a separate animation like Final-Hawk said, but I actually can no longer set my Tiles to a single color after running that command, it just keeps flashing regardless of my attempts to set it's color to white. I'll look into it more tomorrow, it's probably something super obvious I'm messing up.
Lastly, is there a reason the color of the flame effect can't be changed? It seems to me like it'd be a very simple change honestly, and it'd be super cool to have blue flames. Likewise, having morph and flame on the LIFX Beam would be super cool too, but for some reason that seems impossible even with Photons.
I'll definitely look into that set command for setting the zones for my candles and tiles.

With the flashing, stop all animations running by sending the {"command": "animation/stop"} payload and {"command": "effects/stop"} payload. I have this issue when I don't do this, my effect buttons I made in HA actually run this then the effect command to prevent this

Agreed with the speed aspect. But from my undertanding sending a REST command to Photons would have just as much latency as sending a REST command using the normal LIFX HTTP API right? Or am I wrong there?  Does sending a REST command to Photons enact some LAN-only stuff that executes super quickly compared to HTTP? I was under the impression that the REST API in general is an HTTP-based thing...but what do I know.

The difference is your sending a command to the machine photons is running on compared to sending it to Lifx's cloud. Photons stays inside your network and is not bottlenecked by how fast your internet or Lifx's server speed is.

The difference is your sending a command to the machine photons is running on compared to sending it to Lifx's cloud. Photons stays inside your network and is not bottlenecked by how fast your internet or Lifx's server speed is.

Exactly.
Let's say you're in Australia and you send a HTTP command to the HTTP API. Then you have a command travelling 15,000km to our servers in America and back rather than all within the confines of your own home :)

my Tiles flash random 100% brightness colors like green and blue

That's super weird. I don't have my tiles setup atm but I don't think I've broken animations. I'm not sure what's happening there.
Can you use the LIFX app to change it to particular colours and paint on them?

Lastly, is there a reason the color of the flame effect can't be changed?

Firmware engineers didn't implement that. The tiles are now discontinued. LIFX's support for the tiles is that they will always work in the app and cloud, but there won't be new features added moving forward

Likewise, having morph and flame on the LIFX Beam would be super cool too, but for some reason that seems impossible even with Photons.

Yeap, that's a firmware effect and difficult (impossible I think) to replicate with messages and it's only on candle/tile firmware

To add to the flashing issue, so we are on the same page. Does it look like this?
https://user-images.githubusercontent.com/63589370/122689264-b75fbf00-d264-11eb-9e67-295595bde3c7.mp4
Also to stop the effects on the tiles, this is what i use. (although with a matcher) Just remember to change the IP address
  stop_effect:
    url: 'http://<IP_ADDRESS>:6100/v1/lifx/command'
    method: "put"
    payload: '{"command":"effects/stop"}'
    verify_ssl: false
  stop_animation:
    url: 'http://<IP_ADDRESS>:6100/v1/lifx/command'
    method: "put"
    payload: '{"command":"animation/stop"}'
    verify_ssl: false

Stop  animation stops the animations in photons, like pacman etc. The stop effect one stops the built in firmware effect. If you run both of those before you start the pacman or other animations it should work.

Yes, that's exactly what my Tiles were doing, and you're right, stopping effects and animations worked like a charm and I can now call the Pac Man animation from Home Assistant! Yay!
So essentially the firmware engineers coded those flame and morph effects into the Tiles and Candle Color, but Photons doesn't use "firmware effects" so to speak for its animations, it just really quickly moves static scenes to create the illusion of animation?
Whether or not that's the case, wouldn't it technically be possible to re-create the flame effect as a Photons Animation but in different colors?

Yes, that's exactly what my Tiles were doing, and you're right, stopping effects and animations worked like a charm and I can now call the Pac Man animation from Home Assistant! Yay!

wooh! Thanks for helping with that @Final-Hawk

for its animations, it just really quickly moves static scenes to create the illusion of animation?

Correct. It updates every pixel on the tiles every 0.075 seconds. The physical limitations of WIFI means I can't go much faster and I don't think that refresh rate is enough for a flame. I could be wrong there, but I also don't have the Maths skillz to implement that effect anyway.

Correct. It updates every pixel on the tiles every 0.075 seconds. The physical limitations of WIFI means I can't go much faster and I don't think that refresh rate is enough for a flame. I could be wrong there, but I also don't have the Maths skillz to implement that effect anyway.

So from what I understand, Photons sends a constant stream of data through LAN to the Tiles in order to update them at that 0.075 second rate, but the limitations of Wi-Fi prevent us from re-creating something like the Flame Effect as it would need to update quicker than 0.075s. Does that mean that when I normally call the Flame or Morph effects from my HTTP API Rest Commands in Home Assistant, it's still sending a constant stream of data to the Tiles, where the data isn't instructions for updating the zones every 0.075s, but rather instructions to call the firmware effects, and the updating is happening internally, allowing the refresh rate to be bounded not by limitations of Wi-Fi, but hardware/firmware limitations?

The firmware effects are happening in firmware whereas photons animations
(and most effects in the app) are a stream of instructions.
So for flame, I send one command to say start flame and then the device
doesn't need any further external input to keep doing that.
Whereas with the animation, the device itself has no concept of the
animation.
On Mon, 21 Jun 2021, 8:43 am Kackerlacka, @.***> wrote:

Correct. It updates every pixel on the tiles every 0.075 seconds. The
physical limitations of WIFI means I can't go much faster and I don't think
that refresh rate is enough for a flame. I could be wrong there, but I also
don't have the Maths skillz to implement that effect anyway.
So from what I understand, Photons sends a constant stream of data through
LAN to the Tiles in order to update them at that 0.075 second rate, but the
limitations of Wi-Fi prevent us from re-creating something like the Flame
Effect as it would need to update quicker than 0.075s. Does that mean that
when I normally call the Flame or Morph effects from my HTTP API Rest
Commands in Home Assistant, it's still sending a constant stream of data to
the Tiles, where the data isn't instructions for updating the zones every
0.075s, but rather instructions to call the firmware effects, and the
updating is happening internally, allowing the refresh rate to be bounded
not by limitations of Wi-Fi, but hardware/firmware limitations?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/delfick/photons/issues/61#issuecomment-864621472, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/AAA2V5M5GREHRATYTSDSGWTTTZVK5ANCNFSM467LHNTQ
.

The firmware effects are happening in firmware whereas photons animations (and most effects in the app) are a stream of instructions. So for flame, I send one command to say start flame and then the device doesn't need any further external input to keep doing that. Whereas with the animation, the device itself has no concept of the animation.
…
On Mon, 21 Jun 2021, 8:43 am Kackerlacka, @.***> wrote: Correct. It updates every pixel on the tiles every 0.075 seconds. The physical limitations of WIFI means I can't go much faster and I don't think that refresh rate is enough for a flame. I could be wrong there, but I also don't have the Maths skillz to implement that effect anyway. So from what I understand, Photons sends a constant stream of data through LAN to the Tiles in order to update them at that 0.075 second rate, but the limitations of Wi-Fi prevent us from re-creating something like the Flame Effect as it would need to update quicker than 0.075s. Does that mean that when I normally call the Flame or Morph effects from my HTTP API Rest Commands in Home Assistant, it's still sending a constant stream of data to the Tiles, where the data isn't instructions for updating the zones every 0.075s, but rather instructions to call the firmware effects, and the updating is happening internally, allowing the refresh rate to be bounded not by limitations of Wi-Fi, but hardware/firmware limitations? — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#61 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA2V5M5GREHRATYTSDSGWTTTZVK5ANCNFSM467LHNTQ .

Makes perfect sense, thanks for satisfying my curiosity about how all this works.

All good :)
On Mon, 21 Jun 2021, 8:52 am Kackerlacka, @.***> wrote:

The firmware effects are happening in firmware whereas photons animations
(and most effects in the app) are a stream of instructions. So for flame, I
send one command to say start flame and then the device doesn't need any
further external input to keep doing that. Whereas with the animation, the
device itself has no concept of the animation.
… <#m_6528188421854542507_>
On Mon, 21 Jun 2021, 8:43 am Kackerlacka, @.***> wrote: Correct. It
updates every pixel on the tiles every 0.075 seconds. The physical
limitations of WIFI means I can't go much faster and I don't think that
refresh rate is enough for a flame. I could be wrong there, but I also
don't have the Maths skillz to implement that effect anyway. So from what I
understand, Photons sends a constant stream of data through LAN to the
Tiles in order to update them at that 0.075 second rate, but the
limitations of Wi-Fi prevent us from re-creating something like the Flame
Effect as it would need to update quicker than 0.075s. Does that mean that
when I normally call the Flame or Morph effects from my HTTP API Rest
Commands in Home Assistant, it's still sending a constant stream of data to
the Tiles, where the data isn't instructions for updating the zones every
0.075s, but rather instructions to call the firmware effects, and the
updating is happening internally, allowing the refresh rate to be bounded
not by limitations of Wi-Fi, but hardware/firmware limitations? — You are
receiving this because you commented. Reply to this email directly, view it
on GitHub <#61 (comment)
https://github.com/delfick/photons/issues/61#issuecomment-864621472>,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAA2V5M5GREHRATYTSDSGWTTTZVK5ANCNFSM467LHNTQ
.
Makes perfect sense, thanks for satisfying my curiosity about how all this
works.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/delfick/photons/issues/61#issuecomment-864622353, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/AAA2V5OZYKV3H34N3MGJ3ILTTZWJTANCNFSM467LHNTQ
.

You can trigger firmware effects using Interactor, though: https://omg.dje.li/2020/03/triggering-lifx-firmware-effects-with-photons-interactor/
I have some examples of using custom palettes for Morph, too.

Quick question, is it possible to apply the scenes from the LIFX App to the Beam/Z Strip/Candle/Tiles? Scenes like Ghoulish, Intense, Love, Dream, etc... I know I can apply them using the app, then make a scene from their current state using Photons, but I'm trying to find a simple way to "recreate" the randomness that comes from applying those scenes. As I'm sure you're aware, when you apply any of those standard scenes using the LIFX App, the colors are randomly applied throughout the zones of your device so you never get the exact same layout for that scene. Is there a way to recreate this using Photons?

The colours used by each theme is documented here: https://github.com/wborn/lifx-themes
You can use these palettes to splotch a theme using photons for the same effect as the app.

Yeah, those are themes rather than scenes. So using wborn's repo there you can find the colours and do a
{"command": "apply_theme", "args": {"theme_options": {"colors": ["red", "blue", "green"]}}}

Yeah, those are themes rather than scenes. So using wborn's repo there you can find the colours and do a
{"command": "apply_theme", "args": {"theme_options": {"colors": ["red", "blue", "green"]}}}

Perfect! Thank you! For some reason I can't seem to get brightness to work, I have
# LIFX Photons General Effect
lifx_photons:
  url: 'http://<IP_ADDRESS>:6100/v1/lifx/command'
  method: "put"
  payload: '{"command": "animation/start", "brightness": 0.01, "args": {"animations": "{{ states("input_select.photons_animations") }}", "matcher":{"label": "Tiles"} }}'

but regardless of what number I set it to (0.01 to 1), it's always max brightness.

apply_theme has a brightness option, you'd do
  "command": "apply_theme",
  "args": {
    "theme_options": {
      "overrides": {
        "brightness": 0.1
      },
      "colors": [
        "red",
        "blue",
        "green"
      ]
    }
  }
}

There is no one brightness override for an animation. Some animations have options that let you set that, but it's defined per animation. So for example, the dice animation has dice_color, so you could do
{
  "command": "animation/start",
  "args": {
    "animations": [
      [
        "pacman",
        {
          "num_iterations": 1
        }
      ],
      [
        "dice",
        {
          "num_seconds": 5,
          "dice_color": "0-360,1,0.5,3500"
        }
      ]
    ]
  }
}

In that one it does pacman followed by dice followed by pacman followed by dice, etc and the dice are 0.5 brightness.
Pacman has no such options. It's a bit difficult because of how I made it.

Makes sense regarding the brightness of the animations... I did get the theme brightness to work, but I'm noticing that when I apply a theme to my tiles using Photons, it looks significantly less saturated (or white washed) than the same theme from the app itself. I'm using wborn's repo to apply the hex values to the theme, and I set the saturation to 1, but it's still looking very white to me. Am I applying the saturation correctly? Or is my command wrong somewhere?
lifx_photons_theme_tiles:
  url: 'http://<IP_ADDRESS>:6100/v1/lifx/command'
  method: "put"
  payload: '{"command": "apply_theme", "args": {"theme_options": {"colors": {{ states("sensor.lifx_themes") }}, "saturation": 1.0, "kelvin":3500, "overrides": {"brightness": {{ state_attr("light.tiles", "brightness")|float / 255 | round(2) }} } }, "matcher":{"label": "Tiles"} }}'

Here are the hex values I'm applying (Independence day theme):
["hex:#ffffff", "hex:#ff0000", "hex:#0000ff"]

Yeah, photons uses a different method than the app to work out how to apply the theme and as a result is more blended.
You can play with the colours in the array to give weight to the different colours. So for example
{"colors": ["red saturation:0.5", "blue saturation:0.3", "red", "red", "blue", "blue"]}
Tries to have less white. Or
{"colors": ["red saturation:0.8", "blue saturation:0.8", "red saturation:0.2", "blue saturation:0.2"]}
tries to be more white.

Makes sense. Quick question, is there a way to not turn on the lights when sending commands to them? It seems whenever I use apply_theme or effects/start it turns on the lights when they're off. I know it's possible to set the state of LIFX devices while keeping them off, as I've been doing it in Home Assistant (I believe it uses LAN protocol too) for a year now.
I have an automation which sets the brightness and color temp of my lights to varying values throughout the day, even when they're off, so that when I do turn them on, they're already the correct brightness/color temp. I would like to extend this to themes as well, but it keeps turning on the lights.
Sorry for all the posts, but you've been an immense help.

So for apply_theme there is {"command": "apply_theme", "args": {"theme_options": {"power_on": false}}}and for effects/run there is{"command": "effects/run", "args": {"matrix_options": {"power_on": false}, "linear_options": {"power_on": false}}}`
The animations don't currently have an option for not turning on power when the animation starts.

Sorry for all the posts, but you've been an immense help.

all good :)
There's very little documentation for the specifics of the commands.

Thanks, this works, except I can't figure out where to put "power_on": false for effects/stop. When I send the effects/stop command to my lights while they're off, they still turn on too. Since there's no "linear_options", "matrix_options", or "theme_options" for effects/stop, I can't figure out where to put "power_on": false in the payload. It seems nowhere that I put it works, the lights always turn on when stopping effects. Any ideas?

ah, it seems that command doesn't have that option. I'd have to add the matrix/linear options that effects/run has. I probably won't have time to do that for a while.

No problem at all. Just thought I'd make sure there wasn't an option before creating a workaround in Home Assistant. Thanks!

@Kackerlacka with many thanks to @Djelibeybi , if you update photons interactor, it'll have matrix_options and linear_options for effects/stop now :)

The json would be:
{
    "command": "effects/stop",
    "args": {
        "stop_matrix": true,
        "matrix_options": {
             "power_on": false
        },
        "stop_linear": true,
        "linear_options": {
            "power_on": false
        }
    }
}

Wow that was fast, thanks so much for taking the time to implement that! One question, do you have to release a new version of the Home Assistant Photons add-on each time you update Photons? Because I switched over to the Photons Add-On instead of using Portainer, and I'm not sure how that works. Thanks.

Updating the addon is fairly simple. To force homeassistant to check for addon updates, click on the addon store then the 3 dots.  Under there is reload. After it has reloaded, the photons addon should show the menu to update it

Ah yep that did it. I figured it was always automatic but I suppose sometimes you have to reload it. Thanks for the help!

yeah, I told it about the new version
https://github.com/delfick/photons-homeassistant/commit/7dd675c779d627eee5349d7e4ad82506a5fc60c9
On Sun, 27 Jun 2021, 6:57 pm Kackerlacka, @.***> wrote:

Ah yep that did it. I figured it was always automatic but I suppose
sometimes you have to reload it. Thanks for the help!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/delfick/photons/issues/61#issuecomment-869126903, or
unsubscribe
https://github.com/notifications/unsubscribe-auth/AAA2V5MB4UC52I5RJOZRZS3TU3RYRANCNFSM467LHNTQ
.

So I updated my Photons Interactor to 0.8.7, but when I input the following command, it does in fact stop the animation while my Beam is off, but it turns it on in the process still. Same with my Tiles (when I use the matrix_options instead of linear_options).
![image](https://user-images.githubusercontent.com/43557714/123539643-9f1df300-d6ef-11eb-9af0-76c8d9ed8d79.png)
Is there something I did wrong in this command?

Maybe it didn't get restarted?
What does {"command": "help", "args": {"command": "effects/stop"}} show?

Oh, I see the problem
You have this
  "command": "effects/stop",
  "args": {
    "matcher": {
      "label": "label"
    }
  },
  "stop_matrix": true,
  "matrix_options": {
    "power_on": false
  },
  "stop_linear": true,
  "linear_options": {
    "power_on": false
  }
}

instead of
{
  "command": "effects/stop",
  "args": {
    "matcher": {
      "label": "label"
    },
    "stop_matrix": true,
    "matrix_options": {
      "power_on": false
    },
    "stop_linear": true,
    "linear_options": {
      "power_on": false
    }
  }
}

@delfick 's formatting doesn't make it obvious but the stop_matrix and matrix_options fields must be inside the "args": {} block, e.g.
{
  "command": "effects/stop",
  "args": {
    "matcher": {
      "label": "label"
    },
    "stop_matrix": true,
    "stop_linear": true,
    "matrix_options": {
      "power_on": false
    },
    "linear_options": {
      "power_on": false
    }
  }
}

So I changed my REST command to this, with all the arguments inside the "args" block, but it's still turning on the lights when they're off.
photons_effects_stop:
  url: 'http://<IP_ADDRESS>:6100/v1/lifx/command'
  method: "put"
  payload: '{"command": "effects/stop", "args": {"matcher": {"label": {{ label }} }, "stop_matrix": true, "matrix_options": {"power_on": false}, "stop_linear": true, "linear_options": {"power_on": false} }}'

The command {"command": "help", "args": {"command": "effects/stop"}} does show stop_linear and stop_matrix, but it does not show power_on (then again using the help command doesn't show power_on for any commands anyway)
Also it looks like stop_linear and stop_matrix default to true so I probably don't need them in there at all for what I'm doing... nevertheless just having "power_on": false doesn't seem to work.

Does {"command": "help", "args": {"command": "effects/stop"}} show matrix_options and linear_options? That's what' we're looking for. The output of an updated client should end with this:
stop_matrix: boolean (default True)
	Whether to stop any matrix animations

matrix_options: dictionary
	Any options to give when stopping to the matrix animation. For example power_on

stop_linear: boolean (default True)
	Whether to stop any linear animations

linear_options: dictionary
	Any options to give when stopping the linear animation. For example power_on

If you don't see those two options then the Photons container hasn't been upgraded properly.

I only see the following:

This is the current version of my Photons Interactor:

I wonder if it's not updating correctly. Have you done a full system restart? What does portainer show under images?

I've just tested delfick/lifx-photons-interactor-homeassistant:0.8.7 and it is returning the updated text.

I wonder if it's not updating correctly. Have you done a full system restart? What does portainer show under images?

I switched from Portainer to the Photons Interactor Add-On, and I have fully restarted Home Assistant as well as the Photons Interactor Add-On itself. I just did it again, same result. Honestly I have zero experience with any command line commands in Home Assistant so I have no idea how to run those docker commands.
One potentially interesting thing I noticed is that in the Changelog for 0.8.6, it says that help messages were added for the apply_theme option. But since I've been using the Photons Interactor Add-On, it's always given me this error:

This works for me using using Interactor 0.8.7: {"command": "help", "args": { "command": "apply_theme" }}
Can you please provide a screenshot of the Portainer config? Something weird is going on somewhere. :)

I may be wrong, but I don't think there's actually a way to run docker commands in Home Assistant (at least not using HassOS like I am). So I'm not sure what I can do to help.
I tried uninstalling Photons Add-On and reinstalling it using Portainer (as described above) but now I'm getting an error 502: Bad Gateway error with Portainer, and the Photons Add-On won't start anymore because "Errno 98: Address already in use"

Open up portainer and under the containers tab, remove all images that are called something like photons interactor. Then reinstall the addon. Hopefully that does it.

So it looks like when I uninstalled Portainer and the Photons Interactor Container (after you released the HA Add-On), somehow I guess the container didn't get uninstalled, so I had been running that the whole time without Portainer installed, thinking that it was the Add-On. That's why it was updated to 0.8.7 and still not working - it was using the Docker Image installed from Portainer.
Anyway, thank you all for being so patient. I'm happy to say that after (re-)uninstalling the Interactor and Portainer and reinstalling the Add-On, 0.8.7 is working perfectly. Thanks so much!

Hi all, scene_capture followed by scene_apply is not working for the candle: it just applies one and the same color for the whole bulb.
Is there any way i can capture->apply the individual zones ? Or any way to individually define the different zones by hand?

weird. It should work. Can you do a discover command and a scene_info command and put them in a gist so I can have a look? Maybe it doesn't think your candle is a candle for some reason.

I've done a discover and scene_info but I've never put anything in a gist, so i'll copy-paste the relevant stuff here (some identifiers are anonymised). I'm not sure if it is relevant, but i also have 4 Lifx Mini Color bulbs, one Lifx A19 and 2 Lifx Z LED Strips. These are removed from the overview below.
discover:
"d073d5xxxxxx": {
"brightness": 1.0,
"cap": [
"color",
"matrix",
"not_buttons",
"not_chain",
"not_hev",
"not_ir",
"not_multizone",
"not_relays",
"variable_color_temp"
],
"firmware_version": "3.50",
"group_id": "aaaaaaaaaaaaaaaaaa",
"group_name": "Balkon",
"hue": 0.0,
"kelvin": 3500,
"label": "Kandelaar 2",
"location_id": "bbbbbbbbbbb",
"location_name": "Thuis",
"power": "on",
"product_id": 57,
"saturation": 1.0,
"serial": "d073d5xxxxxx"
},
"d073d5yyyyyy": {
"brightness": 1.0,
"cap": [
"color",
"matrix",
"not_buttons",
"not_chain",
"not_hev",
"not_ir",
"not_multizone",
"not_relays",
"variable_color_temp"
],
"firmware_version": "3.50",
"group_id": "aaaaaaaaaaaaaaaaaa",
"group_name": "Balkon",
"hue": 19.29,
"kelvin": 3500,
"label": "Kandelaar 1",
"location_id": "bbbbbbbbbbb",
"location_name": "Thuis",
"power": "on",
"product_id": 57,
"saturation": 0.9988,
"serial": "d073d5yyyyyy"
scene_info:
{
"14c387ba-d037-404d-9bba-33fd1b1b2382": {
"meta": {
"uuid": "14c387ba-d037-404d-9bba-33fd1b1b2382"
},
"scene": [
                   {
            "color": "kelvin:3500 saturation:1.0 brightness:0.2135 hue:0.0",
            "matcher": {
                "serial": "073d5xxxxxx"
            },
            "power": true,
            "uuid": "14c387ba-d037-404d-9bba-33fd1b1b2382"
        },
        {
            "color": "kelvin:3500 saturation:1.0 brightness:0.2129 hue:3.0",
            "matcher": {
                "serial": "d073d5yyyyyy"
            },
            "power": true,
            "uuid": "14c387ba-d037-404d-9bba-33fd1b1b2382"
        }
    ]
},
"80863b36-bafc-4556-a399-4e5832f5274a": {
    "meta": {
        "uuid": "80863b36-bafc-4556-a399-4e5832f5274a"
    },
    "scene": [

        {
            "color": "kelvin:3500 saturation:1.0 brightness:0.2129 hue:3.0",
            "matcher": {
                "serial": "073d5xxxxxx"
            },
            "power": true,
            "uuid": "80863b36-bafc-4556-a399-4e5832f5274a"
        },
        {
            "color": "kelvin:3500 saturation:1.0 brightness:0.2135 hue:0.0",
            "matcher": {
                "serial": "d073d5yyyyyy"
            },
            "power": true,
            "uuid": "80863b36-bafc-4556-a399-4e5832f5274a"
        }
    ]
},
"835b0bd1-b97f-4d79-b1b0-48eadfeb0431": {
    "meta": {
        "uuid": "835b0bd1-b97f-4d79-b1b0-48eadfeb0431"
    },
    "scene": [
        {
            "color": "kelvin:3095 saturation:0.8 brightness:0.9 hue:0.0",
            "matcher": {
                "serial": "d073d5584dbd"
            },
            "power": false,
            "uuid": "835b0bd1-b97f-4d79-b1b0-48eadfeb0431"
        },
        {
            "color": "kelvin:3500 saturation:0.9258 brightness:0.5804 hue:23.57",
            "matcher": {
                "serial": "d073d5419118"
            },
            "power": true,
            "uuid": "835b0bd1-b97f-4d79-b1b0-48eadfeb0431"
        },
        {
            "color": "kelvin:5000 saturation:0.8 brightness:0.9 hue:0.0",
            "matcher": {
                "serial": "d073d55855f9"
            },
            "power": false,
            "uuid": "835b0bd1-b97f-4d79-b1b0-48eadfeb0431"
        },
        {
            "color": "kelvin:3500 saturation:0.8571 brightness:0.5804 hue:254.99",
            "matcher": {
                "serial": "d073d5584eeb"
            },
            "power": true,
            "uuid": "835b0bd1-b97f-4d79-b1b0-48eadfeb0431"
        },
        {
            "matcher": {
                "serial": "d073d54220a3"
            },
            "power": true,
            "uuid": "835b0bd1-b97f-4d79-b1b0-48eadfeb0431",
            "zones": [
                [
                    268.03,
                    0.898,
                    0.7451,
                    3500
                ],
                [
                    268.03,
                    0.898,
                    0.7451,
                    3500
                ],
                [
                    268.03,
                    0.898,
                    0.7451,
                    3500
                ],
                [
                    268.03,
                    0.898,
                    0.7451,
                    3500
                ],
                [
                    268.03,
                    0.898,
                    0.7451,
                    3500
                ],
                [
                    268.03,
                    0.898,
                    0.7451,
                    3500
                ],
                [
                    0.0,
                    0.0,
                    0.3529,
                    3500
                ],
                [
                    0.0,
                    0.0,
                    0.3529,
                    3500
                ],
                [
                    0.0,
                    0.0,
                    0.3529,
                    3500
                ],
                [
                    0.0,
                    0.0,
                    0.3529,
                    3500
                ],
                [
                    45.21,
                    0.8274,
                    0.7451,
                    3500
                ],
                [
                    45.21,
                    0.8274,
                    0.7451,
                    3500
                ],
                [
                    45.21,
                    0.8274,
                    0.7451,
                    3500
                ],
                [
                    45.21,
                    0.8274,
                    0.7451,
                    3500
                ],
                [
                    45.21,
                    0.8274,
                    0.7451,
                    3500
                ],
                [
                    45.21,
                    0.8274,
                    0.7451,
                    3500
                ]
            ]
        },
        {
            "matcher": {
                "serial": "d073d541a01d"
            },
            "power": true,
            "uuid": "835b0bd1-b97f-4d79-b1b0-48eadfeb0431",
            "zones": [
                [
                    0.0,
                    0.0,
                    0.2941,
                    4201
                ],
                [
                    0.0,
                    0.0,
                    0.2941,
                    4201
                ],
                [
                    0.0,
                    0.0,
                    0.2941,
                    4201
                ],
                [
                    0.0,
                    0.0,
                    0.2941,
                    4201
                ],
                [
                    0.0,
                    0.0,
                    0.2941,
                    4201
                ],
                [
                    240.0,
                    1.0,
                    0.2745,
                    3500
                ],
                [
                    240.0,
                    1.0,
                    0.2745,
                    3500
                ],
                [
                    240.0,
                    1.0,
                    0.2745,
                    3500
                ],
                [
                    240.0,
                    1.0,
                    0.2745,
                    3500
                ],
                [
                    240.0,
                    1.0,
                    0.2745,
                    3500
                ],
                [
                    240.0,
                    1.0,
                    0.2745,
                    3500
                ],
                [
                    0.0,
                    0.0,
                    0.2941,
                    4201
                ],
                [
                    0.0,
                    0.0,
                    0.2941,
                    4201
                ],
                [
                    0.0,
                    0.0,
                    0.2941,
                    4201
                ],
                [
                    0.0,
                    0.0,
                    0.2941,
                    4201
                ],
                [
                    0.0,
                    0.0,
                    0.2941,
                    4201
                ],
                [
                    240.0,
                    1.0,
                    0.2745,
                    3500
                ],
                [
                    240.0,
                    1.0,
                    0.2745,
                    3500
                ],
                [
                    240.0,
                    1.0,
                    0.2745,
                    3500
                ],
                [
                    240.0,
                    1.0,
                    0.2745,
                    3500
                ]
            ]
        },
        {
            "color": "kelvin:3500 saturation:0.7143 brightness:0.5412 hue:44.99",
            "matcher": {
                "serial": "d073d55829ee"
            },
            "power": true,
            "uuid": "835b0bd1-b97f-4d79-b1b0-48eadfeb0431"
        },
        {
            "color": "kelvin:3500 saturation:1.0 brightness:0.2129 hue:3.0",
            "matcher": {
                "serial": "d073d5595f43"
            },
            "power": true,
            "uuid": "835b0bd1-b97f-4d79-b1b0-48eadfeb0431"
        },
        {
            "color": "kelvin:3500 saturation:1.0 brightness:0.2135 hue:0.0",
            "matcher": {
                "serial": "d073d55962c7"
            },
            "power": true,
            "uuid": "835b0bd1-b97f-4d79-b1b0-48eadfeb0431"
        }
    ]
}

Hi all, scene_capture followed by scene_apply is not working for the candle: it just applies one and the same color for the whole bulb.
Is there any way i can capture->apply the individual zones ? Or any way to individually define the different zones by hand?

By  the way, i've solved this in a different way:

Set the desired scene via the Lifx Android app

Run the following command to retrieve the matrix settings: ```
curl -XPUT http://your_ip_address:6100/v1/lifx/command
-HContent-Type:application/json
-d '{
"command": "query",
"args": {
"matcher": {
"cap": "matrix"
},
"pkt_type": "Get64",
"pkt_args": {
"length": 1,
"tile_index": 0,
"width": 5,
"x": 0,
"y": 0
}
}
}'

3. copy the output and execute the below command (replace the matrix values with the output from step 2: ```
curl -XPUT http://your_ip_address:6100/v1/lifx/command \
  -HContent-Type:application/json \
  -d '{
  "command": "set",
  "args": {
    "matcher": {
      "serial":"d073d55962c7"
    },
    "pkt_type": "Set64",
    "pkt_args": {
      "length": 1,
      "tile_index": 0,
      "width": 5,
      "colors_count": 2,
      "x": 0,
      "y": 0,
      "duration": 2,
      "colors": [
                    {
                        "brightness": 0.2135,
                        "hue": 0.0,
                        "kelvin": 3500,
                        "saturation": 1.0
                    },
                    {
                        "brightness": 0.2135,
                        "hue": 0.0,
                        "kelvin": 3500,
                        "saturation": 1.0
                    },
                    {
                        "brightness": 0.2135,
                        "hue": 121.0,
                        "kelvin": 3500,
                        "saturation": 1.0
                    },
                    {
                        "brightness": 0.2135,
                        "hue": 121.0,
                        "kelvin": 3500,
                        "saturation": 1.0
                    },
                    {
                        "brightness": 0.2135,
                        "hue": 121.0,
                        "kelvin": 3500,
                        "saturation": 1.0
                    },
                    {
                        "brightness": 0.2135,
                        "hue": 0.0,
                        "kelvin": 3500,
                        "saturation": 1.0
                    },
                    {
                        "brightness": 0.2135,
                        "hue": 0.0,
                        "kelvin": 3500,
                        "saturation": 1.0
                    },
                    {
                        "brightness": 0.2135,
                        "hue": 0.0,
                        "kelvin": 3500,
                        "saturation": 1.0
                    },
                    {
                        "brightness": 0.2135,
                        "hue": 0.0,
                        "kelvin": 3500,
                        "saturation": 1.0
                    },
                    {
                        "brightness": 0.2135,
                        "hue": 0.0,
                        "kelvin": 3500,
                        "saturation": 1.0
                    },
                    {
                        "brightness": 0.2135,
                        "hue": 0.0,
                        "kelvin": 3500,
                        "saturation": 1.0
                    },
                    {
                        "brightness": 0.2135,
                        "hue": 0.0,
                        "kelvin": 3500,
                        "saturation": 1.0
                    },
                    {
                        "brightness": 0.2135,
                        "hue": 0.0,
                        "kelvin": 3500,
                        "saturation": 1.0
                    },
                    {
                        "brightness": 0.2135,
                        "hue": 0.0,
                        "kelvin": 3500,
                        "saturation": 1.0
                    },
                    {
                        "brightness": 0.2135,
                        "hue": 0.0,
                        "kelvin": 3500,
                        "saturation": 1.0
                    },
                    {
                        "brightness": 0.2135,
                        "hue": 270.0,
                        "kelvin": 3500,
                        "saturation": 1.0
                    },
                    {
                        "brightness": 0.2135,
                        "hue": 270.0,
                        "kelvin": 3500,
                        "saturation": 1.0
                    },
                    {
                        "brightness": 0.2135,
                        "hue": 238.0,
                        "kelvin": 3500,
                        "saturation": 1.0
                    },
                    {
                        "brightness": 0.2135,
                        "hue": 238.0,
                        "kelvin": 3500,
                        "saturation": 1.0
                    },
                    {
                        "brightness": 0.2135,
                        "hue": 238.0,
                        "kelvin": 3500,
                        "saturation": 1.0
                    },
                    {
                        "brightness": 0.2135,
                        "hue": 270.0,
                        "kelvin": 3500,
                        "saturation": 1.0
                    },
                    {
                        "brightness": 0.2135,
                        "hue": 270.0,
                        "kelvin": 3500,
                        "saturation": 1.0
                    },
                    {
                        "brightness": 0.2135,
                        "hue": 238.0,
                        "kelvin": 3500,
                        "saturation": 1.0
                    },
                    {
                        "brightness": 0.2135,
                        "hue": 238.0,
                        "kelvin": 3500,
                        "saturation": 1.0
                    },
                    {
                        "brightness": 0.2135,
                        "hue": 238.0,
                        "kelvin": 3500,
                        "saturation": 1.0
                    }
      ]
    }
  }
}'

Three things that i noticed:

according to the online lan documentation of lifx, the duration should be set in miliseconds, but via Photons this is in seconds.
according to the online lan documentation of lifx, the hue should be given in the uint16 (0-65535) format, but Photons seems to do this in a value between 0 and 360
according to the online lan documentation of lifx, the Candle matrix values 1,2,3 and 4 are not used. Via Photons however, i have to provide a real in matrix slot 1,2,3 and 4 (if i set brightness to 0 for these slots, the Candle becomes dimmer). I'm not sure how Photons handles the matrix exactly? I've defined "width"=5 (the correct value for the Lifx Candle).

yeah, a Set64 will definitely do it. Strange that scene_capture isn't recording that. It does have the matrix capability. I'll have a look when I'm back up and running.
For the hsbk and duration, that's because Photons performs transformations: https://github.com/delfick/photons/blob/main/modules/photons_messages/fields.py#L29-L47

Hi Delfick, i've waited for the outcome of your research, once you are/were up&running again. I see that you just closed in the incident. Could you explain your line of thinking?

ah yes, the candle, I'll look at that now and move that into a new issue

Not trying to revive this thread or anything but I wanted to try out setting individual LEDs on my Tiles using this command, but whenever I try it I just get this back in the console and nothing changes on my tiles, any advice?
# curl -XPUT http://<IP_ADDRESS>:6100/v1/lifx/command -HContent-Type:application/js
on -d '{"command": "set", "args": {"matcher": {"cap": "Tiles2"}, "pkt_type": "Se
t64", "pkt_args": {"length": 2, "tile_index": 0, "width": 8, "colors_count": 1,
"x": 5, "y": 0, "color": {"hue": 400, "brightness": 1, "saturation": 1, "kelvin"
: 3500} }}}'

I don't have any tiles setup to test with and they're a pain to bring out from where they are, but I believe the problem is you need to send colors instead of color in that message and make sure colors_count is set to the number of colours you want.
Also, for sending the packet type itself, you do need to give them as hsbk dictionaries. We'd need to add a command for setting pixels that knows how to convert friendlier names into those hsbk dictionaries

I don't have any tiles setup to test with and they're a pain to bring out from where they are, but I believe the problem is you need to send colors instead of color in that message and make sure colors_count is set to the number of colours you want.
Also, for sending the packet type itself, you do need to give them as hsbk dictionaries. We'd need to add a command for setting pixels that knows how to convert friendlier names into those hsbk dictionaries

HSBK dictionaries is ok, I can deal with that. As for the color vs colors.... I guess I'm not understanding what this command does. I'm trying to have this command set the color of 1 single LED, but it looks like if I set colors to HSBK values it makes 2 LEDs that color, and 3 makes 3 LEDs that color, etc. But if I put one HSBK value and change colors to color it returns ok but doesn't seem to do anything. If I send 1 HSBK value with colors instead of color it give me an error

the Set64 takes in colors as a list of dictionaries. so when you don't
specify it photons is defaulting to an empty list
there is no color on a Set64 and so photons is ignoring your provided color
option
I missed before it seems this message in the lifx protocol doesn't have a
colors_count. It will set all 64 pixels. So colors_count is also being
ignored and photons will default to hsbk:0,0,0,0 for the pixels you don't
define.
So basically to change only one pixel you have to know all current pixels
and send them all again but with that one different pixel
the full docs for Set64 are over here:
https://lan.developer.lifx.com/docs/changing-a-device#set64---packet-715
On Mon, 14 Feb 2022, 8:03 pm Kackerlacka, @.***> wrote:

I don't have any tiles setup to test with and they're a pain to bring out
from where they are, but I believe the problem is you need to send colors
instead of color in that message
https://photons.delfick.com/interacting/packets.html?highlight=set64#tilemessages-set64
and make sure colors_count is set to the number of colours you want.
Also, for sending the packet type itself, you do need to give them as hsbk
dictionaries. We'd need to add a command for setting pixels that knows how
to convert friendlier names into those hsbk dictionaries
HSBK dictionaries is ok, I can deal with that. As for the color vs colors....
I guess I'm not understanding what this command does. I'm trying to have
this command set the color of 1 single LED, but it looks like if I set
colors to HSBK values it makes 2 LEDs that color, and 3 makes 3 LEDs that
color, etc. But if I put one HSBK value and change colors to color it
returns ok but doesn't seem to do anything. If I send 1 HSBK value with
colors instead of color it give me an error
—
Reply to this email directly, view it on GitHub
https://github.com/delfick/photons/issues/61#issuecomment-1038824843,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAA2V5L7Q3EMQDBCS6JV5ZDU3DAOTANCNFSM467LHNTQ
.
Triage notifications on the go with GitHub Mobile for iOS
https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675
or Android
https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you modified the open/close state.Message
ID: @.***>


chore: release main

:robot: I have created a release beep boop
@dotcom-reliability-kit/crash-handler: 3.0.7
Dependencies

The following workspace dependencies were updated

dependencies

@dotcom-reliability-kit/log-error bumped from ^3.1.4 to ^3.1.5

@dotcom-reliability-kit/log-error: 3.1.5
Dependencies

The following workspace dependencies were updated

dependencies

@dotcom-reliability-kit/logger bumped from ^2.3.1 to ^2.4.0

logger: 2.4.0
2.4.0 (2023-11-23)
Features

add useIsoTimeFormat option to format log timestamps (d22e24a)

@dotcom-reliability-kit/middleware-log-errors: 3.0.7
Dependencies

The following workspace dependencies were updated

dependencies

@dotcom-reliability-kit/log-error bumped from ^3.1.4 to ^3.1.5

@dotcom-reliability-kit/middleware-render-error-info: 4.0.2
Dependencies

The following workspace dependencies were updated

dependencies

@dotcom-reliability-kit/log-error bumped from ^3.1.4 to ^3.1.5

This PR was generated with Release Please. See documentation.

:robot: Release is at https://github.com/Financial-Times/dotcom-reliability-kit/releases/tag/crash-handler-v3.0.7 :sunflower:

:robot: Release is at https://github.com/Financial-Times/dotcom-reliability-kit/releases/tag/log-error-v3.1.5 :sunflower:

:robot: Release is at https://github.com/Financial-Times/dotcom-reliability-kit/releases/tag/logger-v2.4.0 :sunflower:

:robot: Release is at https://github.com/Financial-Times/dotcom-reliability-kit/releases/tag/middleware-log-errors-v3.0.7 :sunflower:

:robot: Release is at https://github.com/Financial-Times/dotcom-reliability-kit/releases/tag/middleware-render-error-info-v4.0.2 :sunflower:


Yemen Project - Task 3232 - source correction

view-source: http://geotagx.org/project/yemenculture/task/3232
The above link goes to page 1 of 26 pages where the image is not listed. The image appears on Page 4. So the link could be either
http://tinyurl.com/ofveu4r
Or the link could be to image at
The source should be http://tinyurl.com/ofveu4r

@tagapic thanks, im not sure if we can fix this because it is automated but I will check with the developer

Thanks, when the source of the image is to a page which contains as many as 64 photos, it is difficult to locate it. For photos in this RGS group, all of the URLs in the task list point to a page of the group (it has 1 of 7 or 1 of 64, but does not point to a specific image url ending with a jpg/jpeg.

@elliec
The source given for this rgs photo is http://images.rgs.org/search.aspx?view=&search_ctl%3Akeyword=yemen&search_ctl%3Aimage_type_list=0&search_ctl%3Acollection_list=-1&search_ctl%3AimageSubmit.x=0&search_ctl%3AimageSubmit.y=0&search_ctl%3Adate_range_list=0&search_ctl%3AregionEvent=0&search_ctl%3AdropdownThemes=0&search_ctl%3AsearchPhotographOrPersonShown%3A0=on&search_ctl%3AsearchPhotographOrPersonShown%3A1=on&search_ctl%3Arefine_keyword_field=&isAdvancedSearchDisplay=&search_ctl%3Acollection_choosed=&search_ctl%3AisButtongotoPressed=no
However, the image after some time spent in searching is on page 4 (with each page of 64 images to check before proceeding to the next) and the image url is
http://geotagx.org/project/yemenculture/task/3420.
It would be helpful to have the the link pointing to either the correct page or to the specific source.
http://images.rgs.org/imageDetails.aspx?barcode=28847

@elliec
Task 3424. The source link takes you to page 1. The Image is on page 5. http://images.rgs.org/search.aspx?view=&search_ctl%3Akeyword=yemen&search_ctl%3Aimage_type_list=0&search_ctl%3Acollection_list=-1&search_ctl%3AimageSubmit.x=0&search_ctl%3AimageSubmit.y=0&search_ctl%3Adate_range_list=0&search_ctl%3AregionEvent=0&search_ctl%3AdropdownThemes=0&search_ctl%3AsearchPhotographOrPersonShown%3A0=on&search_ctl%3AsearchPhotographOrPersonShown%3A1=on&search_ctl%3Arefine_keyword_field=&isAdvancedSearchDisplay=&search_ctl%3Acollection_choosed=&search_ctl%3AisButtongotoPressed=no

Task 3426. Image 224. The source link takes you to page 1. Search shows image on Page 3. (Image S0012246).

Task 3430, Image 226. This image after a tedious and time consuming effort is on Page 5 of the RGS photo collection. (Image S0019373).

@spMohanty maybe this is an issue with how the extension is collecting the source? do you know if it is possible to make it get the exact page on which the image is in search results like this?

Closing this - action issue here https://github.com/geotagx/geotagx-chrome-sourcerer/issues/4


Make it compatible with AGP 8 (v1.0.0)

Clone of #73, but on the next branch.

Can someone please look at this and merge it?


imu data hangs on Raspberry pi 4B

Required Info

Camera Model
D455

Firmware Version
<IP_ADDRESS>

Operating System & Version
Linux raspberrypi 5.10.103-v8+ aarch64 GNU/Linux

Kernel Version (Linux Only)
5.10.103

Platform
Raspberry Pi

SDK Version
2.50.0

Language
python

Segment

Issue Description
Hi Marty @MartyG-RealSense,
I have the same problem as (https://github.com/IntelRealSense/librealsense/issues/7391) and https://github.com/IntelRealSense/librealsense/issues/7979 IMU data hangs on after a couple of minutes even though I have only one pipeline to gather IMU data.
Both of the issues actually did not fix the problem, I would like to enquire about any solutions for this.
Also, I have another problem with setting the acceleration and acceleration frequency.
config.enable_stream(rs.stream.accel, rs.format.motion_xyz32f, 63)
config.enable_stream(rs.stream.gyro, rs.format.motion_xyz32f, 200)
pipeline.start(config)
I got RuntimeError: Couldn't resolve requests with pipeline.start(config), BUT, it works when I deleted the frequency as
config.enable_stream(rs.stream.accel, rs.format.motion_xyz32f)
config.enable_stream(rs.stream.gyro, rs.format.motion_xyz32f)
pipeline.start(config)
Could you please provide some solutions?

Hi @Yoki-pjx  Your accel and gyro frequency problem is unusual, as your frequency values for each are correct.  Couldn't resolve requests means that the requested configuration could not be provided, either because of a typing mistake in the instruction or because the requested configuration was not supported by the camera at the time that it was requested.  Neither of those possibilities seems to apply here.
63 accel and 200 gyro should be the default values applied by an IMU-equipped 400 Series camera anyway though when custom values are not defined, so leaving out the frequencies should be fine in this particular case.

In regard to the hanging of the program after a couple of minutes, may I ask which method you used to install the RealSense SDK on your Pi 4, please?  Kernel 5.10 is not officially supported by the SDK and whilst unsupported kernels can work, there may be unpredictable consequences in regards to stability.  I would therefore recommend installing the SDK using the RSUSB backend method if you have not done so already.  This method bypasses the Linux kernel and so is not dependent on Linux versions or kernel versions and does not require patching.
You could also try increasing the size of the swapfile on your Pi so that it has more 'virtual memory' to use when its real memory is used up.
https://pimylifeup.com/raspberry-pi-swap-file/

Hi @MartyG-RealSense,
I have tried reinstalling the SDK by the RSUSB backend method as https://github.com/IntelRealSense/librealsense/issues/6940#issuecomment-665713929. However, it doesn't work. Both issues still exist. I got 'RuntimeError: Frame didn't arrive within 5000' after a couple of minutes and 'RuntimeError: Couldn't resolve requests with pipeline.start(config)' with python.
Just double check with you showing how I installed by the RSUSB backend method below:

Go to the librealsense root directory
mkdir build && cd build
run the code
'cmake ../ -DFORCE_RSUSB_BACKEND=true -DCMAKE_BUILD_TYPE=release -DBUILD_EXAMPLES=true -DBUILD_GRAPHICAL_EXAMPLES=true'
'sudo make uninstall && make clean && make && sudo make install'
'sudo ./scripts/setup_udev_rules.sh'
install pyrealsense2
'cd ~/librealsense/build'
'cmake .. -DBUILD_PYTHON_BINDINGS=bool:true -DPYTHON_EXECUTABLE=$(which python3) -DFORCE_RSUSB_BACKEND=true'
'make -j1'
'sudo make install'
add python path
'nano ~/.zshrc
export PYTHONPATH=$PYTHONPATH:/usr/local/lib'
'source ~/.zshrc'
'sudo reboot'

I tried to increase the size of the swapfile to 2048 as well.

I think I find the problem for the low frequency seeting of the imu. It seems the accel only support 100/200 rather than 63 as the selection in realsense-viewer.

However, the hanging problem of the program after a couple of minutes still exists.

Thanks very much for the updates.  Your RSUSB installation looks fine to me.
It is unusual that your Viewer is showing the supported IMU frequencies as 100 / 200, as those modes are usually provided on the L515 camera model which also has an IMU.  The camera is clearly detected by the Viewer as a D455 model though.
From my own cameras:
D455

L515

In regard to the error RuntimeError: Frame didn't arrive within 5000', this indicates that new frames have not been received from the camera for a period of 5 seconds and so the program has 'timed out', generating the error.
Does it still occur in the Viewer if you disable the Global Time Enabled option?  Global Time is enabled by default on 400 Series cameras, so would likely be active on your Python script too.

Do you have any idea why I have 100/200 frequency for my accel? I have also double-checked on my Windows 10 desktop. It also shows 100/200 in the realsense viewer.
BTW, I am using v2.51.1 SDK now.

I have tried without the Global Time Enabled option in the viewer, but the problem seems still occur.

I will consult with my Intel RealSense colleagues about your IMU settings on D455.  Thanks very much for your patience!

Okay, thank you Marty.
I have tried without the Global Time Enabled option in the viewer. The problem seems still occur but seems it happens later. What's the code to disable the Global Time Enabled option in python? I also would like to have a try in python.

An example of Python code for disabling Global Time is at https://github.com/IntelRealSense/librealsense/issues/9172#issuecomment-855723153

Thanks Marty.
I'm looking forward to your reply regarding the hang on problem and frequency setting.
Have a nice weekend.

I checked the 400 Series data sheet.  The D455 model originally had the BMI055 IMU component but later models changed to the BMI085 IMU which has 100/200 frequencies.  So your D455 hardware seems to be okay and it is likely either a software problem or an issue with using accel / gyro on Pi 4..

I have tried to disable the Global Time Enabled in python, but it still got a hanging-on problem.
I also tried to use imu_frames = imu_pipeline.poll_for_frames() instead of imu_frames = imu_pipeline.wait_for_freams().
There is no frame arriving at variable imu_frames when the imu_frames hangs on. It is the same problem of Frame didn't arrive within 5000.
The result of print(imu_frames) is <pyrealsense2.frame NULL> rather than <pyrealsense2.frameset MOTION_XYZ32F MOTION_XYZ32F #11 @194751.329000>
So I am thinking why the imu_frames is NULL here?

I checked the data sheet document for the 400 Series cameras.
https://dev.intelrealsense.com/docs/intel-realsense-d400-series-product-family-datasheet
The D455 model was originally equipped with the BMI055 IMU component with 63/250 frequencies but it later changed to the BMI085 IMU component which supports 100/200 frequencies. So your D455 hardware is okay and the time-out issue is likely due to either a software-related problem or with using accel / gyro on Pi 4.

The frequency problem makes sense to me now. Thanks Marty.

Does your Python IMU script assign fixed index numbers to accel and gyro, such as 0 for accel and 1 for gyro?  For example:
accel=accel_data(frames[0].as_motion_frame().get_motion_data())
gyro= gyro_data(frames[1].as_motion_frame().get_motion_data())

If it does assign fixed index numbers to accel and gyro then it is recommended that the streams are assigned dynamically - as described by a RealSense team member at https://github.com/IntelRealSense/librealsense/issues/4018#issuecomment-493919822 - otherwise the output of the streams can become reversed so that accel values are output for gyro and gyro values are output for accel.

No, they are dynamically assigned as following codes:
accel_frame = imu_frames.first_or_default(rs.stream.accel, rs.format.motion_xyz32f)
gyro_frame = imu_frames.first_or_default(rs.stream.gyro, rs.format.motion_xyz32f)
accel_sample = accel_frame.as_motion_frame().get_motion_data()
gyro_sample = gyro_frame.as_motion_frame().get_motion_data()

poll_for_frames() could in itself contribute to performance problems, as it is recommended to manually control when the CPU is put to sleep and for how long when using this instruction.  Otherwise, the CPU percentage utilization may rise towards 100% as described at https://github.com/IntelRealSense/librealsense/issues/2422#issuecomment-423254709
This link also describes how using try_wait_for_frames() causes a 'false' state to be returned and the program being allowed to continue to run if a timeout occurs instead of a program-exiting error being generated.
Does the problem still occur if you use 200 accel and 400 gyro instead of 100 / 200?

When I invoke try_wait_for_frames() like following codes:

While True:
if enable_imu:
imu_frames = imu_pipeline.try_wait_for_frames()
print(imu_frames)

if enable_imu and imu_frames:
accel_frame = imu_frames.first_or_default(rs.stream.accel, rs.format.motion_xyz32f)
gyro_frame = imu_frames.first_or_default(rs.stream.gyro, rs.format.motion_xyz32f)
accel_sample = accel_frame.as_motion_frame().get_motion_data()
gyro_sample = gyro_frame.as_motion_frame().get_motion_data()
print("\tAccel = ", accel_sample.x, ",",  accel_sample.y, ",", accel_sample.z)
print("\tGyro = ", gyro_sample.x, ",",  gyro_sample.y, ",", gyro_sample.z)

I got error AttributeError: 'tuple' object has no attribute 'first_or_default'

I tried the combination of 200 accel and 400 gyro, 200 / 200, 100 / 400. The problem always occurs.

I am not sure the meaning of > manually control when the CPU is put to sleep here. Do you mean add a time,sleep(0.1) after poll_for_frames()?

https://github.com/IntelRealSense/librealsense/issues/9800#issuecomment-931524794 has an example of using poll_for_frames() and time.sleep.
In the header of the script beneath 'import pyrealsense2 as rs', include the instruction import time

The time.sleep() doesn't work for me. It still occurs the problem.
Do you have any example for using try_wait_for_frames() as I got the error in my previous attempt?

Hi @MartyG-RealSense,
I am also considering whether I can count the number of null frames, stop the pipeline, and start it again. Is there any function like restarting the pipeline?

Hi @Yoki-pjx  My apologies for the delay in responding further.  The pipeline can be restarted using the hardware_reset() instruction, and its activation can be made conditional on a certain condition being satisfied (for example: If null frame count is greater than a certain value then reset).
A Python example of hardware_reset() for a single camera is below.
import pyrealsense2 as rs2
ctx = rs.context()
devices = ctx.query_devices()
for dev in devices:
dev.hardware_reset()

Here is another example that resets a camera with a particular serial number.
import pyrealsense2 as rs2
ctx = rs2.context()
list = ctx.query_devices()
for dev in list:
serial = dev.query_sensors()[0].get_info(rs2.camera_info.serial_number)
# compare to desired SN
dev.hardware_reset()

Hi @MartyG-RealSense,
I made a variable to count all the NULL frames during the period. When the variable is over 50, I stop the pipeline, then reset the camera, and restart the pipelines, But I got the error after several minutes: libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/002/008: Too many open files
The codes are like follow:
imu_error_count = 0
While True:
        if enable_rgb or enable_depth:
            frames = pipeline.wait_for_frames()

        if enable_imu:
            imu_frames = imu_pipeline.poll_for_frames()
......
        if  not imu_frames:
            imu_error_count += 1
            if imu_error_count > 50:
                imu_pipeline.stop()
                pipeline.stop()
                for dev in devices:
                    dev.hardware_reset()
                imu_pipeline.start(imu_config)
                pipeline.start(config)
                imu_error_count = 0

Does it mean the pipeline creates a new USB connection to the Pi each time?

Hi @MartyG-RealSense,
I made a variable to count all the NULL frames during the period. When the variable is over 50, I stop the pipeline, then reset the camera, and restart the pipelines, But I got the error after several minutes: libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/002/008: Too many open files
The codes are like follow:
imu_error_count = 0
While True:
if enable_rgb or enable_depth:
frames = pipeline.wait_for_frames()
    if enable_imu:
        imu_frames = imu_pipeline.poll_for_frames()

......
if  not imu_frames:
imu_error_count += 1
if imu_error_count > 50:
imu_pipeline.stop()
pipeline.stop()
for dev in devices:
dev.hardware_reset()
imu_pipeline.start(imu_config)
pipeline.start(config)
imu_error_count = 0
Does it mean the pipeline creates a new USB connection to the Pi each time?

In general, when a hardware reset occurs the camera disconnects and then reconnects, which takes 2-3 seconds.  If the reconnection occurs within 5 seconds of the disconnect then the current pipeline should remain open and continue from the point that it left off.  So you should not need a pipeline start instruction after dev.hardware_reset()

Is there any way to avoid the 2-3 seconds reconnection? Because the system only withstands 1-second reconnection.

I'm a bit broken up about this device. hardware_reset() without pipeline.stop and pipeline.start does not work in the system as well.
I also install Ubuntu 20.04.5 LTS (Kernel version 5.4) from the Raspberry official imager on my Pi today. It still occurs the error that does not receive frames in the realsense-viewer. Does it means there is compatibility problem with Pi and the camera?
I also found it works (no error) with the action of stop and start the imu pipeline when I only open the imu pipeline. When two pipelines are working, the error libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/002/008: Too many open files occurs when I restart the imu pipeline. I think I should go in this direction to fix the problem..

The librealsense SDK can be installed for Ubuntu on Raspberry Pi but there can sometimes be complications compared to installing on a PC.  The link below has an example of a guide for installing on Pi 4 and Ubuntu 20.04.
https://ramith.fyi/setting-up-raspberry-pi-4-with-ubuntu-20-04-ros-intel-realsense/
A RealSense user shared at the link below the method that worked for them with 20.04.
https://answers.ros.org/question/363889/intel-realsens-on-ubuntu-2004-ros-noetic-installation-desription/
Another guide:
https://admantium.medium.com/rgb-depth-camera-in-robotics-starting-with-the-realsense-r435-sdk-6f6c5bf3e5e4

Yet another approach is to install on the Raspbian / Raspberry Pi OS instead of Ubuntu, like in the official Intel guide here:
https://github.com/IntelRealSense/librealsense/blob/master/doc/installation_raspbian.md

I would add that Intel provide a pre-made Pi 4 SD card image at the link below, though the librealsense version in the image is older than the current version.
https://dev.intelrealsense.com/docs/open-source-ethernet-networking-for-intel-realsense-depth-cameras#23-preparing-the-sd-card

I installed the SDK by the LibUVC backend or the RSUSB backend method in Ubuntu 20.04. The RGB and depth streams work, and the imu still has problem as I mentioned in the last comment. So I am thinking does it means there is a compatibility problem between Pi and the camera?
I also found it works (no error) with the action of stop and start the imu pipeline when I only open the imu pipeline. When two pipelines are working, the error libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/002/008: Too many open files occurs when I restart the imu pipeline. I think I should go in this direction to fix the problem..Why it works when I stop and start the imu pipeline?

In regard to opening one pipeline or two pipelines, it sounds as though you are referring to the different types of streams, and all of the streams are opened in the same pipeline.  When three types of streams are enabled in the same pipeline, it can cause one of the stream types to stop receiving frames.
A workaround for this in Python is to actually create two separate pipelines, with the depth and color streams placed on one pipeline and the IMU placed alone on the other pipeline.  A Python example script for doing so is at https://github.com/IntelRealSense/librealsense/issues/5628#issuecomment-575943238

I apologise if I make you unclear. I list my codes here:
import pyrealsense2.pyrealsense2 as rs
import numpy as np
import cv2
import time
import pandas as pd
import os

# Enable components
device_id = None
enable_imu = True
enable_rgb = True
enable_depth = True

# Define image size
width = 424
height = 240
fps = 30

# Configure imu
if enable_imu:
    imu_pipeline = rs.pipeline()
    imu_config = rs.config()

    # if we are provided with a specific device, then enable it
    if None != device_id:
        imu_config.enable_device(device_id)

    # Configure streams
    imu_config.enable_stream(rs.stream.accel, rs.format.motion_xyz32f, 100) # acceleration
    imu_config.enable_stream(rs.stream.gyro, rs.format.motion_xyz32f, 200)  # gyroscope
    # Start imu streaming
    imu_profile = imu_pipeline.start(imu_config)
    # Disable global time enabled
    options = imu_profile.get_device().first_depth_sensor()
    time_option = options.set_option(rs.option.global_time_enabled,0)

# Configure image
if enable_depth or enable_rgb:
    pipeline = rs.pipeline()
    config = rs.config()

    if enable_depth:
        config.enable_stream(rs.stream.depth, width, height, rs.format.z16, fps)  # depth
        config.enable_stream(rs.stream.infrared, 1, width, height, rs.format.y8, fps)
        config.enable_stream(rs.stream.infrared, 2, width, height, rs.format.y8, fps)

    if enable_rgb:
        config.enable_stream(rs.stream.color, width, height, rs.format.bgr8, 60)  # rgb

    # Start img streaming
    profile = pipeline.start(config)

    # Getting the depth sensor's depth scale (see rs-align example for explanation)
    if enable_depth:
        depth_sensor = profile.get_device().first_depth_sensor()
        depth_scale = depth_sensor.get_depth_scale()
        print("Depth Scale is: ", depth_scale)
        if enable_depth:
            # Create an align object
            # rs.align allows us to perform alignment of depth frames to others frames
            # The "align_to" is the stream type to which we plan to align depth frames.
            align_to = rs.stream.color
            align = rs.align(align_to)

imu_error_count = 0

try:
while True:

    # get the frames
    if enable_rgb or enable_depth:
        frames = pipeline.wait_for_frames()

    if enable_imu:
        imu_frames = imu_pipeline.poll_for_frames()
        print(imu_frames)

    if enable_rgb or enable_depth:
        # Align the depth frame to color frame
        aligned_frames = align.process(frames) if enable_depth and enable_rgb else None
        depth_frame = aligned_frames.get_depth_frame() if aligned_frames is not None else frames.get_depth_frame()
        color_frame = aligned_frames.get_color_frame() if aligned_frames is not None else frames.get_color_frame()
        left_frame  = aligned_frames.get_infrared_frame(1)
        right_frame = aligned_frames.get_infrared_frame(2)

        # Convert images to numpy arrays
        depth_image = np.asanyarray(depth_frame.get_data()) if enable_depth else None
        color_image = np.asanyarray(color_frame.get_data()) if enable_rgb else None
        left_image  = np.asanyarray(left_frame.get_data())
        right_image = np.asanyarray(right_frame.get_data())

        # Apply colormap on depth image (image must be converted to 8-bit per pixel first)
        depth_colormap = cv2.applyColorMap(cv2.convertScaleAbs(depth_image, alpha=0.03), cv2.COLORMAP_JET) if enable_depth else None

        # Stack both images horizontally
        images = None
        if enable_rgb:
            images = np.hstack((color_image, depth_colormap)) if enable_depth else color_image
        elif enable_depth:
            images = depth_colormap
            infrared_images = np.hstack((left_image, right_image))

        # Show images
        cv2.namedWindow('RealSense', cv2.WINDOW_AUTOSIZE)
        if images is not None:
            cv2.imshow('RealSense', images)
            cv2.imshow('Infrared image', infrared_images)

    if enable_imu and imu_frames:
        accel_frame = imu_frames.first_or_default(rs.stream.accel, rs.format.motion_xyz32f)
        gyro_frame = imu_frames.first_or_default(rs.stream.gyro, rs.format.motion_xyz32f)
        accel_sample = accel_frame.as_motion_frame().get_motion_data()
        gyro_sample = gyro_frame.as_motion_frame().get_motion_data()

    if not imu_frames:
        imu_error_count += 1
        if imu_error_count > 100:
            imu_pipeline.stop()
            time.sleep(0.1)
            imu_pipeline.start(imu_config)
            imu_error_count = 0

    print("\tAccel = ", accel_sample.x, ",", accel_sample.y, ",", accel_sample.z)
    print("\tGyro  = ", gyro_sample.x, ",", gyro_sample.y, ",", gyro_sample.z)

    # Press esc or 'q' to close the image window
    key = cv2.waitKey(1)
    if key & 0xFF == ord('q') or key == 27:
        cv2.destroyAllWindows()
        break

finally:
    imu_pipeline.stop()
    pipeline.stop()

This one above occurs the error ((libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/002/008: Too many open files) after a couple of minutes)
import pyrealsense2.pyrealsense2 as rs
import numpy as np
import time
import pandas as pd
import os

# Enable components
enable_imu = True

# Define image size
fps = 30

# Configure depth and color streams
pipeline_imu = rs.pipeline()
config_imu = rs.config()

# Configure depth and color streams
config_imu.enable_stream(rs.stream.accel, rs.format.motion_xyz32f, 100)  # Acceleration
config_imu.enable_stream(rs.stream.gyro,  rs.format.motion_xyz32f, 400)  # Gyroscope

# Disable global time enabled
profile = pipeline_imu.start(config_imu)
options = profile.get_device().first_depth_sensor()
options.set_option(rs.option.global_time_enabled,0)

imu_error_count = 0

try:
    while True:
        # get the frames
        frames_imu = pipeline_imu.wait_for_frames()
        print(frames_imu)

        if frames_imu:
            accel_frame = frames_imu.first_or_default(rs.stream.accel)
            gyro_frame  = frames_imu.first_or_default(rs.stream.gyro)
            accel_sample = accel_frame.as_motion_frame().get_motion_data()
            gyro_sample = gyro_frame.as_motion_frame().get_motion_data()

        if not frames_imu:
            imu_error_count += 1
            if imu_error_count > 100:
                pipeline_imu.stop()
                time.sleep(0.2)
                pipeline_imu.start(config)
                imu_error_count = 0

        print("\tAccel = ", accel_sample.x, ",", accel_sample.y, ",", accel_sample.z)
        print("\tGyro  = ", gyro_sample.x, ",", gyro_sample.y, ",", gyro_sample.z)

finally:
    imu_pipeline.stop()

This one works without any errors, but I cannot use the image stream.
I think I should go in this direction to fix the problem..
How can I avoid the error (libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/002/008: Too many open files) make the first code work?

I have not seen that 'Too many files' error before with RealSense and so do not have advice to offer about it unfortunately, though it does also occur with non-RealSense cases, as shown by googling for the term raspberry pi too many open files
In the second script that does work but does not provide data, does it work if you simplify the cfg instructions so that the program uses the default IMU frequency values instead of your custom ones?
# Configure depth and color streams
config_imu.enable_stream(rs.stream.accel, rs.format.motion_xyz32f)  # Acceleration
config_imu.enable_stream(rs.stream.gyro,  rs.format.motion_xyz32f)  # Gyroscope

I have not seen that 'Too many files' error before with RealSense and so do not have advice to offer about it unfortunately, though it does also occur with non-RealSense cases, as shown by googling for the term raspberry pi too many open files
In the second script that does work but does not provide image data, that is because you do not have any code for accessing the depth and color streams in it, right?
In the first script, it seems unusual to me to have two imshow instructions one after another, What happens if you comment out the infrared image line?
cv2.imshow('RealSense', images)
cv2.imshow('Infrared image', infrared_images)

Yes, the second script does work and provides imu data only.
I tested The first script for two hours, it also works without any errors. It does not matter on the number of windows I opened to show the image as below.

Thus, I believe two pipelines got certain conflicts when I started image stream and imu stream simultaneously. When the imu stream stop and start, it takes up the new usb port. and then got error libusb: error [_get_usbfs_fd] libusb couldn't open USB device

What happens if you reverse the order of the stop() instructions so pipeline stops first and imu_pipeline stops second?
Does it also make a difference if you put a sleep instruction between the stop() instructions to delay the stopping of the second pipeline for a short time?

What happens if you reverse the order of the stop() instructions so pipeline stops first and imu_pipeline stops second?
Does it also make a difference if you put a sleep instruction between the stop() instructions to delay the stopping of the second pipeline for a short time?

Hi @MartyG-RealSense ,
I changed the order of the stop(), and added a 0.2-second or 0.5-second delay between the pipeline stopping and restarting. It did not work...

At https://github.com/IntelRealSense/librealsense/issues/10238#issuecomment-1046105324 I tracked down another Python IMU + depth + color script that uses threading as its approach to resolving the problem of enabling three streams.

After discussion of the Raspberry Pi IMU issue with my Intel RealSense colleagues, it was decided that we will keep this issue open to give further Raspberry Pi users who have this problem the opportunity to add comments about their own experiences.  Thanks very much for your report!

Another issue with IMU on Raspberry Pi was reported at https://github.com/IntelRealSense/librealsense/issues/11292


sam_feature_history[-1][0] error

using version 1.2.1 I am loading features folder and trying to work on it but this errors shows up.

Could you please provide a detailed description of the scenario in which this issue is triggered? Does it occur when finishing a labeling session and labeling after loading new features?

I launch QGIS and open the Geo SAM tool. The demo image appears and works fine in both hover and selection modes. However, when I attempt to work with the features folder, the tool becomes buggy. Based on my observations, I suspect that the issue is related to the shapefile, or something related to it. I also tried loading a previously worked-on shapefile, but it didn’t work either.
I think it's better to add a create new shapefile button maybe the automate system that creates shapefiles gets bugged I am not sure.
I will try to record a video and share it with you.
"C:\Users/ASUS/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Geo SAM\tools\widgetTool.py", line 609, in save_shp_file               if self.sam_feature_history[-1][0]              IndexError: list index out of rang

Thank you for your feedback. I look forward to your video. The previous testing primarily focused on labeling. We will conduct new tests specifically for loading new shapefiles in the future.

Hello here an example of my workflow:
https://github.com/coolzhao/Geo-SAM/assets/82387511/ebffff01-3cd5-476a-acb8-f65e301b8bea

I encoded new image then worked on it saved the shapefile then reloaded the feature folder and shape file. Thats when its stop working
The issue happens when we reload the feature folder and shape file.
I tried with almost all versions same issue. I will try again to see if one of dev builds work.

Okay an update, creating a new shapefile using "from file" makes a new shp file where the selection hovering and saving works. However, loading a saved shp doesn't.

when i close QGIS it shows this crash i dont know if its related.

on latest dev version.

Hi @4del-Yousefi. Could you please share the projection details for both the previous and current shapefiles? The projection files have the same name as the shapefile, with the extension ".prj", and can be opened with a text editor. We did not encounter this issue during our testing on our own dataset. Your case can help us further improve the code.

prj file with issues:

PROJCS["WGS_1984_UTM_Zone_40N",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",57.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]

PROJCS["WGS_1984_UTM_Zone_40N",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",57.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]
newly created prj that works:
1)
PROJCS["WGS_1984_UTM_Zone_40N",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",57.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]

According to this log, it seems that the newly added feature IDs (FID) are smaller than the ones previously saved. It appears that QGIS did not add the FIDs in chronological order. In the future, we will try customizing the FIDs in the attribute table instead of relying on QGIS's automatic generation. However, this will take some time. For now, please work with the new shapefile for your remaining work, and merge it after finishing all the work. Besides, if possible, could you share your shapefile with issues so that we can further investigate the cause of the error, debug the code, and resolve the issue.

BuggedShp.zip
I have attached the bugged shapefiles. take a look.

Thank you for sharing. We will use this shapefile to determine the source of the issue, but it may take some time to resolve it and publish a new version.


Feat/support for dms node dashboard

PR-Codex overview
This PR updates the versions of several modules and adds a new error variant.
Detailed summary

Updated version of db3.js to 0.4.0
Updated versions of db3-cmd, db3-proto, db3-crypto, db3-storage, db3-base, db3-event, db3-node, and db3-sdk to 0.4.0
Added new error variant DatabaseAlreadyExist in db3-error module

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Codecov Report

Merging #575 (b290d08) into main (8875059) will not change coverage.
The diff coverage is n/a.

:exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.
@@           Coverage Diff           @@
##             main     #575   +/-   ##
=======================================
  Coverage   64.73%   64.73%
=======================================
  Files           9        9
  Lines         448      448
  Branches       67       67
=======================================
  Hits          290      290
  Misses        158      158

Flag
Coverage Δ

rust
64.73% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more


Parsing double quotations

Someone in my Discord was having issues with config values being read incorrectly. It turns out that the quotes around the options they'd changed were being included in the values.
The "standard" quotes are just a ".
https://unicode-table.com/en/0022/
However, for whatever reason, in their config, they had “ ”
https://unicode-table.com/en/201C/
https://unicode-table.com/en/201D/
These weren't being parsed correctly when the config was loaded.
Not sure if this is a configurate issue or something with the HOCON lib, but either way, I'd be great if it could be patched.
Thanks. :)

Using those unicode quotes, is pretty indicative of using microsoft word as a text editor instead of a word processor. May have been from elsewhere though.

Quotation marks are unfortunately something that is handled by the hocon library. The most we could do would be perhaps the option to filter input -- but the best way to resolve this would probably be to get it changed in hocon.